I’m trying to write an apple scrip to search Sparrow (mail client for Mac)
Here is the script:
on run argv
tell application "Sparrow"
activate
end tell
tell application "System Events"
key code 3 using {option down, command down}
keystroke argv
end tell
end run
The problem is that I want the script to take an argument on run so that I can supply it with what to search for, but I can’t get it to pastet it out.
argvis always initialized to a list.You can never tell the exact number of parameters that will be sent to the script, so a better route would be to iterate through the list and do whatever needs to be done, as shown below:
@Runar
You can’t do this as written (the result of
every text item of argvis still a list). However, if you coerce the result into a string, this will work, but it will squash everything together (assumingAppleScript's text item delimitersis""). If youset AppleScript's text item delimiters to space, then this would actually be better than the previous script…