Dr. Dread Professional Member


Joined: 03 Aug 2001 Posts: 1065 Location: Copenhagen, Denmark
|
Posted: Tue Aug 13, 2002 1:40 pm Post subject: CD Autorunner |
|
|
Did you (like me ) disable the autorun feature for CD-ROM drives? This little util will let you autorun CDs
when YOU want it.
Two modes:
Full auto: Runs any autorun items found, no questions asked
List click: User has to click an item in the list of items found to launch it.
Greetz
Dr. Dread
| Code: |
TITLE CD Autorunner .. by Dr. Dread
DIALOG CREATE, "CD Autorunner",-1,0,350,150
OPTION SCALE,96
OPTION DECIMALSEP,"."
DIALOG ADD,STYLE,Normal,Arial,10,B,,BLACK
DIALOG ADD,STYLE,Red,Arial,10,,RED
DIALOG ADD,STYLE,Green,Arial,10,,LTGREEN
DIALOG ADD,TEXT,drives,5,10,,,Choose action ..,Normal
DIALOG ADD,RADIO,mode,2,268,72,50,Action,Full auto|List click,,CLICK
DIALOG SHOW
:EVLOOP
WAIT EVENT
goto @event()
:modeCLICK
if @equal(@dlgtext(mode),Full auto)
%%mode = full
else
%%mode = click
end
:go
%%driveletters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
%x = 0
list create,1
REPEAT
%x = @succ(%x)
%%letter = @substr(%%driveletters,%x,)
%%drive = @volinfo(%%letter,T)
if @equal(%%drive,"CD-ROM")
list add,1,%%letter:
%%cdrom = %%cdrom","%%letter
end
UNTIL @greater(%x,26)
if @equal(@substr(%%cdrom,1,),",")
%%cdrom = @strdel(%%cdrom,1,)
end
if @equal(@substr(%%cdrom,@len(%%cdrom),),",")
%%cdrom = @strdel(%%cdrom,@len(%%cdrom),)
end
dialog set,drives,CD-ROM drives detected: %%cdrom
gosub autorun
if @null(%%run)
DIALOG ADD,TEXT,record1,32,10,,,,Red
dialog set,record1,No Autorun items found!
else
DIALOG ADD,TEXT,record2,32,10,,,,Green
DIALOG ADD,LIST,lister,54,10,330,95,CLICK
list assign,lister,2
dialog set,record2,Autorun items found:
end
goto evloop
:listerCLICK
%%clicked = @item(lister)
directory change,@path(%%clicked)
RUN %%clicked
goto evloop
:CLOSE
EXIT
REM ################## SUBs #####################3
:autorun
list create,2
list seek,1,0
repeat
%%item = @next(1)
if @file(%%item\autorun.inf)
INIFILE OPEN,%%item\autorun.inf
%%run = @iniread(autorun,open)
if @equal(%%mode,full)
if @file(%%item\%%run)
directory change,%%item\
RUN %%item\%%run
list add,2,%%item\%%run
end
else
list add,2,%%item\%%run
end
end
wait
until @equal(@index(1),@count(1))
exit
|
_________________ ~~ Alcohol and calculus don't mix... Don't drink and derive! ~~
String.DLL * advanced string processing |
|