Hello everyone,
I have a (simple) question, and it is how do I create a new script in my Xcode project? When I try to add a new file I can’t find AppleScript in the type of file to choose.
Thanks,
TechExpertHD
Hello everyone,
I have a (simple) question, and it is how do I create a new script in my Xcode project? When I try to add a new file I can’t find AppleScript in the type of file to choose.
Thanks,
TechExpertHD
Sadly, it’s not in the templates anymore. I had to create my own based on other pre-existing templates. Was quite easy. Here’s a website with the directions to do your own custom templates:
http://red-glasses.com/index.php/tutorials/making-custom-templates-for-xcode-4-march-2011/
Hope this helps!
Browser: Safari 6533.18.5
Operating System: Mac OS X (10.6)
As an alternative, could you keep one .applescript file but add a second base class? I just tried it in a test doc and it compiled so that appears to be legal. I went into my XIB file and dragged a new “cube” into the objects list. Then selected it and on the inspector tab set its class as the new one. That way you can manage the code separately in two main classes but it would all be in one file.
I’m relatively new to this, so let me know if that might cause problems.
script MainAppDelegate
property parent : class "NSObject"
property theDefaultText : "Hello"
on applicationWillFinishLaunching_(aNotification)
-- Insert code here to initialize your application before any files are opened
end applicationWillFinishLaunching_
on applicationShouldTerminate_(sender)
-- Insert code here to do any housekeeping before your application quits
return current application's NSTerminateNow
end applicationShouldTerminate_
on doProcess_(sender)
set my theDefaultText to theDefaultText & " Plus Button Click"
end doProcess_
end script
script SectionTwoDelegate
property parent : class "NSObject"
on doProcessTwo_(sender)
--
end doProcessTwo_
end script
Yes, you can do that. But it can get a bit unwieldy.
It’s probably easier to add Other → Empty, name it .applescript, and type the script declaration and parent property yourself.