|Ned Batchelder : Blog | Code | Text | Site|
AppleScripting Windows drives on Mac OS X?
» Home : Blog : July 2004
Today I've been hacking AppleScript to make it easier for my wife to back up her work from her Mac to our Windows box. Despite all the English-like syntax, I managed to make a new folder on the Windows drive with the date in the name, and copy her important folder into it. But I'm stumped on how to get the Windows drive connected in the first place.
When I use the Record command in Script Editor, and then manually connect the drive, I get code like this:
set target of Finder window 1 to item "Network"
I'm willing to leave aside the odd repetitive nature of these lines (why does line 2 redo what was done on line 1?) When I run this code while the network drive is already connected, it works fine. But if I run it when the drive is disconnected (which is when I need it), it fails at the third line, which is just where the UI pops up a box title "SMB Mount".
Does anyone know how to do this? Searching Google is proving fruitless. Help!