Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Dr Kevorkian94

macrumors 68020
Original poster
Jun 9, 2009
2,179
83
SI, NY
Hi all! Im attempting to have an AppleScript recognize if my iPad appears in the Finder window and am running into some issues. I found a script online but it needed to be modified presumably because updated OS. I can't seem to get the if statement to be true....

set iPadName to "iPad" tell application "System Events" to tell outline 1 of scroll area 1 of splitter group 1 of window 1 of application process "Finder" set hasFoundiPad to false repeat while not hasFoundiPad set elements to first UI element of every row repeat with e in elements try if name of e is iPadName then set hasFoundiPad to true exit repeat end if end try end repeat delay 1 end repeat end tell

In the events portion of the console it seems to be getting the correct name for each UI element in my finder window:
get name of UI element "iPad"
of row 16 of outline 1 of scroll area 1 of splitter group 1 of window "Recents" of application process "Finder"


But the IF issn returning true....Any ideas on wants wrong here?

Edit: It seems this is due to the singe quote and spaces i have in the name of my actual iPad which is like "Tommy's iPad" not sure proper way to escape the characters here.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.