mardi 3 février 2015

Check if a specific window pops up, then do this


I'm building an Applescript that launch FileZilla, then import a queue from an xml file. The problem is, when a download was previously started and the file already exists on the disk, FileZilla pops a window named "Target file already exists" giving you the choice of overwriting, resuming, replacing, etc the file. So I'm looking for a way to check if this window "exists" (I don't know if its the right term) and if it does, press tab four times to select resume and then press return.


Here's what I have so far. The "repeat until exists window "Target file already exists"" part does not seem to be working.



activate application "FileZilla"
tell application "System Events" to tell process "FileZilla"
click menu item "Import..." of menu 1 of menu bar item "File" of menu bar 1
keystroke "h" using {command down, shift down}
delay 1
keystroke "documents"
key code 124 # right arrow
keystroke "queue"
keystroke return
keystroke return
keystroke return
keystroke "p" using command down
delay 3
repeat until exists window "Target file already exists"
beep 2
delay 3
repeat 4 times
key code 48 # press tab
delay 1
end repeat
key code 36 # press return
end repeat
end tell


What am I doing wrong? Thanks





Aucun commentaire:

Enregistrer un commentaire