Conditional Cut and Paste

Discuss RoboTask here
zherman
Posts: 8
Joined: Mon Jun 18, 2012 2:50 am
Location: Indonesia

Conditional Cut and Paste

Post by zherman »

Dear All,   I would like to know if there's a way to do conditional cut and past? and Lets say I wantdata from a spreadsheet to be inputed into  a specific form on a website. Because the amount of rows are erratic,  I would like to process the data up until the end of the excel spreadsheet. Eg. If Cell Copy = <Empty> then end copy and paste processing cycle. Etc.Kind Regards,Deddy
gavind
Posts: 3
Joined: Wed Jun 06, 2012 9:08 pm

Conditional Cut and Paste

Post by gavind »

I don't think this is available yet.

This feature looks like a customize one and not everybody
would be able to use this. I do hope the developers would
consider this tho.
Last edited by gavind on Fri Jun 29, 2012 8:18 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3016
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Conditional Cut and Paste

Post by Oleg »

You always can put clipboard content into variable as text and compare it with empty string.
Algorithm will be similar to this:

Copy // copy to clipboard
Get Text //From clipboard to variable MyVar (for example)
If {MyVar} is not empty then
   Paste //paste from clipboard
EndIf

See Clipboard actions and "If..Then" action
zherman
Posts: 8
Joined: Mon Jun 18, 2012 2:50 am
Location: Indonesia

Conditional Cut and Paste

Post by zherman »

