Page 1 of 1

Working with variables

Posted: Thu May 10, 2007 6:21 am
by hendrix666
Hi everyone!!
Is it possible to pass some variable from other application to RoboTask via Visual Basic(e.g. a MS Access form), instead of using the clipboard or an array text file?
I have to pass some variables from an active form in Access to put them on another application.
Thx a lot!
 
 

Working with variables

Posted: Thu May 10, 2007 6:44 am
by Oleg
Yes of course.

see sample code below
    
    Dim o As Object
    
    Set o = CreateObject("RoboTask.app")
    o.SetUserVariable "ExcelValue", "12345"
    
    Set o = Nothing

For more infomation about COM object of RoboTask see help file, topic "Actions -> Basic -> RoboTaskApp object"

Working with variables

Posted: Thu May 17, 2007 4:23 am
by hendrix666
Thx, it's working perfectly this way. I have one more doubt, is there a way to wait for a task finished in a visual basic script? I need to have the task finished in order to retrieve the variables to an Acces form. Thanks again!!

Working with variables

Posted: Sat May 19, 2007 11:29 pm
by Oleg
Hmm...
RoboTask haven't function for detection the state of task from within basic script directly. Maybe we have to add this.
Now you can do the following:
add into the task some flag-variable. In the beginning of the task set it to value 1 (for example) and before ending set to 0

In the basic script you can do this

   Dim o As Object

   Set o = CreateObject("RoboTask.app")
   o.SetUserVariable "ExcelValue", "12345"

   o.StartTask "MyTask"

   While o.ExpandText("{FlagVar}") = "1"
      Wait 0.5
   Wend

   'Do something
   '....

   Set o = Nothing

Re: Working with variables

Posted: Wed Jul 16, 2014 2:40 pm
by Naras
Is it possible to pass a variable from a php script to Robotask?
I have a script that processes email based on the type. Depending on the type will determine which email is sent.

Re: Working with variables

Posted: Wed Jul 16, 2014 4:53 pm
by Oleg
See my example for PHP script:

Code: Select all

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task846"
Hide=INTEGER|0
ID=INTEGER|468118999
LogOnAsUser=INTEGER|1
Name=STRING|"Variable from PHP"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create global variable ""MYVAR"" with value ""nothing"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"0"
varname=STRING|"MYVAR"
varvalue=STRING|"nothing"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Before script MyVar is"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"Before script MyVar is"
msg2=STRING|"{MyVar}"
msg4=STRING|"Press OK to start PHP script"
msgcount=STRING|"5"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action3]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""php.exe D:\Temp\testscript.php"""
Params=FOLDER

[Actions\Action3\Params]
ifnonzero=STRING|"0"
params=STRING|"D:\Temp\testscript.php"
program=STRING|"C:\Program Files (x86)\PHP\v5.3\php.exe"
runas=STRING|"0"
wait=STRING|"2"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""After script MyVar is"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"After script MyVar is"
msg2=STRING|"{MyVar}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
I use script testscript.php

Code: Select all

<?php
$RT = new COM("RoboTask.App");
//echo $RT->Version;
$RT->SetUserVariable("MyVar", "Hello World!!!");
?>