News:

The purpose of these forums is to discuss TurboCAD.  Please keep the discussion of other products to compatibility issues or how the other software can be used with TurboCAD.

Main Menu
TurboCAD 2026 Platinum box
Now available

TurboCAD 2026.2

The latest update for TurboCAD 2026. It installs over any 2026 build and keeps your activation, drawings and settings. Get it from the Start Page or Help > Check for Update.

Rerunning a Ruby Script

Started by bigjimslade, November 14, 2013, 10:06:03 PM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

bigjimslade

is there some way to run a ruby script repeatedly?

I am having to run script A.

Start script B. Abort file selection.

Run script A.

Repeat.

mikek

Hi Jim,

there are 2 possibilities:

Open the script in Ruby console. Multiline option is automatically checked. Go to last line of code. Mark the name of the function definition - last string in brackets, black - and copy with cmd - c. then uncheck the Multiline option and paste the command in the input panel every time you need. If you need the function very often try to remember the name and type it in the input panel.

second pos.

Save your work in Turbocad. the open the script like before. In the last line of code the name of the spript as it is shown in the drop down box appers in red. give  it a new name: for example from  "functionabc" to "functionabc 2". Then restart turbocad.
After restart you ss the two commands in the drop down box and you can toggle between them - two commands for the same script.

When You need to repeat different scripts sometime, You can also  write a generic no operation sript  means a script which appears in the Drop Down list and does nothing with your drawing or nothing at all, only as a dummy - in your case script B.

# TC20_NoOperation.rb
# Ruby script as no operation dummy for the UI dropdown box

def nop

puts "nop"
 
end

UI.menu("Plugins").add_item("NOP") {nop}