Xcode/AppleScript/Xojo

Here is what I would like to do… using AppleScript or another easy method (hopefully)

create a XOJO method with a signature something like : x=Run_Xcode(f,device)
where F is a folderitem the points to an .XcodeProj file.
and device indicates (iPhone,iPad etc in the iOSSimulator, -OR- the users physical device)
When this method is execute it would perform the following steps

  • Launch Xcode
  • Load the project specified by “F”
  • CLEAN the project (very important)
  • set the destination to the device specified
  • run the app (launching it in iOSSimulator if physical device not selected)

I can easily get the first two by simply using f.launch
but the last 3 I cannot seem to get to work.

Using SYSTEM EVENTS to simulate menu clicking is a problem, as the available device family choices are somewhat controlled by the Xcode project (ie. an iPhone app won’t have iPad on the menu and vice versa)

I would try this with command line tools.
There is one to build xcode projects.
Launching Simulator can also be done with right command line.

What will the return value x hold?

Xcode does offer a “clean” command in AppleScript, for what that’s worth.

X would be a boolean success or fail flag (a nice to have)

I played with an AppleScript I found… and could get it to clean … but NOT set the device and run the simulator… I could START the simulator… but not the app

application "iPhone Simulator" quit
tell application "Xcode"
	open "Users:daveS:Desktop:Project1:Project1.xcodeproj"
	tell project "Project1"
		clean
		build
	end tell
	
end tell

application "iPhone Simulator" activate

and for some reason when I tried to use some declares from a previous topic to RUN this AS… it did part of it and bombed (the XOJO not the AS … in AS Editor it runs fine … just doesn’t run the app in the sim)