Hello,
I made a "app" in Automator which takes the path and name of the file I have highlighted in Finder, opens Terminal, opens the path and runs a script on the file. It works great except when there is a space in the path to the file, then stops it (and run the folder named as the first part without spaces, if the folder exists - for example, I want to open the path "Hello to you", it opens the folder "Hello" if available.
Here is the relevant part of my Automator script:
tell application "Terminal"
Activate
if not (exists window 1) then reopen
end tell
tell application "System Events"
keystroke "t" using command down
keystroke "cd \""
keystroke "v" using command down
return keystroke
I have tried, as you see with \" to insert quotation marks as characters (to get an absolute path) according to the instructions at https://developer.apple.com/library...leScriptLangGuide/reference/ASLR_classes.html but it does not seem to work anyway. Even tried writing quote as suggested as an option on the apple page. Some other sites mentioned "& quote &" as an option, but not working either. Also tried to add key code 39 (which should correspond to quote symbol) on a new line, but also not working. If I use terminal history and add quotation marks before and after the path, everything works perfectly, and that's why I have focused on trying to get the quotes automatically
Someone who is awesome with Automator / AppleScript that can help me?
I made a "app" in Automator which takes the path and name of the file I have highlighted in Finder, opens Terminal, opens the path and runs a script on the file. It works great except when there is a space in the path to the file, then stops it (and run the folder named as the first part without spaces, if the folder exists - for example, I want to open the path "Hello to you", it opens the folder "Hello" if available.
Here is the relevant part of my Automator script:
tell application "Terminal"
Activate
if not (exists window 1) then reopen
end tell
tell application "System Events"
keystroke "t" using command down
keystroke "cd \""
keystroke "v" using command down
return keystroke
I have tried, as you see with \" to insert quotation marks as characters (to get an absolute path) according to the instructions at https://developer.apple.com/library...leScriptLangGuide/reference/ASLR_classes.html but it does not seem to work anyway. Even tried writing quote as suggested as an option on the apple page. Some other sites mentioned "& quote &" as an option, but not working either. Also tried to add key code 39 (which should correspond to quote symbol) on a new line, but also not working. If I use terminal history and add quotation marks before and after the path, everything works perfectly, and that's why I have focused on trying to get the quotes automatically
Someone who is awesome with Automator / AppleScript that can help me?
Last edited: