Runaway Ruby

For general discussion related FlowStone
Post Reply
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Runaway Ruby

Post by JB_AU »

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
tulamide
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Runaway Ruby

Post by tulamide »

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)
User avatar
JB_AU
Posts: 171
Joined: Tue May 21, 2013 11:01 pm

Re: Runaway Ruby

Post by JB_AU »

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
Post Reply