Hello!
I’m trying to open Google Chrome in my app and run a test suite on it.
I have two .applescript files in my project:
AppDelegate
script AppDelegate
property parent : class "NSObject"
-- IBOutlets
property theWindow : missing value
property AnotherAppleScript: missing value
on applicationWillFinishLaunching_(aNotification)
set newWindow to (current application's AnotherAppleScript's launchGoogleChrome())
tell application "Google Chrome"
set windowID to id of newWindow
set URL of (its window id windowID)'s first tab to "http://example.com"
end tell
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
end script
AnotherAppleScript
script AnotherAppleScript
property parent : class "NSObject"
on launchGoogleChrome()
tell application "Google Chrome"
set newWindow to make new window with properties {mode:"normal"}
return newWindow
end tell
end launchGoogleChrome
end script
I receive this error:
2018-12-13 14:11:44.963858+0400 Test[52350] *** -[AppDelegate applicationWillFinishLaunching:]: Can’t get id of «class ocid» id «data optr00000000C08B2F0000600000». (error -1728)
Why?
Everything is fine if I try to do it in one file.