why can't it find the file?

repeat

tell application "Keynote"
	activate
end tell


tell application "Finder"
	activate
	open document file "test.key" in folder "/Users/Shared/slides"
	delay 2
	tell application "System Events" to keystroke "p" using {command down, option down}
end tell

end repeat

every time i run it or anything similar to it(too look in a directory) it says it can’t find the folder or it can’t make test.key an item. any other ways i can do this.i have gotten it to work if i have it on the desktop but this is being used for people that we dont want them finding it and deleting it.(basically the place where i work wants mac mini’s to be in a store having a slideshow of in store sales. so i wanted to have the file in a place not a lot of people look so they can’t just delete it or move it(i also will have it so they can’t delete it anyway. but still i dont want to just be on the desktop it seems so unorganized and unprofesstional)) plus on top of all that i want to be able to use this in future projects they might make me do. so any one got something that works?

Hi,

AppleScript works with HFS paths (starting with a disk name and colon separated)

Keynote is scriptable, the Finder or System Events is not needed


set documentPath to (path to shared documents folder as text) & "slides:test.key"
tell application "Keynote"
	open documentPath
	print slideshow 1
end tell

ok now it says it can’t be found it was moved or deleted. i just looked for it and its clearly there. should i just try a different folder?

Here’s an easy way to get the path you can use in your script…

set f to choose file
return f as text

You can do the same to get the path to a folder (eg. choose folder). So copy/paste the result into your script. Note that this is a string format of the path. As StefanK mentioned you want an HFS path. So to make a string into HFS style just put the keyword file or folder in front of the string path. So for example in the above script set documentPath to the string you copy and then change the line “open documentPath” to “open file documentPath”.

ok i got it to work with the first guy


set documentPath to (path to shared documents folder as text) & "slides:test.key"

repeat
	
	if "keynote" is not in "slideshow" then
		tell application "Keynote"
			open documentPath
			delay 2
			start slideshow 1
		end tell
	end if
	
		
end repeat


it works like a charm. thank you