mkunesh
asked on
How to check the existence of a directory in AppleScript
I am trying to write an AppleScript to automate the usage of a separate application. Essentially the AppleScript launches the application, delays a few seconds, activates the application, delays a few seconds, and begins entering text to fill out fields. I want to add an "if else" statement to check the existence of a a specific directory in the user's home folder. If the directory does not exist, I want the time delay between the application launching and the application activating to be larger. If the directory does already exist, then I want the delay to be smaller.
I attached the beginning part of the AppleScript, all of which works fine. I need to start off the script with some sort of "if" statement that "if directory ~/Library/Application\ Support/TextEdit does not exist, delay 5 minutes. If it does exist, then delay 10 seconds. After the time delays, I need it to continue with the script telling System Events to keystroke different info.
I attached the beginning part of the AppleScript, all of which works fine. I need to start off the script with some sort of "if" statement that "if directory ~/Library/Application\ Support/TextEdit does not exist, delay 5 minutes. If it does exist, then delay 10 seconds. After the time delays, I need it to continue with the script telling System Events to keystroke different info.
#open's the program TextEdit.app
delay 5
do shell script "open -a TextEdit"
delay 30
tell application "TextEdit"
activate
tell application "System Events" to keystroke "TestText"
tell application "System Events" to keystroke tab
tell application "System Events" to delay 0.5
tell application "System Events" to keystroke tab
end tell
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER