Prev  Next

Scripting

  • Tour 1
    - Drag Drop


  • Tour 2
    - Control Logic


  • Tour 3
    - Custom UI


  • Tour 4
    - Reporting


  • Tour 5
    - Hardware


  • Tour 6
    - Scripting


  • Tour 7
    - Motion Paths


  • Sample

    The following defines a generic script in a sequence...
    
    EventSrc = Print "Task"
    EventLog = ::IPWindowCollection#1.EventsView
    
    //[EventLogStep] Eventlog = EventLog, \
     //   Severity = 0,  Source = EventSrc,  Description = Command
    
    
    
    if(Command == "IOon")
    {
    
        print "Turn On " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalSetStep] IO = IO, State = 1
        }
    
    }
    
    if(Command == "IOoff")
    {
    
        print "Turn Off " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalSetStep] IO = IO, State = 0
        }
    
    }
    
    
    if(Command == "IOWaitOff")
    {
    
        print Command + " " SubCommand
        IOs  = ::DigitalIOCollection
        IO = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::Item
        IOValid = [GCCollectionItem] Collection = IOs, IndexOrName = SubCommand::ItemIndex
    
    
        if(IOValid > 0)
        {
                 [DigitalWaitStep] IO = IO, WaitFor = 0, TimeOut = 60000
        }
    
    }
    
    
    if(Command == "Run")
    {
    
        print "Run " SubCommand
        Prgs  = ::Programs
        Prg = [GCCollectionItem] Collection = Prgs, IndexOrName = SubCommand::Item
        PrgValid = [GCCollectionItem] Collection = Prgs, IndexOrName = SubCommand::ItemIndex
    
    
        if(PrgValid > 0)
        {
    
            [GCExeStep] Step = Prg
        }
    
    }