Replace invalid characters in OpenInMarked.scpt
Just a quick workaround for invalid chars in note titles:
OpenInMarked.scpt chokes on nvALT filenames with invalid characters (since the actual filenames get replacement chars, but the note title retains the original chars, and the script uses UI scripting to grab the note title to try to find the actual file).
In my case, my note title had a ":" which was replaced with a "-" in the actual filename. Adding the following to OpenInMarked.scpt helped it find the file correctly.
on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars
Then, immediately after setting p
to the
UI-script-derived note title,
try
set p to my replace_chars(p, ":", "-")
end try
I imagine this same process could easily take a list of other invalid chars besides ":" to help make sure the file opens.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 09 Apr, 2013 03:26 AM
Nice. Another one was submitted that shells out to
tr
, but I like the pure AS solution. I'll test and incorporate it soon.-Brett