AppleScript: check if File is open in Numbers

a Simple Script to test if the File is already open, if not Open the File

on run
	set thisFunnelFile to (choose file of type "Numbers")
	tell application "Numbers"
		launch
		activate
		set tmpList to name of every document
		--set file_name to name of (info for alias "Macintosh HD:path:to:file.txt")
		set tmpdata to name of (info for thisFunnelFile)
		if tmpList does not contain tmpdata then
			-- set editDoc to (open thisFunnelFile) --> targetDoc contains a name reference to the opened document.
			open thisFunnelFile
			--else
			--set editDoc to thisFunnelFile
		end if
	end tell
end run
Posted in Apple Hardware, Automation and tagged , , , .

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.