Dear All,    (I've got a registered copy of robotask)Thanks for the reply. However, I am now facing a dead end. I manage to somehow do what was suggested. Copying the Excel cell to a variable that I've declared on the local variable.I use while loop to reiterate through the process.  Here's what I did :Goto the first Designated Cell DataCopy Cell Data to variable While Variable is not empty     Go through the cells    Move down the rows.    CopyCell Data to Variableend loop.Unfortunately, the loop doesn't stop. At first I didn't know why. However, when I checked the log,I realised what had happened. Apparently when clipboard data iscopied into the variable it also copies the LF and CR char :Thats why it doesn't match IS NOT EMPTY conditions :In order to circumvent that, I've download the BASIC module and triedto trim the variable.  It doesn't work.E: 02/07/2012 16:27:47: Error in expression "TRIM$(G11A<CR><LF>)"another method I did was to use put an end code (Eg G11A)  at the end of the last row and grab the raw data using Left$(Variable, 4). This also doesn't work, Error :E: 02/07/2012 16:32:07: Error in expression "LEFT$(G11A<CR><LF>,4)"to eveluate when that code is copied. by using the trimAny Help would be appreacitaed. Thanks,Deddy


Last edited by zherman on Mon Jul 02, 2012 1:06 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3016
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Conditional Cut and Paste

Post by Oleg »

I should see your task in order to find incorrectness.
Send your task to me to oleg(at)robotask.com please.
Oleg
Site Admin
Posts: 3016
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Conditional Cut and Paste

Post by Oleg »

Pay attention, you should write evaluate expression with quotes:
trim$("{MyVar}")
Otherwise basic generates an error.

Also try to use "STR Trim" action. It can suppress leading and trailing symbols (spaces, EOL symbols, etc)
zherman
Posts: 8
Joined: Mon Jun 18, 2012 2:50 am
Location: Indonesia

Conditional Cut and Paste

Post by zherman »

Dear Oleg, Here's the task below. Basically I would like to grab data from excel import it intolocal variables and once those data has been inputed into Robotask local variables. I shall continue to create tasks toinput data to a webform.[Root]item0000=STRINGLISTitem0001=STRINGLISTitem0002=STRINGLISTitem0003=STRINGLISTitem0004=STRINGLISTitem0005=STRINGLISTitem0006=STRINGLISTitem0007=STRINGLISTitem0008=STRINGLIST[\item0000]s1=[General]s2=ActionId=A_GENERAL_RUN_PROGs3=Name=Run "EXCEL.EXE "s4=Enabled=-1s5=[Params]s6=ifnonzero=0s7=program=C:\Program Files\Microsoft Office\Office12\EXCEL.EXEs8=runas=0s9=wait=1[\item0001]s1=[General]s2=ActionId=A_GENERAL_PAUSEs3=Name=Delay 1000 mss4=Enabled=-1s5=[Params]s6=delay=10[\item0002]s1=[General]s2=ActionId=A_GENERAL_SENDKEYSs3=Name=Open Current Signal Files4=Enabled=-1s5=[Params]s6=currentwindow=1s7=fixedwindow=1s8=keylayout=0 s9=keys=^(O)%(N)C:\TestDIR\Signal\SIG-{MonthName}-{Day}-{Yea r}.xlsx%(O)s10=pause=20s11=release=0s12=sendkind=0s13=wincaption=Notepad[\item0003]s1=[General]s2=ActionId=A_GENERAL_SENDKEYSs3=Name=Goto first Data Cursors4=Enabled=-1s5=[Params]s6=currentwindow=1s7=fixedwindow=1s8=keylayout=0s9=keys="^(G)%(R)B10{DELAY 2000}{ENTER}"s10=pause=20s11=release=0s12=sendkind=0s13=wincaption=Notepad[\item0004]s1=[General]s2=ActionId=A_GENERAL_SENDKEYSs3=Name=Copy Cells4=Enabled=-1s5=[Params]s6=currentwindow=1s7=fixedwindow=1s8=keylayout=0s9=keys=^(C)s10=pause=20s11=release=0s12=sendkind=0s13=wincaption=Notepad[\item0005]s1=[General]s2=ActionId=A_CLIPBOARD_GETs3=Name=Get Texts4=Enabled=-1s5=[Params]s6=variable=CURRSTOCKCODE[\item0006]s1=[General]s2=ActionId=A_DIALOG_MESSAGEs3=Name=Show "{CURRSTOCKCODE}"s4=Enabled=-1s5=[Params]s6=icon=1s7=msg0={CURRSTOCKCODE}s8=msgcount=1s9=playsound=0s10=showmessage=1[\item0007]s1=[General]s2=ActionId=BASIC_EVALUATEs3=Name=Evaluates4=Enabled=-1s5=[Params]s6=expression=ctsr("{CURRSTOCKCODE}")s7=variable=STRCURRSTOCKCODE[\item0008]s1=[General]s2=ActionId=A_DIALOG_MESSAGEs3=Name=Show "{STRCURRSTOCKCODE}"s4=Enabled=-1s5=[Params]s6=icon=1s7=msg0={STRCURRSTOCKCODE}s8=msg2=Hey, awake!s9=msgcount=3s10=playsound=0s11=showmessage=1
Oleg
Site Admin
Posts: 3016
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Conditional Cut and Paste

Post by Oleg »

Where such code?:
zherman wrote:Goto the first Designated Cell Data
Copy Cell Data to variable
While Variable is not empty
    Go through the cells
    Move down the rows.
    CopyCell Data to Variable
end loop.
I don't see the loop or some comparisons...

BTW: if you want to open Excel document you can run MS Excel with name of document file:
C:\Program Files\Microsoft Office\Office12\EXCEL.EXE "c:\My folder\My Document.xls"
or you also can "run" Excel document directly.
Oleg
Site Admin
Posts: 3016
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Conditional Cut and Paste

Post by Oleg »

See my corrections below.
RoboTask always gets variables from clipboard as string. You do not need transform it from number.
Pay attention that excel always give cell values with trailing end-of-line symbols. You need to suppress it.

Code: Select all

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1076699455
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1192"
Hide=INTEGER|0
ID=INTEGER|1095839541
LogOnAsUser=INTEGER|1
Name=STRING|"Excel corrections"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=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 ""EXCEL.EXE """
Params=FOLDER

[Actions\Action1\Params]
ifnonzero=STRING|"0"
program=STRING|"C:\Program Files\Microsoft Office\Office12\EXCEL.EXE"
runas=STRING|"0"
wait=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1000 ms"
Params=FOLDER

[Actions\Action2\Params]
delay=STRING|"10"

[Actions\Action3]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Open Current Signal File"
Params=FOLDER

[Actions\Action3\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
 keys=STRING|"^(O)%(N)C:\TestDIR\Signal\SIG-{MonthName}-{Day} -{Yea r}.xlsx%(O)"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"

[Actions\Action4]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Goto first Data Cursor"
Params=FOLDER

[Actions\Action4\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"""^(G)%(R)B10{DELAY 2000}{ENTER}"""
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"

[Actions\Action5]
ActionID=STRING|"A_GENERAL_SENDKEYS"
Enabled=INTEGER|-1
Name=STRING|"Copy Cell"
Params=FOLDER

[Actions\Action5\Params]
currentwindow=STRING|"1"
fixedwindow=STRING|"1"
keylayout=STRING|"0"
keys=STRING|"^(C)"
pause=STRING|"20"
release=STRING|"0"
sendkind=STRING|"0"
wincaption=STRING|"Notepad"

[Actions\Action6]
ActionID=STRING|"A_CLIPBOARD_GET"
Enabled=INTEGER|-1
Name=STRING|"Get Text"
Params=FOLDER

[Actions\Action6\Params]
variable=STRING|"CURRSTOCKCODE"

[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show """"{CURRSTOCKCODE}"""""
Params=FOLDER

[Actions\Action7\Params]
icon=STRING|"1"
msg0=STRING|"""{CURRSTOCKCODE}"""
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action8]
ActionID=STRING|"A_STR_TRIM"
Enabled=INTEGER|-1
Name=STRING|"STR Trim"
Params=FOLDER

[Actions\Action8\Params]
custom=STRING|"0"
eol=STRING|"1"
lead=STRING|"1"
source=STRING|"{currstockcode}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"strcurrstockcode"

[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{STRCURRSTOCKCODE}"""
Params=FOLDER

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"{STRCURRSTOCKCODE}"
msg2=STRING|"Hey, awake!"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
Last edited by Oleg on Tue Jul 03, 2012 10:05 am, edited 1 time in total.
zherman
Posts: 8
Joined: Mon Jun 18, 2012 2:50 am
Location: Indonesia

Conditional Cut and Paste

Post by zherman »

Thanks for the quick reply Oleg.Would it be possible to get Text action to set variable based on another variable?eg. I have 10 cells that need to to process and I want to put thedata into 10 seperate varaibles. Which I have declared withinlocal variable  (SP1 - SP10). Therefore what I'd do is :Go through each cell on EXCEL -- > Copy the cell thenuse the GET TEXT to copy the data to SP{ROWCOUNT}I guess the more elegant solution would be to use VBA - Basic Scripts to cycle through the data and to set each data to RoboTask variable. However RoboTask COM Objects only able to set user data and not local data?Thanks for the reply,Deddy


Last edited by zherman on Tue Jul 03, 2012 10:22 am, edited 1 time in total.
Post Reply