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

Macsavvytech

macrumors 6502a
Original poster
May 25, 2010
897
0
OK now what i want to do is create an apple script to check if file exists if it exists open it if not open a different file.
This is what i have

tell application "Finder"
try
open "Location of File 1"
on error
open "Location of File 2"
end try
end tell

The problem is apple script cant decide on error or not with an iTunes library file
 
You can check for a file's existence like so:
Code:
tell application "Finder"
	set f to POSIX file "/path/to/file"
	if f exists then
		-- file exists
	else
		-- file doesn't exist
	end if
end tell

The problem is apple script cant decide on error or not with an iTunes library file

I'm not sure what you mean. Can you clarify? Are you trying to open an iTunes library file? If so, I'm not sure if iTunes would handle that directly.
 
You can directly open an iTunes library file through iTunes by double clicking it I have edited my script abit yesterday it now resembles yours mildyly I would show you but I'm away from my computer at the moment
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.