
Count length of predefined array
Count length of predefined array
How to count length of predefined array? My aim is to have just ONE VARIABLE (array) from which EVERYTHING ELSE (like numbers of loop etc.) would be (re-)counted...cos I want re-using my script where all I have to do would be just change the array's elements ;-)So I created my local variable as array like:FILES_ADD = css, js, php, xmlNow I want - later as IF THEN and LOOPS will go - "dynamicaly" (meaning "at runtime") count the length of my array (yea, I know I KNOW its length as I was assigning it myself "by hand" and I could easily write it down but I want to minimize actual need for perpetual "by hand" rewriting the value everywhere it occures in the "script") - HOW TO, PLEASE?Well, I could simply make another local variable like:FILES_ADD_LENGTH with value of 4 (actual length of my array) but just for maximal universality and the most possible atuomation of the process can it be done as I want to (count the length of the actual predefined array)?I was looking into RoboTask variables but I could not find any kinf of loop for VARIABLE ARRAY COUNTING...there is loop for WINDOW, for DATA (FROM FILE!), for anything else but nothing like this... :-(P.S.: sorry for my lame english...hope you understand what I mean 

Count length of predefined array
You can process array in the loop, like this:
set num to 0
while {Files_ADD({num})} is not empty
...
Do something with {Files_ADD({num})}
...
increment num by 1
end loop
The loop will terminates when you found an empty array element.
But you are right, maybe it's necessary to add some variable or action for calculating of array length.
I wrote this into out ToDo list.
set num to 0
while {Files_ADD({num})} is not empty
...
Do something with {Files_ADD({num})}
...
increment num by 1
end loop
The loop will terminates when you found an empty array element.
But you are right, maybe it's necessary to add some variable or action for calculating of array length.
I wrote this into out ToDo list.
Count length of predefined array
OK, thanx a lot...actualy I am trying to do something like that but still unable pass it right...still trying
Count length of predefined array
OK, I made it...I made script that paste predefined file(s) to actualy selected (focused) Explorer window with included check if the selected window is really Explorer window (CabinetWClass) + at the start input textfield will popup where you define actual extension you want to paste (from predefined options you set before in array variable - sure, you need to have them ready in source folder), here it is (text strings are in slovak language):;*****************************;* RoboTask Task file;* Do not edit in text editor!;***************************** [Root]ActionAfterRun=INTEGER|0Actions=FOLDERAutomat=INTEGER|-1CatID=INTEGER|1556733908ContinueOnError=INTEGER|0Events=FOLDERExternalName=STRING|"Task1"Hide=INTEGER|0ID=INTEGER|1117640011LocalVariables=STRING|"""FILES_PATH = G:\_SERVER_\pub\www\! SUBORY"",""FILES_ADD = css, js, php, swf, xml"",""I = 0"",""STAV = off"""LogOnAsUser=INTEGER|1Name=STRING|"PASTE PREDEFINED FILES"OnErrorTaskID=INTEGER|0Priority=INTEGER|3RunOnClose=INTEGER|0RunOnStartup=INTEGER|0ToLog=INTEGER|3WriteGeneralLog=INTEGER|0[Actions]Action1=FOLDERAction10=FOLDERAction11=FOLDERAction12=FOLDERAction13=FOLDERAction14=FOLDERAction15=FOLDERAction16=FOLDERAction17=FOLDERAction18=FOLDERAction2=FOLDERAction3=FOLDERAction4=FOLDERAction5=FOLDERAction6=FOLDERAction7=FOLDERAction8=FOLDERAction9=FOLDER[Actions\Action1]ActionID=STRING|"A_VARIABLES_CREATE"Enabled=INTEGER|-1Name=STRING|"Create variable ""ACTIVEWINDOW"" with value ""{CurrentWindowClass}"""Params=FOLDER[Actions\Action1\Params]expand=STRING|"1"varname=STRING|"ACTIVEWINDOW"varvalue=STRING|"{CurrentWindowClass}"[Actions\Action10]ActionID=STRING|"A_FLOW_ENDIF"Enabled=INTEGER|-1Name=STRING|"End If"[Actions\Action11]ActionID=STRING|"A_VARIABLES_INCREMENT"Enabled=INTEGER|-1Name=STRING|"Increment variable ""I"""Params=FOLDER[Actions\Action11\Params]incement=STRING|"1"vaiable=STRING|"I"[Actions\Action12]ActionID=STRING|"A_LOOP_END"Enabled=INTEGER|-1Name=STRING|"End Loop"[Actions\Action13]ActionID=STRING|"A_FLOW_IF"Enabled=INTEGER|-1Name=STRING|"If Then"Params=FOLDER[Actions\Action13\Params]case=STRING|"0"operator=STRING|"1"type=STRING|"0"value1=STRING|"{STAV}"value2=STRING|"ok"[Actions\Action14]ActionID=STRING|"A_DIALOG_MESSAGE"Enabled=INTEGER|-1Name=STRING|"Show ""CHYBA: po¾adovaný typ súborov (.{FILES_TYP}) nemám v zozname!"""Params=FOLDER[Actions\Action14\Params]icon=STRING|"3"msg0=STRING|"CHYBA: po¾adovaný typ súborov (.{FILES_TYP}) nemám v zozname!"msgcount=STRING|"1"playsound=STRING|"0"showmessage=STRING|"1"[Actions\Action15]ActionID=STRING|"A_FLOW_ENDIF"Enabled=INTEGER|-1Name=STRING|"End If"[Actions\Action16]ActionID=STRING|"A_FLOW_ELSE"Enabled=INTEGER|-1Name=STRING|"Else"[Actions\Action17]ActionID=STRING|"A_DIALOG_MESSAGE"Enabled=INTEGER|-1Name=STRING|"Show ""CHYBA: na tomto mieste nie je mo¾né vytvára» súbory a prieèinky!"""Params=FOLDER[Actions\Action17\Params]icon=STRING|"3"msg0=STRING|"CHYBA: na tomto mieste nie je mo¾né vytvára» súbory a prieèinky!"msgcount=STRING|"1"playsound=STRING|"0"showmessage=STRING|"1"[Actions\Action18]ActionID=STRING|"A_FLOW_ENDIF"Enabled=INTEGER|-1Name=STRING|"End If"[Actions\Action2]ActionID=STRING|"A_FLOW_IF"Enabled=INTEGER|-1Name=STRING|"If Then"Params=FOLDER[Actions\Action2\Params]case=STRING|"1"operator=STRING|"0"type=STRING|"0"value1=STRING|"{ACTIVEWINDOW}"value2=STRING|"CabinetWClass"[Actions\Action3]ActionID=STRING|"A_VARIABLES_CREATE"Enabled=INTEGER|-1Name=STRING|"Create variable ""AW_PATH"" with value ""{CurrentWindowCaption}"""Params=FOLDER[Actions\Action3\Params]expand=STRING|"1"varname=STRING|"AW_PATH"varvalue=STRING|"{CurrentWindowCaption}"[Actions\Action4]ActionID=STRING|"A_DIALOG_INPUTBOX"Enabled=INTEGER|-1Name=STRING|"Input Box"Params=FOLDER[Actions\Action4\Params]default=STRING|"CHYBA!"password=STRING|"0"prompt=STRING|"Aký má by» typ súborov (xml, css...)?"variable=STRING|"FILES_TYP"[Actions\Action5]ActionID=STRING|"A_LOOP_WHILE"Enabled=INTEGER|-1Name=STRING|"While loop"Params=FOLDER[Actions\Action5\Params]case=STRING|"0"operator=STRING|"8"type=STRING|"0"value1=STRING|"{FILES_ADD({I})}"value2=STRING|"{FILES_ADD}"[Actions\Action6]ActionID=STRING|"A_FLOW_IF"Enabled=INTEGER|-1Name=STRING|"If Then"Params=FOLDER[Actions\Action6\Params]case=STRING|"0"operator=STRING|"0"type=STRING|"0"value1=STRING|"{FILES_TYP}"value2=STRING|"{FILES_ADD({I})}"[Actions\Action7]ActionID=STRING|"A_FILE_COPY"Enabled=INTEGER|-1Name=STRING|"Copy/Move File"Params=FOLDER[Actions\Action7\Params]destdir=STRING|"{AW_PATH}"f_count=STRING|"1"file0=STRING|"{FILES_PATH}\{FILES_TYP}\*.*"ifexists=STRING|"0"move=STRING|"0"subdir=STRING|"0"[Actions\Action8]ActionID=STRING|"A_VARIABLES_SET"Enabled=INTEGER|-1Name=STRING|"Set variable ""STAV"" with value ""ok"""Params=FOLDER[Actions\Action8\Params]expand=STRING|"0"varname=STRING|"STAV"varvalue=STRING|"ok"[Actions\Action9]ActionID=STRING|"A_LOOP_BREAK"Enabled=INTEGER|-1Name=STRING|"Break"[Events]Event1=FOLDER[Events\Event1]Enabled=INTEGER|-1EventID=STRING|"E_GENERAL_HOTKEY"Params=FOLDER[Events\Event1\Params]hotkey=STRING|"16576"
Count length of predefined array
+ one question: how to copy file(s) + FOLDER(S)??? For some reason it copies ONLY FILES, but not folders...why???
Count length of predefined array
+ Oleg: if you will could you please change the topic of this to "PASTE PREDEFINED FILES" ...let everyone who wants it could it find (meaning me script)...? 

