I have OS Tiger, why does the following not work???
tell application "iCal" to activate
delay 2
tell application "System Events"
tell application process "iCal"
click menu item "Back up Database..." of menu "File" of menu bar 1
end tell
end tell
It’s because the three dots on the menu item are an ellipsis.
.
not three full stops
…
Try replacing the dots.
tell application "iCal" to activate
delay 2
tell application "System Events"
tell application process "iCal"
click menu item "Back up Database." of menu "File" of menu bar 1
end tell
end tell
PS you might be interested in this that doesn’t use scripting the GUI.
-- Make iCal Backup --
-- Makes icbu file for iCal at user's Desktop.
-- Will only work in 10.4.
-- John Maisey -- 5th September 2005 -- 1.1
-- Added option to locate info in other locations. 15 Jan 2006
set myPath to (path to desktop from user domain)
-- If you want to hard code a path to the destination folder
-- replace '(path to desktop from user domain)' in the above linewith
-- 'folder "path:to:your:folder:"'.
--set myAppSuppPath to alias ((choose folder with prompt "Locate your old Applcation Support folder.") & "iCal" as text)
set myAppSuppPath to alias (((path to application support from user domain) as text) & "iCal")
set myNowFormat to do shell script "date +%FT%TZ"
set myDayFormat to do shell script "date +%d/%m/%Y"
set myNewName to ("iCal " & myDayFormat & ".icbu") as text
set myPreamble to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" & return & "<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">" & return & "<plist version=\"1.0\">" & return & "<dict>" & return & " <key>date</key>" & return & " <date>"
set myPostamble to "</date>" & return & " <key>version</key>" & return & " <string>1.0</string>" & return & "</dict>" & return & "</plist>"
set myPlist to (myPreamble & myNowFormat & myPostamble)
tell application "Finder"
if exists file myNewName of myPath then
set myButton to button returned of (display alert "\"" & myNewName & "\" already exists" message "Would you like to replace this file?" as warning buttons {"Cancel", "Replace"} default button 2 giving up after 120)
if myButton is "Replace" then
delete file myNewName of myPath
else
return
end if
end if
set myFolder to (duplicate myAppSuppPath to myPath)
delete (files of myFolder whose name contains "sync" or name contains "alarms")
set myInfoPlist to make new file at myFolder with properties {name:"Info.plist"}
my WriteToFile(myInfoPlist as text, myPlist, true)
set name of myFolder to myNewName
end tell
--handler to write text to text file with flag to clear text before
on WriteToFile(theFile, theText, clearFLag)
try
open for access file theFile with write permission
end try
if clearFLag is true then
set eof of file theFile to 0
end if
write theText & return to file theFile starting at eof
try
close access file theFile
end try
end WriteToFile
I just decided to copy the folder from Application Support under the user profile. Is there any negative to me doing this? I have tried and copied it back and it works perfectly on a freshly installed OS X.