How to start and run an AS Studio App from other scripts

…“other scripts” meaning “real” scripts or e.g. the “run AppleScript” functionality in FileMaker Pro.

Hi,

I have an AS Studio app that runs fine in interactive mode. I.e., I have a handler like this

on clicked theObject
if the name of theObject is “StartButton” then
eupdate()
else if the name of theObject is “QuitButton” then
quit
else
–display dialog “Error
end if
end clicked

If I click the startButton, the function eupdate is called and runs. So far, so good.

Now I want to start the eupdate() function from within FileMaker Pro, using the “Run AppleScript” script step. So I’d assume it goes with putting a
“tell application “Macintosh HD:Users:.app”
launch
activate
end tell”

into the FMPro script step. The problem is: How do I tell my App to actually start and run eupdate() just the same way as if it had been started by clicking on the StartButton in window “main”?

I have tried
on start
eupdate()
end start

and modified the Filemaker script step to look like
“tell application “Macintosh HD:Users:.app”
launch
activate
start – this is the added line
end tell”

but this obviously is too simple, since it does not work. :rolleyes:

Any help would be greatly appreciated!!

Since you already have the handler attached to the button, just tell the button to perform its action:

Jon


[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Jonn8, Bingo! that made it. Many thanks!!

But now i have the next problem, which seems more Filemaker-related: My AS Studio app, when running, opens and closes the Filemaker file from which it is called this time. usually, when launching the app manually, that’s no problem. When controlled from within filemaker of course the app tries to close the Filemaker file from which the (Filemaker) script calls it. This generates sort of a deadock and runs into an error, which I can understand.

Does anyone have a solution to this. I could imagine something like

  • launch and run the app
  • tell the app to wait for 3 seconds
  • close the Filemaker file (or Filemaker completely)
  • continue running the app

Maybe someone has a more elegant solution?

Again, I’d greatly appreciate any help.