Skript call for Robotask

Discuss RoboTask here
jonjon
Posts: 17
Joined: Sun Nov 05, 2006 10:14 pm
Location: Sweden

Skript call for Robotask

Post by jonjon »

Hi
I try to make a basic script witch calls for an task called pinghost put it doesnt start the actuall task i cant understand how to make this work. im greatful for tips.
 
;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task6"
Hide=INTEGER|0
ID=INTEGER|644344636
Name=STRING|"test skript"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
[Actions]
Action1=FOLDER
[Actions\Action1]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Basic Script"
Params=FOLDER
[Actions\Action1\Params]
line00000=STRING|"Sub Main"
line00001=STRING|" Do"
line00003=STRING|"RoboTaskApp.StartTask(pinghostar)"
line00006=STRING|"    Loop Until piiing <> -1"
line00008=STRING|"End Sub"
linecount=STRING|"9"
source=STRING|"0"
 Is it okej to use uservariable like i do ?
 
BR
 
J
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Skript call for Robotask

Post by Oleg »

Unfortunately no. Local variables of the script and user variables of RoboTask is not the same.
See my variant of the script. You must extract the value from user variable of RoboTask by method ExpandText.
Also local variable pinghostar have an empty value by default. You must assign the string value or pass to StartTask the string constant.

Sub Main
   Dim timeout
   Do
      RoboTaskApp.StartTask( "pinghostar" )
      timeout = RoboTaskApp.ExpandText( "{piiing}" )
   Loop Until timeout <> -1
End Sub
jonjon
Posts: 17
Joined: Sun Nov 05, 2006 10:14 pm
Location: Sweden

Skript call for Robotask

Post by jonjon »

like this?
 
Sub Main
Dim timeout
Dim start

start = pinghostar
   Do
      RoboTaskApp.StartTask( "start" )
      timeout = RoboTaskApp.ExpandText( "{piiing}" )
   Loop Until timeout <> -1

End Sub
mikronos
Posts: 21
Joined: Sat Oct 21, 2006 9:09 am
Location: France

Skript call for Robotask

Post by mikronos »

Hi Jonjon and Olegunfortunately I'm unable to make this script work.It seem that RobotaskApp.StartTask not run inside a basic script,please where I'm wrong ?? ( I have try RobotaskApp.TaskEnabled as a variant version, but not work too )Here is my two scripts, run "test script"-Mikronos;**********************;* RoboTask Task file *;* Do not edit!       *;********************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|0CatID=INTEGER|1554630349ContinueOnError=INTEGER|0ExternalName=STRING|"Task6"Hide=INTEGER|0ID=INTEGER|644344636Name=STRING|"test script"Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3[Actions]Action1=FOLDER[Actions\Action1]ActionID=STRING|"BASIC_SCRIPT"Enabled=INTEGER|-1Name=STRING|"Basic Script"Params=FOLDER[Actions\Action1\Params]line00000=STRING|"Sub Main"line00002=STRING|"Dim  res"line00004=STRING|" Do"line00006=STRING|"    RoboTaskApp.StartTask(""pinghost"")"line00008=STRING|"     res= RoboTask.ExpandText (""{PING}"")"line00010=STRING|"  Loop Until res <> -1"line00012=STRING|"End Sub"linecount=STRING|"13"source=STRING|"0";**********************;* RoboTask Task file *;* Do not edit!       *;********************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|0CatID=INTEGER|1554630349ContinueOnError=INTEGER|0ExternalName=STRING|"Task1"Hide=INTEGER|0ID=INTEGER|680565355Name=STRING|"pinghost"Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3[Actions]Action1=FOLDERAction2=FOLDER[Actions\Action1]ActionID=STRING|"A_INET_PING"Enabled=INTEGER|-1Name=STRING|"Ping 127.0.0.1"Params=FOLDER[Actions\Action1\Params]default=STRING|"-1"host=STRING|"127.0.0.1"timeout=STRING|"5000"variable=STRING|"PING"[Actions\Action2]ActionID=STRING|"A_DIALOG_MESSAGE"Enabled=INTEGER|-1Name=STRING|"Show ""done ping = {PING}"""Params=FOLDER[Actions\Action2\Params]icon=STRING|"1"msg0=STRING|"done ping = {PING}"msgcount=STRING|"1"playsound=STRING|"0"showmessage=STRING|"1"
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Skript call for Robotask

Post by Oleg »

To mikronos:
Method StartTask runs the task by Internal Name. Your second task have internal name Task1. Change it, please, to pinghost.
Open task editor and go to "Advanced" tab, see parameter "External Name".
jonjon
Posts: 17
Joined: Sun Nov 05, 2006 10:14 pm
Location: Sweden

Skript call for Robotask

Post by jonjon »

jonjon wrote: like this?
 
Sub Main
Dim timeout
Dim start

start = pinghostar
   Do
      RoboTaskApp.StartTask( "start" )
      timeout = RoboTaskApp.ExpandText( "{piiing}" )
   Loop Until timeout <> -1

End Sub

 
sorry this dont work also why ?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Skript call for Robotask

Post by Oleg »

jonjon wrote: like this?
....

no, see below

Sub Main
Dim timeout
Dim start
'corrected first mistake
start = "pinghostar"

   Do
'corrected second mistake
      RoboTaskApp.StartTask( start )
      timeout = RoboTaskApp.ExpandText( "{piiing}" )
   Loop Until timeout <> -1

End Sub
mikronos
Posts: 21
Joined: Sat Oct 21, 2006 9:09 am
Location: France

Skript call for Robotask

Post by mikronos »

Shame on me!! haven't see that!! Thank's Oleg, but if you try my script you can see that there is an error on this line ( not when running from inside the basic interpreter but only from robot main form )res= RoboTask.ExpandText (""{PING}"")"the error is in french (!) and it is"Attente d'un tableau déjà dimensionnée ligne 9 col 28"-Mikronos
jonjon
Posts: 17
Joined: Sun Nov 05, 2006 10:14 pm
Location: Sweden

Skript call for Robotask

Post by jonjon »

it works now!! Thanks mate. I did same misstake as above wrong external name. I change it and now it works perfekt
 
cheeeers for fast and good support!!
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Skript call for Robotask

Post by Oleg »

mikronos wrote:res= RoboTask.ExpandText (""{PING}"")"
Why so many quotes?

correct line is:
res= RoboTask.ExpandText ("{PING}")
Last edited by Oleg on Thu Nov 09, 2006 6:13 am, edited 1 time in total.
Post Reply