How to use AppleScript for building

I’m trying to automate building a helper app. A while ago Joe posted that AppleScript might be used for this. But I can’t get this to work:

set PathToFile to (choose file with prompt "Choose file") as string tell application "Xojo 2013r2" «event RBaescpt» PathToFile end tell

The PathToFile is an IDE script with the following code:

Dim projectToOpen As String = "/Users/beatrixwillius/Documents/\\ Datei/Development/Mail\\ Archiver/code\\ current/max\\ scheduler.rbp" OpenFile(projectToOpen) DoCommand "BuildApp" DoCommand "SaveFile" DoCommand "CloseWindow"

I get the error -1708 as Joe mentioned in his original post. But unfortunately nothing else happens except an IDE script error “Compiler error while compiling line 1”.

error “Xojo 2013r2 got an error: “Macci:Users:beatrixwillius:Documents: Datei:Development:Mail Archiver:Classes:MainClasses:Build Automation:build scheduler.xojo_script” doesn’t understand the «event RBaescpt» message.” number -1708

What am I doing wrong?

In your example script, PathToFile is still the file path. You need to pass in a string that is the code you want to run in the IDEScript.

Hi Joe,

ups. Forgot to answer.

With PathToFile I selected the the IDE script. What else should I select? What you do you mean with

???

[code]on read_file(file_path)
set open_file to (open for access file_path)
set file_contents to (read open_file for (get eof open_file))
close access open_file
return file_contents
end read_file

set PathToFile to (choose file with prompt “Choose file”) as string
set script_contents to read_file(PathToFile)

tell application “Xojo DEBUG”
«event RBaescpt» script_contents
end tell[/code]

Here’s a working example. Like I mentioned, you have to pass the script text itself as the direct object.