Hello
I am new to AppleScript. I am trying to detect when a document window in a non-scriptable application is open. When it is open, I want to close the Safari window. The code below basically polls each second to check for the window. However, it seems “Logic Pro” doesn’t understand “if window 1 exists”. I get the error:
“Logic Pro got an error: window 1 doesn’t understand the exists message.”
Is there any way to detect whether a window exists if the application doesn’t understand “application specific” commands? Any advice would be greatly appreciated.
Thanks in advance for you help.
Lars
	tell application "Finder"		
		set window_check to false
		repeat until (window_check)
			if process "Logic Pro" exists then
				if window 1 exists then
					tell application "Safari"
						if window 1 exists then
							close window 1
							set window_check to true
						end if
					end tell
				end if
			else
				tell application "Safari"
					activate
					if first document exists then
						set URL of first document to "http://localhost/"
					else
						make new document with properties {URL:"http://localhost/"}
					end if
				end tell
				set window_check to true
			end if
			delay 1
		end repeat
	end tell