Page 1 of 1

Apple Script?

PostPosted: Mon Aug 01, 2011 10:20 am
by mattias73
Hi there!

Somebody knows if Algodoo is apple script compatible? I would like to be able to scrip the start of a simulation...

Re: Apple Script?

PostPosted: Tue Aug 02, 2011 5:43 am
by Someone Else
What do you mean by that?

If you open the console (~ or F10, previously F11)and type sim.running = true, hit Enter/Return, the sim will instantly start. Sim.running = false will stop it.
This is called Thyme and it's been in Phun since the very beginning.
I mean the beginning- it was in the first prototype version that was never released to the public, according to the changelog.

You could probably also use an external program to open Algodoo.

If, however, you want to use an external program to set sim.running = true, I think that will be close to impossible and would certainly void your warranty. "What warranty? I didn't know there was a---" "THERE IS NO WARRANTY!!!!!"

Re: Apple Script?

PostPosted: Tue Aug 02, 2011 6:14 am
by Chronos
Someone Else wrote:If, however, you want to use an external program to set sim.running = true, I think that will be close to impossible

Actually, it isn't really that hard to do, it just takes some programming know-how. (Which I don't have, actually, but I've seen it done before.)

Re: Apple Script?

PostPosted: Wed Aug 03, 2011 12:37 pm
by mattias73
Someone Else wrote:What do you mean by that?



On an Apple computer there is something called apple script, making it possible to manipulate the starting/stopping etc of other programs from a written/recorded script.

So, I would like to write a script that eg starts algodoo and perhaps that then starts a simulation. The latter thing I think is possible only if the program (algodoo) is compatible with apple script.

Re: Apple Script?

PostPosted: Thu Aug 04, 2011 8:24 am
by Emanuel
mattias73 wrote:
Someone Else wrote:What do you mean by that?



On an Apple computer there is something called apple script, making it possible to manipulate the starting/stopping etc of other programs from a written/recorded script.

So, I would like to write a script that eg starts algodoo and perhaps that then starts a simulation. The latter thing I think is possible only if the program (algodoo) is compatible with apple script.

Algodoo does not support being controlled with Apple Script, however Apple Script could probably be used to press spacebar which would start the simulation (a delay would be needed after starting Algodoo). To send spacebar:

Code: Select all
tell application "Algodoo"
   activate
   tell application "System Events" to key code 49
end tell


(I have not tried the script tho.)
It should even be possible to start with a specific scene.

/ Emanuel

Re: Apple Script?

PostPosted: Sun Dec 04, 2011 1:02 am
by Split Circle
...
Spoiler: show
Code: Select all
tell application "Algodoo"
   activate
   delay 10
   tell application "System Events"
      keystroke "`"
      delay 1
      keystroke "sim.running=true" --or your code
      keystroke return
      keystroke "`"
   end tell
end tell