Open cd drive as trigger

Discuss RoboTask here
Post Reply
Dimsok
Posts: 6
Joined: Tue Aug 26, 2014 6:14 am

Open cd drive as trigger

Post by Dimsok »

I want to start program after inserting cd or dvd in drive. Did try file monitor as trigger or variables like {VolumeLabel(j:)} to start total commander with /S /O /L /T J:/. The same with E: for the first cd drive. Total commander open disc in new tab after inserting. But when i put out disc from drive trigger works again and tries to open empty drive. Is it possible to do some condition which will make action only after inserting disc in dvd drive, but not after putting it out?
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Open cd drive as trigger

Post by Oleg »

RoboTask contains such trigger.
Look at the On Device Changed trigger
It is in "System Events" group
This trigger fired when you insert CD/DVD into optical drive or insert external storage into USB port (flash-drive or external HDD)
Oleg Yershov
SIS
Posts: 1
Joined: Thu May 05, 2016 4:41 pm

Re: Open cd drive as trigger

Post by SIS »

what's the trigger when i connect a USB Drive?
i want that when i connect a certain USB drive it should run a task to copy a folder.

Thanks
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Open cd drive as trigger

Post by Oleg »

what's the trigger when i connect a USB Drive?
Trigger the same: On Device Changed

You can check disk label. For example your backup drive should have the label MYBACKUP

Look at the example below

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1657389313
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task219"
Hide=INTEGER|0
ID=INTEGER|561213642
LogOnAsUser=INTEGER|1
Name=STRING|"Check USB drive"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

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

[Actions\Action1\Params]
icon=STRING|"1"
msg0=STRING|"{dsk}"
msg1=STRING|"{VolumeLabel({dsk}:\)}"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action2\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{VolumeLabel({dsk}:\)}"
value2=STRING|"mybackup"

[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Disk {dsk}: inserved"""
Params=FOLDER

[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"Disk {dsk}: inserved"
msg1=STRING|"It is my backup drive."
msg2=STRING|"You can put here synchronization of your working folders"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Disk {dsk}: inserved"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"0"
msg0=STRING|"Disk {dsk}: inserved"
msg1=STRING|"It is NOT my backup drive."
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Events]
Event1=FOLDER

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

[Events\Event1\Params]
assign=STRING|"0"
changekind=STRING|"1"
devicekind=STRING|"1"
parameter=STRING|"dsk"
useparameter=STRING|"1"

Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Do not forget to enable the task after importing.
Oleg Yershov
Post Reply