Count length of predefined array
+ to define what for is this code: see, I am webdesigner and many times when I am doing a site I need to copy some bunch of the same "starting-like" filesthat are filled with data later, so this script makes just that: copy to selected place (window) selected bunch of predefined (strating-like) files of defined extension
+ later I am planning to re-define one of the IF THEN statements to check if the selected window is not just some Explorer window (CabinetWClass) BUT ANY WINDOW WITH "WRITE" ABILITY (to be able paste my files anywhere where it can be pasted)...right now I do not know how but I will see later what I can do about the problem, hehe 


Last edited by qoqodqo on Sun Feb 07, 2010 10:23 am, edited 1 time in total.
Count length of predefined array
Use Synchronize folders action.one question: how to copy file(s) + FOLDER(S)??? For some reason it copies ONLY FILES, but not folders...why???
If you set unidirectional synchronization it is similar to copying the folder.
Count length of predefined array
so if I understand it right: you want me to change COPY/MOVE action for SYNCHRONIZE FOLDERS oneOK, I got it now - it works...thanx for ya help! 

Last edited by qoqodqo on Mon Feb 08, 2010 8:06 am, edited 1 time in total.
Count length of predefined array
I mean: if you want to copy folder, then use "synchronize folders" action. Nothing moreyou want me to change COPY/MOVE action for SYNCHRONIZE FOLDERS one