I need to figure out how to write a line in an applescript that will take what's on the clipboard (will be a file path) and paste it into the Terminal after the "cd" command. Then it will list out all of the files in that file path and save it as a txt file.
Right now, it looks a little something like this and I get the error is "Cant get keystroke "cd" of application "Terminal"
on open {dropped_item}
tell application "Finder" to set the clipboard to the dropped_item as text
tell application "Terminal" to keystroke "cd"
tell application "System Events" to keystroke "v" using {command down}
do shell script "ls */* | cat>>~/Desktop/filelist.txt"
end open
OR If I use this script, I get this error: "AppleEvent handler failed"
on open {dropped_item}
tell application "Finder" to set the clipboard to the dropped_item as text
open application "Terminal"
do shell script "cd" and pastefromclipboard
do shell script "ls */* | cat>>~/Desktop/filelist.txt"
end open
I also remember seeing something to the effect of "Can't make 'cd' into boolean" but I cannot find that version of my script at the moment.
Any help with this would be great. Thanks!
Right now, it looks a little something like this and I get the error is "Cant get keystroke "cd" of application "Terminal"
on open {dropped_item}
tell application "Finder" to set the clipboard to the dropped_item as text
tell application "Terminal" to keystroke "cd"
tell application "System Events" to keystroke "v" using {command down}
do shell script "ls */* | cat>>~/Desktop/filelist.txt"
end open
OR If I use this script, I get this error: "AppleEvent handler failed"
on open {dropped_item}
tell application "Finder" to set the clipboard to the dropped_item as text
open application "Terminal"
do shell script "cd" and pastefromclipboard
do shell script "ls */* | cat>>~/Desktop/filelist.txt"
end open
I also remember seeing something to the effect of "Can't make 'cd' into boolean" but I cannot find that version of my script at the moment.
Any help with this would be great. Thanks!