Jump to content
Sign in to follow this  
siroos12

How to run a script with custom functions?

Recommended Posts

Hi everyone,

 

How can we run a script using custom functions? By either employing plugins or native FileMaker methods? 

 

I have checked plugins like Scriptmaster and BaseElements and they work pretty well, but their problem is that the called script got queued in scripts queue and wait for current running scripts to finish and then the called script via plugin would run. 

 

I need a solution, to pause the running script, then run the recently called script, go back to parent script and wait for user to resume it.

 

Thanks in advanced for your time.

 

Regards,

Share this post


Link to post
Share on other sites

It might help to be more specific about the problem you're trying to solve, but AFAIK there's no way to pre-empt the script queue. Not sure what custom functions have to do with this question.

Share this post


Link to post
Share on other sites
On 9/15/2017 at 2:37 PM, siroos12 said:

I need a solution, to pause the running script, then run the recently called script, go back to parent script and wait for user to resume it.

Your script, if it holds the sub-script within it, will pause until your sub-script finishes and then resume automatically.  If you want your sub-script to pause at its end for the user to click a continue, you can place the pause in the sub-script at its end.  You can also include a RESUME on a button but until we understand what you're trying to accomplish, as Tom indicates, we're just guessing.

Share this post


Link to post
Share on other sites

Hi,

 

Thanks for comments, I am actually trying to open new window in the middle of my script and do some other tasks after that and then pause for user input.  

So far everything is clear to me and easy to achieve, the only problem is that in this way, I have to add several lines of script to open up that new window and then pause the parent script.  

 

I considered custom functions cause I though it might be possible to make a custom function to run the subscript and pause the parent script. This way I could replace all the script lines with one line of custom function as a variable.

Share this post


Link to post
Share on other sites

Please provide a copy of your scripts.

Share this post


Link to post
Share on other sites

Please receive attached.

What I am after is to replace the first two lines of the "Parent script" with a set variable script step which the variable would be a custom function to set the $test and run the script called "Show Card".

 

The problem is when I put the  "Show Card" script in a custom function, it will run after the parent script is run completely. It is supposed to pause the parent script, then run the Show Card and wait for user to click on  the button on Card Layout. 

After user clicks on the button, it should close the window and resume the parent script.

 

I am not considering to take apart the parent script and run the second part of it after running the Show Card script as a solution due to the structure of my file.

 

Regards,

test.fmp12

Share this post


Link to post
Share on other sites

Hi Siroos,

Thank you for providing the sample file.  :-)  Unfortunately it isn't enough for us to have a clear sense of what you are wishing to accomplish.

On 9/19/2017 at 7:04 AM, siroos12 said:

make a custom function to run the subscript and pause the parent script.

It normally requires a SCRIPT to perform a script action.  Custom functions are functions used in calculations and calculations can't act. There was a plugin, I forget its name, which would fire a script based upon a field-value change.  I quit using it 15 years ago because it was too dangerous and unpredictable.  Michael, Tom or Wim might remember its name.

6 hours ago, siroos12 said:

It is supposed to pause the parent script, then run the Show Card and wait for user to click on  the button on Card Layout. 

After user clicks on the button, it should close the window and resume the parent script.

 Why wouldn't a Resume Script work for you?  Anyway, I've attached a revised file showing how I could provide you with your request immediately above.  I hope it is helpful but I suspect, as Tom points out, you need to rethink your approach instead.

testREV.fmp12

By the way, I included passing a script parameter back.  Sometimes a small thing can help in reconsidering an approach.

  • Like 1

Share this post


Link to post
Share on other sites
16 minutes ago, LaRetta said:

There was a plugin, I forget its name, which would fire a script based upon a field-value change.

Actually, there were at least four of them: EventScript, DoScript, zippScript and FMI's own plugin example.

 

 

Edited by comment
  • Thanks 1

Share this post


Link to post
Share on other sites
15 hours ago, comment said:

Actually, there were at least four of them: EventScript, DoScript, zippScript and FMI's own plugin example.

Also: WorqSmart Events, Dacons ScriptFire, and Troi Activator.

But still, you can't hijack a running script. What you can do is pause the script at a specified point, which might be inside a loop for example, and each time around the loop it tests for something (is the shift key down, is the record number > 10, etc.) -- and it can pause indefinitely or for a specified amount of time (how short is up to you) during which you can fire up another script via trigger or button or menu.

Share this post


Link to post
Share on other sites

Thank you for all advises. I appreciate your time. 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.