Selection in Windows Explorer

Discuss RoboTask here
Post Reply
ralphberner
Posts: 1
Joined: Mon Feb 03, 2014 6:15 pm

Selection in Windows Explorer

Post by ralphberner »

Is there a possibility to analyze automatically what is selected in the frontmost windows explorer-window and let RoboTask decide what to do accordig to that?
I want to do one task if exactly one File is selected and do a different task if more than one file is selected or even do a third task if subfolders are selected.... ;)
I work with a similar tool for years which is lacking of exactly this function. Im looking for a alternative. :geek:
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Selection in Windows Explorer

Post by Oleg »

See the task below. This example shows how to analyze how many files are selected and whether sub-folders are selected
You can copy files into clipboard and get the list as text: one file fer line

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1199514847
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task112"
Hide=INTEGER|0
ID=INTEGER|1148249851
LogOnAsUser=INTEGER|1
Name=STRING|"Check files"
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
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_CLIPBOARD_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy"
Params=FOLDER

[Actions\Action1\Params]
mode=STRING|"1"

[Actions\Action10]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER

[Actions\Action10\Params]
destvar=STRING|"STR"
line0=STRING|"{List}"
linecount=STRING|"1"
sourcetext=STRING|"1"

[Actions\Action11]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""{str}"""
Params=FOLDER

[Actions\Action11\Params]
icon=STRING|"1"
msg0=STRING|"{str}"
msg1=STRING|"folder {FolderExists({str})}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action12]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action12\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FolderExists({str})}"

[Actions\Action13]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FOLDERSELECTED"" with value ""true"""
Params=FOLDER

[Actions\Action13\Params]
expand=STRING|"0"
varname=STRING|"FOLDERSELECTED"
varvalue=STRING|"true"

[Actions\Action14]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

[Actions\Action15]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action16]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action17]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action17\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{folderselected}"

[Actions\Action18]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Selected {cnt} items"""
Params=FOLDER

[Actions\Action18\Params]
icon=STRING|"0"
msg0=STRING|"Selected {cnt} items"
msg2=STRING|"Folders are selected!!!"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action19]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"

[Actions\Action2]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""LIST"" with value """""
Params=FOLDER

[Actions\Action2\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"LIST"

[Actions\Action20]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Selected {cnt} items"""
Params=FOLDER

[Actions\Action20\Params]
icon=STRING|"1"
msg0=STRING|"Selected {cnt} items"
msg1=STRING|"Folders are not selected"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action21]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action3]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""STP"" with value """""
Params=FOLDER

[Actions\Action3\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"STP"

[Actions\Action4]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""CNT"" with value """""
Params=FOLDER

[Actions\Action4\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"CNT"

[Actions\Action5]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""FOLDERSELECTED"" with value ""false"""
Params=FOLDER

[Actions\Action5\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"FOLDERSELECTED"
varvalue=STRING|"false"

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

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

[Actions\Action7]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""{list}"""
Params=FOLDER

[Actions\Action7\Params]
icon=STRING|"1"
msg0=STRING|"{list}"
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|"{list}"
spaces=STRING|"1"
tabs=STRING|"1"
trailing=STRING|"1"
variable=STRING|"list"

[Actions\Action9]
ActionID=STRING|"A_TXT_NUMBEROFLINES"
Enabled=INTEGER|-1
Name=STRING|"TXT Number of Lines"
Params=FOLDER

[Actions\Action9\Params]
external=STRING|"0"
line00000000=STRING|"{list}"
linecount=STRING|"1"
variable=STRING|"cnt"

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_GENERAL_HOTKEY"
Params=FOLDER
UnigueID=INTEGER|16445185

[Events\Event1\Params]
hotkey=STRING|"24646"


Save the task into a file and use Task->Import in order to import into RoboTask.
Do not forget to enable this task after importing, because imported tasks are disabled by default.

Now you can select some files in windows explorer and press Ctrl-Shift-F and task will calculate amount of selected files and check folders within the list.
Oleg Yershov
Post Reply