How is everybody scripting updates of their dot.mac iDisk sites?

Hi

Fourth try.

How is everybody scripting updates of their dot.mac iDisk sites with Applescript? Is it even possible?

Thanks,

guy

It’s not as clean as just using curl or something to upload a file, but it’s still completely able to be automated using a little GUI scripting (make sure you save your iDisk password in the keychain or you’ll have to add code to type your password when prompted):

property my_idisk : "your_idisk_name"
property my_site_root : my_idisk & ":Sites:"

my upload_file(((choose file) as alias), "your_site_subfolder")

on upload_file(the_file, the_site)
	if mount_idisk() = true then
		try
			tell application "Finder" to duplicate the_file to ((my_site_root & the_site) as alias) with replacing
			return true
		on error
			return false
		end try
	else
		return false
	end if
end upload_file

on mount_idisk()
	if my_idisk is not in (list disks) then
		tell application "Finder" to activate
		tell application "System Events" to tell process "Finder" to keystroke "I" using command down --capital I
		repeat 60 times --give up if you can't mount after 1 minute
			if my_idisk is not in (list disks) then
				do shell script "sleep 1"
			else
				return true
			end if
		end repeat
		return false
	else
		return true
	end if
end mount_idisk

Jon

Hi jonn8:

Thanks A LOT for responding!

This works fine in Panther. I just had to use

using {command down, shift down}

to mount the iDisk after setting the .Mac System Pref to my account and password.

So that’s interesting. The iDisk is treated like any other disk so you use Finder commands instead of special ftp- or cURL-type file transfer commands… I think I like it…

guy