Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Runaway Ruby

For general discussion related FlowStone

Runaway Ruby

Postby JB_AU » Fri Nov 14, 2014 5:22 am

I for some reason don't understand hot to use a trigger or boolean as input in ruby only when the trigger is fired or the boolean value changes & without them loading/firing when the schematic loads.

Code: Select all
require 'Win32API'
def system(cmd)
  sys = Win32API.new("crtdll", "system", ["P"], "L")
  sys.Call(cmd)
end

def system2(command)
  Win32API.new("crtdll","system",['P'],'L').Call(command)
end

#system("dir > c:\somefile.txt")
#system ('copy <c:\somefile.txt> <Brother DCP-165C Printer>')


A gentle kick pls
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Runaway Ruby

Postby tulamide » Fri Nov 14, 2014 5:52 am

That's what the event method is for.
Code: Select all
def event theInput, theValue
    #do react to theInput representing the bool or trigger
    #for example, if one input is named "mybool"
    if theInput == "mybool"
        #code in here when bool changed
    end
end

event will only be executed if triggered from outside, i.e. the value changes.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Runaway Ruby

Postby JB_AU » Fri Nov 14, 2014 6:19 am

That make a lot of sense , thanks
"Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe."

Albert Einstein
User avatar
JB_AU
 
Posts: 171
Joined: Tue May 21, 2013 11:01 pm


Return to General

Who is online

Users browsing this forum: No registered users and 67 guests