I’m a two day old baby in XCode, having only realized the other day that things changed with regard to AppleScript and application building; AppleScript studio never took my fancy.
I’m having some success building some useful GUI elements, without yet linking anything, but all the time I’m thinking of the code. Before I even dared think of dipping my toe into real programmers’ XCode, I spent the past two weeks building a passable working model of the app within the TextWrangler GUI, since I do most of my work in BBEdit. This demo works entirely with AppleScript and Perl and it seems to me I could use a very similar approach in an XCode AppleScript Cocoa application, since I am very familiar with both languages and will need only to learn the special ObjC dialect of AppleScript, which I certainly don’t imagine will be child’s play.
The AppleScript scripts will do all the XCode talking and drive the Perl scripts to do a lot of the special tasks that the app must do.
My first problem is relative paths within the project and the resulting executable. Below is the beginning of the file MyDocument.applescript, which runs into the embarrassment of not being able to tell me where it is. I’ve tried other things with similar results.
Since the Perl scripts will reside within the build and the app, I need the AppleScripts to know where they are, which it seems will be different during the building than in the final executable. Where should I put the AppleScript scripts and the Perl scripts and how do I get the former to find the way to the latter? The Perl scripts know where the are with a simple
pwd system call.
I hope I make myself fairly clear, and I guess it will all seem very obvious once I know the trick. I’m climbing up a very steep learning curve and will welcome any help.
property parent : class “NSDocument”
→ Added by JD
tell application “System Events”
set visible of processes whose visible is true and frontmost is false to false
end tell --<= this works fine
(path to me) as string
on error e
display dialog “” default answer e
–=> Can’t make «class ocid» id «data kptr0000000060B7660002000000» into type constant.
end init – etc. etc.