Pushkraj Posted April 7, 2009 Posted April 7, 2009 (edited) Hi, Perform AppleScript script step has 2 options. 1. Calculated Apple Script. 2. Native Apple Script. 3. (It should have something like this where we can just provide the path of an apple script, where it is located and the apple scripts gets executed) What I need is, I want to simply execute an apple script from my file maker script. Generally we specifically create the apple script code (either native or calculated code) in perform apple script, script step. What if I have a perfect running applescript available with me, just needs to run it using my file maker script. I tried using Send Event script step, to see if I am able to execute an existing apple script, but it didnt helped me out. Platform is FM for Mac and I am using Mac mini machine. I think Send Event script works fine only in Windows environment and not on Mac. Please Suggest Edited April 7, 2009 by Guest The Topic: <a href="http://fmforums.com/forum/showtopic.php?tid/202663">Running AppleScripts from FM database</a> was moved from <a href="http://fmforums.com/forum/showforum.php?fid/269">FileMaker Pro 10</a> to <a href="http://fmforums.com/forum/showforu
Søren Dyhr Posted April 7, 2009 Posted April 7, 2009 You didn't mention if your applescript is compiled into an application? A tool your solution might benefit from is this: http://www.sveinbjorn.org/platypus --sd
Pushkraj Posted April 7, 2009 Author Posted April 7, 2009 Yes the apple script is compiled and is running fine with Apple Script editor's "Run" button. Just I want is that FileMaker should be able to run this applescript without creating the apple script code (native or calculated) in PerformAppleScript, script step.
Søren Dyhr Posted April 7, 2009 Posted April 7, 2009 Yes the apple script is compiled and is running fine with Apple Script editor's "Run" button. To me is this a conflicting statement either is the execution performed via the script editor or a standalone application is called via Send Event? --sd
Pushkraj Posted April 7, 2009 Author Posted April 7, 2009 (edited) The execution of apple script currently is happening via the Apple script editor. I want it to happen via file Maker script. Perform Apple script (Native / Calculated) will not help me as in that case I shall have to recreate the entire apple script logic. I tried using Send event script step by providing the path of my Apple Script under the Document Radio button option of "Send Event" options dialog. But the apple script is not getting executed by the Script Editor.app Send Event ["Script Editor.app";"misc";"dosc";"DisplayDialog.scpt"] is what I tried out. One more question I just selected the Display Dialog.scpt under this script step. Script Editor.app";"misc";"dosc" how all these options got selected automatically. What if I want to change these options... Please refer to Picture2.png for the screen shot of "Send Event" options dialog. Send Event is not executing the required Apple Script. Please suggest Edited April 7, 2009 by Guest
Søren Dyhr Posted April 7, 2009 Posted April 7, 2009 I gave the various methods a stab, and could not get Send Event to behave as expected, which could have something to do with naming conventions differing a little between applescrip and shell scripts... However have did I make some progress and ended up with this method, which includes an applescript saved as an application and stored in a containerfield, from where it's send out into the OS and executed and then deleted when completed. --sd Untitled.zip
Søren Dyhr Posted April 7, 2009 Posted April 7, 2009 Send Event ["Script Editor.app";"misc";"dosc";"DisplayDialog.scpt"] is what I tried out. One more question I just selected the Display Dialog.scpt under this script step. Script Editor.app";"misc";"dosc" how all these options got selected automatically. What if I want to change these options... Use the "other" option instead of the "do script" ...not that I got it working, but it should answer this particular question ...as always are developers forced to tinker for hours when getting the gist of what the error messages refer to! --sd
Fenton Posted April 7, 2009 Posted April 7, 2009 Søren, yours didn't work because of a simple (and odd) behavior of the Finder, which is that you cannot use "path to desktop" inside a Finder tell block. The Finder uses: desktop, or if you want text, desktop as text With that small change, your method works. I have to question Pushkraj why this is necessary. Usually you can copy/paste an AppleScript into the Perform AppleScript step's native AppleScript box, with only minor changes. But, yes, sometimes changes are required, and often they are for obscure reasons (FileMaker doesn't like "write file" for example). If you know what these differences are beforehand, you can write your original AppleScript to accommodate them. I often keep the FileMaker blocks separate in my AppleScripts, putting them into subroutines when called by another application, which minimizes nasty surprises. But if your AppleScript is very complex, with lots of this stuff, the Export and run seems a good method.
Pushkraj Posted April 8, 2009 Author Posted April 8, 2009 (edited) Thanks Fenton and Soren for the valuable inputs.. To answer Fenton. actually I am getting stuck for hours in correcting the syntax of the native apple script. So it could be reasonable enough if I am able to execute the apple script directly without generating the code in perform AppleScript(). I tried doing this also.... 1. I saved the apple script as .app rather than .scpt 2. I saved the required .app at Macintosh HD 3. I tried using send event script step, with path set to Macintosh HD 4. I was not able to select the .app, it was disabled. 5. Hence was not able to use this .app in send event. 6. Is this creates a new thread to our current discussion? Pushkraj Edited April 8, 2009 by Guest
Søren Dyhr Posted April 8, 2009 Posted April 8, 2009 I could indeed see the problem Fenton pointed out, if say the filemaker file was to be run from download folder under OS X 10.5 ... so my choise was to use $variables to get both context and assemble the scripting ... see if this works? --sd IndependentContext.zip
Recommended Posts
This topic is 5709 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now