Exemples

Navigation:  Les scripts > Les autres scripts >

Exemples

Previous pageReturn to chapter overviewNext page

Send a SMS Message if alarm 1 activated:

 

B:=false;

Fin:=false;

 

Repeat

If alarm(1) then

Begin

If not b then

Begin

   B:=true;

   shellexec('RASDial.exe','"Carte ISDN bluewin" username password',SW_SHOW,5000);

   M:=SMTPCreate;

   M.host('pop.bluewin.ch');

   M.UserID:='MyId';

   M.Fromaddress:='Test@vkvision.ch';

   M.FromName:='Operator';

   M.ToAddress:='079443555@sms.bluewin.ch';

   M.ToCarbonCopy:='';

   M.Bodytext:='Alarme postion 12. Température trop haute (74°C)';

   r:=M.sendMail;

   M.free;

   shellexec('RASDial.exe','/disconnect',SW_SHOW,5000);

End;

End Else B:=False;

Until Fin

 

 

 

Copy a register bit to a other register bit:

 

Fin:=false;

 

Repeat

 If Bit(10,30,6) then

 Begin

   If Not Bit(10,23,5) then Bit(10,23,5,true);

 End Else

 Begin

   If Bit(10,23,5) then Bit(10,23,5,false);

 End;

Until Fin

 

Play a wave file every 5 seconds if any alarm:

 

fin:=false;

b1:=false;

I:=0;

T:=timercreate(5000);

 

Repeat

If newalarm(0) then

Begin

 if (t.timerfinish)or(b1=false) then

 Begin

  PlayasyncWave('C:\Program Files\RVS\WCOM\SYSTEM\Anwbeep.wav');

  t.timerrestart;

  b1:=true;

 End;

End else b1:=false;

 

Until (fin);

 

 

 

Select intervals variable then Open window

 

Vari (0,30);

Vari (1,31);

Vari (2,32);

Opendialog('Agitation.win');

 

 

Call internet explorer

 

Shellexec(‘Open’,’http://www.vkvision.ch’);

 

Move hoist in a script

 

{ script permettant de charger la machine                }

{ Copyright (c) VK Vision SA                             }

 

 

step:=0;

fin :=bit(0,10,0);  { mode automatique }

p   :=0;

 

 

if not fin then

begin

if plci(10,100)<>1 then  { mode charge/décharge }

begin

 plci(10,100,0);

 fin:=true;

end else

begin

 //bit(5,501,1,true);

end;

end;

 

while (not fin) do

begin

if HoistReady(1) then

begin

 if step=0 then

 begin

  if jignumber(1)>0 then

  begin

   if Jigtime(1)>10 then

   begin

    p:=0;

    if jignumber(2)=0 then p:=2 else

    if jignumber(3)=0 then p:=3 else

    if jignumber(4)=0 then p:=4 else

    if jignumber(6)=0 then p:=6 else

    if jignumber(8)=0 then p:=8 else

    if jignumber(9)=0 then p:=9 else

    if jignumber(10)=0 then p:=10;

    if p>0 then

    begin

     if IsCoverOpen(p) then

     begin

      hoistTransfer(1,1,p);

      step:=10;

     end else

     begin

      Opencover(p);

      step:=5;

     end;

    end;

   end; { immersion < 10 }

  end; { pas de balancelle dans la position 2 }

 end else

 if step=5 then

 begin

  if IsCoverOpen(p) then

  begin

   HoistTransfer(1,1,p);

   step:=10

  end;

 end else

 if step=10 then

 begin

  if hoistPosition(1)=8 then

  begin

   HoistMove(1,7);

   CloseCover(8);

   Step:=20;

  end else

  if hoistPosition(1)=9 then

  begin

   HoistMove(1,7);

   CloseCover(9);

   Step:=20;

  end else

  if hoistPosition(1)=10 then

  begin

   HoistMove(1,7);

   Step:=20;

  end else step:=20;

 end else

 begin

  step:=0;

 end;

end;

fin:=(bit(0,10,0))or  { fin si mode automatique }

     (plci(10,100)<>1);

 

end;

 

if plci(10,100)<>0 then  { mode charge/décharge }

begin

plci(10,100,0);

end;