Asked — Edited

Script Done Command

Hey again everyone. Happy New Year!

New question... without using sleep commands is there a way to start another script when another finishes? Reasoning for this is.. I'd like to showcase all functions of my machine. So basically when I say" robot what can you do" it would start with " I can move my head" followed with head movement, when this script is done it is followed by " I can move my arms" and the arms move etc etc. All of my movements have been made in the script manager being easily linked via control command. Just thought it would be a neat idea. Script done go to next script. Thanks guys!

      Chris

In the Allen Bradley plc programming world we'd call it "step programming "


ARC Pro

Upgrade to ARC Pro

With Synthiam ARC Pro, you're not just programming a robot; you're shaping the future of automation, one innovative idea at a time.

#1  

There may be a better way to do this, but I would do it like this. I assume you don't always want the scripts to each run in sequence, so I would use a variable to turn on "demo mode". At the end of each script, I would check if that variable is on or off, and if it is on, I could execute the next script.

So for example, in the init script, you set the variable to off so that other scripts that look at it don't error.


$demomode="OFF"

Then, at the end of each script:


if $demomode="ON"
ControlCommand( "Script Manager", ScriptStart, "NextScript" )
endif

Were "NextScript" is actually the name of the script that should execute after this one.

Finally, you need one more script that turns on demo mode, and starts the first script:


$demomode="ON"
ControlCommand( "Script Manager", ScriptStart, "FirstScript" )

Alan

PRO
Synthiam
#2  

The easiest and more effecient way is to use the built-in ScriptStartWait command..

  1. Load ARC

  2. Press EXAMPLE PROJECTS from the Bookmarks window

  3. Enter the EZ-Scripts Examples folder

  4. Either locate "Procedural 3" project or search for "ScriptStart"


# Run script and wait for it to finish
ControlCommand("One Script", ScriptStartWait)

# Now run the next script and wait for it to finish
ControlCommand("Another Script", ScriptStartWait)

Print("There are no more scripts")

For more information about example EZ-Script projects, visit this activity: https://synthiam.com/Tutorials/Lesson/22?courseId=6

#3  

Well... That is certainly better, and I looked for something like that in the script manual in ARC before answering because I was sure I had seen it, but the command is not documented......

Alan

#5  

But how would I know what "ScriptStartWait does if it is not documented without looking at every tutorial and sample? Like I said, I knew I had seen something like this. I probably looked at that sample a couple of years ago, but without a document to reference, it is very difficult to remember every thing that ARC can do.

I'll drop it since we have answered the original question, and the solution is elegant, but this is a recurring theme...

Alan

PRO
Synthiam
#6  

The command is assembled using 3 words, Script Start and Wait. The purpose of using descriptive commands is to identify what they do with words, much like a short sentence.

ControlCommand() is how controls speak to other controls. Each control has it's own ControlCommand, this includes 3rd party plugins as well. ControlCommands() are Control specific and not part of the EZ-Script language. ControlCommands() are documented by their respective control using the Cheat Sheet or Right-Click in the editor to display.

The recurring theme only applies to those who forget to use the CheatSheet tab or Right-Click in the editor - neither of which you had done when answering the question.

The recommended first point of action to identify the capabilities of a Control is to look in the CheatSheet tab or Right-Click in the editor, each of which will return the same results.

#7  

Quote:

The recurring theme only applies to those who forget to use the CheatSheet tab or Right-Click in the editor - neither of which you had done when answering the question.

That is insulting, and innacurate.

We clearly are never going to agree on how software should be documented, so subject dropped.

Alan

PRO
Synthiam
#8  

I would never want to insult you or come off that way. My response may sound mechanical because i'm juggling a few other tasks while responding to this.

The ControlCommand() uses self documenting descriptions for commands. If your suggestion is to add another layer of documentation to the ControlCommand() Cheat Sheet display, then that's duly noted. However, keep in mind that the CheatSheet and all uses of it would increase in length/size exponentially with paragraph of description per self-documented command... and be even more difficult to read, considering the CheatSheet is already being skipped as a source for available commands.