run and renew a crystal report

Discuss RoboTask here
Post Reply
jeroen123
Posts: 25
Joined: Wed Feb 15, 2012 5:35 pm

run and renew a crystal report

Post by jeroen123 »

hello Oleg,
I have made a simple task to run , renew and export a chystal report but it seems not so stable: it not always, 1 out of 2 time, renew or export the data well.. can you advise me hoe to make it more stable? thanks!
 

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task18"
Hide=INTEGER|0
ID=INTEGER|458453503
LogOnAsUser=INTEGER|1
Name=STRING|"AT omzetlijsten vernieuwen en versturen"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
 
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action22=FOLDER
Action23=FOLDER
Action24=FOLDER
Action25=FOLDER
Action26=FOLDER
Action27=FOLDER
Action28=FOLDER
Action29=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
 
[Actions\Action1]
ActionID=STRING|"A_GENERAL_RUN_PROG"
Enabled=INTEGER|-1
Name=STRING|"Run ""omzetlijstat.rpt """
Params=FOLDER
 
[Actions\Action1\Params]
ifnonzero=STRING|"0"
program=STRING|"C:\ROBOTASK\omzetlijstat.rpt"
runas=STRING|"0"
wait=STRING|"1"
workdir=STRING|"C:\ROBOTASK"
 
[Actions\Action10]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action10\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"%(T)"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action11]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER
 
[Actions\Action11\Params]
delay=STRING|"5"
 
[Actions\Action12]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action12\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"E"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action13]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER
 
[Actions\Action13\Params]
delay=STRING|"5"
 
[Actions\Action14]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action14\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"R"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action15]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER
 
[Actions\Action15\Params]
delay=STRING|"5"
 
[Actions\Action16]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action16\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action17]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER
 
[Actions\Action17\Params]
delay=STRING|"5"
 
[Actions\Action18]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action18\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action19]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER
 
[Actions\Action19\Params]
delay=STRING|"5"
 
[Actions\Action2]
ActionID=STRING|"A_FILE_WAIT"
Enabled=INTEGER|0
Name=STRING|"Waiting omzetlijstat.rpt file for 3 sec"
Params=FOLDER
 
[Actions\Action2\Params]
filename=STRING|"X:\lijsten\CRYSTAL REPORTS\omzetlijstat.rpt"
timeout=STRING|"3"
 
[Actions\Action20]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action20\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"""{DELAY 1000}"",C:\ROBOTASK\omzetlijstAT.pdf,""{DELAY 5000}"",{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action21]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action21\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"""{DELAY 5000}"",{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action22]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER
 
[Actions\Action22\Params]
delay=STRING|"10"
 
[Actions\Action23]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action23\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"%(T)"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action24]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER
 
[Actions\Action24\Params]
delay=STRING|"10"
 
[Actions\Action25]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action25\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"A"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action26]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER
 
[Actions\Action26\Params]
delay=STRING|"10"
 
[Actions\Action27]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action27\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action28]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 5000 ms"
Params=FOLDER
 
[Actions\Action28\Params]
delay=STRING|"50"
 
[Actions\Action29]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email"
Params=FOLDER
 
[Actions\Action29\Params]
attach0=STRING|"C:\ROBOTASK\omzetlijstat.pdf"
attachcount=STRING|"1"
auth=STRING|"1"
charset=STRING|"iso-8859-1"
from=STRING|"jeanette.d@XXXX"
host=STRING|"dc-container"
html=STRING|"0"
msg0=STRING|"Beste Andre,"
msg1=STRING|"hierbij de lijst van vandaag verstuurde orders,"
msg3=STRING|"Groeten,"
msg4=STRING|"Jeanette"
msgcount=STRING|"5"
password=STRING|"4282XXXXXX"
port=STRING|"25"
SSL=STRING|"0"
subject=STRING|"Lijst verstuurde Orders {Date}"
to=STRING|"jeroen.s@XXXX.nl"
user=STRING|"jerXXX"
 
[Actions\Action3]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 5000 ms"
Params=FOLDER
 
[Actions\Action3\Params]
delay=STRING|"50"
 
[Actions\Action4]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action4\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"{F5}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Crystal Reports - [prijslijst met voorraadgegevens.rpt]"
 
[Actions\Action5]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER
 
[Actions\Action5\Params]
delay=STRING|"10"
 
[Actions\Action6]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action6\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action7]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER
 
[Actions\Action7\Params]
delay=STRING|"10"
 
[Actions\Action8]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Send keys to active window"
Params=FOLDER
 
[Actions\Action8\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"ODBC,""{DELAY 1000}"",{ENTER}"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"
 
[Actions\Action9]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 3000 ms"
Params=FOLDER
 
[Actions\Action9\Params]
delay=STRING|"30"
 
[Events]
Event1=FOLDER
 
[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_SHEDULER"
Params=FOLDER
UnigueID=INTEGER|1787706508
 
[Events\Event1\Params]
id=STRING|"4H19G4B6"
periodicity=STRING|"1"
periodparameter=STRING|"0111110"
startdate=STRING|"40956"
time0=STRING|"61320000"
timecount=STRING|"1"
 
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

run and renew a crystal report

Post by Oleg »

I think that you may try to insert "Window command" (with "Focus" parameter) before each "Send Keys" action.
It seems that your window loose its focus while the task is executing.

Also pay attention that you have to avoid pressing the keys and mouse clicks during execution of the task.
Post Reply