Jump to content

Recommended Posts

Posted

Hi all! ok here is the newest version of CD Loader. I still have not added in the install and configuration utility but here is the files anyway (play around with the ini file to customize the program)

To do:

add if exist for ini file

add config utility

add installation

make better help portion.

Any suggestions welcome!

here is the script...

AutoItSetOption("WinTitleMatchMode", 4)

AutoItSetOption("TrayIconDebug", 1)

;(----------------------This is a list of the CD's in Inventory----------------------)

;===Directory Information===

$IniFile = @ScriptDir & "\settings.ini"

$cdloaderdir = IniRead ($IniFile , "Misc", "cdloaderdir","nf_error")

$AlcoholDir = @ProgramFilesDir & "\Alcohol Soft\Alcohol 120\"

;===Mount util Command===

$alcoholcmd = IniRead ($IniFile , "Command", "alcoholcmd","nf_error")

$Mount = IniRead ($IniFile , "Command", "mount","nf_error")

$Unmount = IniRead ($IniFile , "Command", "unmount","nf_error")

;===Player Stuff===

$trayplaymessage = IniRead($IniFile, "Misc", "trayplaymessage","nf_error")

$playername = IniRead ($IniFile, "Misc", "playername","nf_error")

;===Track Movements===

$nexthotkey = IniRead ($IniFile, "Track Movement", "next","nf_error")

$previoushotkey =IniRead ($IniFile, "Track Movement", "previous","nf_error")

;===Names of CD's===

$cd1 = IniRead($IniFile, "CD Titles", "cd1","nf_error")

$cd2 = IniRead($IniFile, "CD Titles", "cd2","nf_error")

$cd3 = IniRead($IniFile, "CD Titles", "cd3","nf_error")

$cd4 = IniRead($IniFile, "CD Titles", "cd4","nf_error")

$cd5 = IniRead($IniFile, "CD Titles", "cd5","nf_error")

$cd6 = IniRead($IniFile, "CD Titles", "cd6","nf_error")

;==Location and filenames of CD's===

$CD1local =IniRead($IniFile, "CD Locations", "CD1local","nf_error")

$CD2local =IniRead($IniFile, "CD Locations", "CD2local","nf_error")

$CD3local =IniRead($IniFile, "CD Locations", "CD3local","nf_error")

$CD4local =IniRead($IniFile, "CD Locations", "CD4local","nf_error")

$CD5local =IniRead($IniFile, "CD Locations", "CD5local","nf_error")

$CD6local =IniRead($IniFile, "CD Locations", "CD6local","nf_error")

;(----------------------This is the start of the loop----------------------)

$loopy = 0

while $loopy = 0

$input = InputBox ( "CD Loader", "type here (type list for help)","","",170,40,0,0)

If @error = 1 Then

exit

;(----------------------Here are the commands for input values----------------------)

elseif $input = "list" Then

MsgBox(0, "CD inventory List", $cd1 & @CRLF & $cd2 & @CRLF & $cd3 & @CRLF & $cd4 & @CRLF & $cd5 & @CRLF & $cd6)

ElseIf $input = "forward" Then

winactivate($playername)

winwait($playername)

send($nexthotkey)

WinSetState ($playername,"",@SW_MINIMIZE)

ElseIf $input = "next" Then

winactivate($playername)

winwait($playername)

send($nexthotkey)

WinSetState ($playername,"",@SW_MINIMIZE)

elseif $input = "back" Then

winactivate($playername)

winwait($playername)

send($previoushotkey)

WinSetState ($playername,"",@SW_MINIMIZE)

elseif $input = "previous" Then

winactivate($playername)

winwait($playername)

send($previoushotkey)

WinSetState ($playername,"",@SW_MINIMIZE)

elseif $input = $cd1 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD1local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd1,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

elseif $input = $cd2 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD2local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd2,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

elseif $input = $cd3 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD3local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd3,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

elseif $input = $cd4 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD4local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd4,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

elseif $input = $cd5 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD5local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd5,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

elseif $input = $cd6 Then

ProgressOn("CD Loader", "Closing Existing Player", "0 percent")

winclose($playername)

ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")

RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)

ProgressSet(20 , "CD Loader", "Mounting New Image")

RunWait(@COMSPEC & $Mount & $CD6local, $AlcoholDir, @SW_HIDE)

ProgressSet(40 , "CD Loader", "Waiting For Player")

winwait($playername)

ProgressSet(60 , "CD Loader", "Minimizing Player")

WinSetState ($playername,"",@SW_MINIMIZE)

ProgressSet(80 , "CD Loader", "Opening Tray Message")

TrayTip ($trayplaymessage,$cd6,20,1)

ProgressSet(100 , "CD Loader", "Finalizing...")

sleep(1000)

ProgressOff()

else

msgbox(48,"CD Loader information","'" & $input & "'" & " was not found in the database")

endif

wend

here is the ini file MUST BE IN SAME DIRECTORY! MUST BE CALLED "settings.ini"

[Track Movement]

next="{CTRLDOWN}f{CTRLUP}"

previous="{CTRLDOWN}b{CTRLUP}"

[CD Titles]

CD1=muse - absolution

CD2=frou frou - details

CD3=kylie minogue - fever

CD4=postal service - give up

CD5=coldplay - a rush of blood to the head

cD6=wyclef jean - the carnival

[CD Locations]

CD1local=""D:\ISO Folder\Music\Muse\Muse - Absolution.nrg""

CD2local=""D:\ISO Folder\Music\Frou Frou\Frou Frou - Details.nrg""

CD3local=""D:\ISO Folder\Music\Kylie Minogue\Kylie Minogue - Fever.nrg""

CD4local=""D:\ISO Folder\Music\Postal Service\Postal Service - Give Up.nrg""

CD5local=""D:\ISO Folder\Music\Coldplay\Coldplay - A Rush of Blood To The Head.cue""

CD6local=""D:\ISO Folder\Music\Wyclef Jean\Wyclef Jean - The Carnival.cue""

[Misc]

cdloaderdir="c:\WINNT\CD Loader\"

trayplaymessage="Currently Playing..."

playername="classname=WMPlayerApp"

[Command]

alcoholcmd="AxCmd.exe"

Mount=" /C AxCmd.exe Z: /M:"

Unmount=" /C AxCmd.exe Z: /U"

Posted

wow, that code has soooo much code duplication that it made my eyes hurt. you can probably cut down the size the length of the script by %80

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Posted

OH!!!!! so funcs are like labels and goto's... I always wondered what those things were. but is there any way to use only 1 func for the cd recognizing and loading and just switch the parameters?

Posted (edited)

study to learn funcs here...  :D

AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("TrayIconDebug", 1)
;(----------------------This is a list of the CD's in Inventory----------------------)

;===Directory Information===
$IniFile = @ScriptDir & "\settings.ini"
$cdloaderdir = IniRead ($IniFile , "Misc", "cdloaderdir","nf_error")
$AlcoholDir = @ProgramFilesDir & "\Alcohol Soft\Alcohol 120\"

;===Mount util Command===
$alcoholcmd = IniRead ($IniFile , "Command", "alcoholcmd","nf_error")
$Mount = IniRead ($IniFile , "Command", "mount","nf_error")
$Unmount = IniRead ($IniFile , "Command", "unmount","nf_error")

;===Player Stuff===
$trayplaymessage = IniRead($IniFile, "Misc", "trayplaymessage","nf_error")
$playername = IniRead ($IniFile, "Misc", "playername","nf_error")

;===Track Movements===
$nexthotkey = IniRead ($IniFile, "Track Movement", "next","nf_error")
$previoushotkey =IniRead ($IniFile, "Track Movement", "previous","nf_error")

;===Names of CD's===
$cd1 = IniRead($IniFile, "CD Titles", "cd1","nf_error")

$cd2 = IniRead($IniFile, "CD Titles", "cd2","nf_error")

$cd3 = IniRead($IniFile, "CD Titles", "cd3","nf_error")

$cd4 = IniRead($IniFile, "CD Titles", "cd4","nf_error")

$cd5 = IniRead($IniFile, "CD Titles", "cd5","nf_error")

$cd6 = IniRead($IniFile, "CD Titles", "cd6","nf_error")

;==Location and filenames of CD's===
$CD1local =IniRead($IniFile, "CD Locations", "CD1local","nf_error")
$CD2local =IniRead($IniFile, "CD Locations", "CD2local","nf_error")
$CD3local =IniRead($IniFile, "CD Locations", "CD3local","nf_error")
$CD4local =IniRead($IniFile, "CD Locations", "CD4local","nf_error")
$CD5local =IniRead($IniFile, "CD Locations", "CD5local","nf_error")
$CD6local =IniRead($IniFile, "CD Locations", "CD6local","nf_error")

;(----------------------This is the start of the loop----------------------)

$loopy = 0
while $loopy = 0
     $input = InputBox ( "CD Loader", "type here (type list for help)","","",170,40,0,0)

     If @error then
          exit
    ;(----------------------Here are the commands for input values----------------------)

     elseif $input = "list" then
          MsgBox(0, "CD inventory List", $cd1 & @CRLF & $cd2 & @CRLF & _
               $cd3 & @CRLF & $cd4 & @CRLF & $cd5 & @CRLF & $cd6)

     elseif $input = "forward" then
          My1stFuncingExperience($nexthotkey)

     elseif $input = "next" then
          My1stFuncingExperience($nexthotkey)

     elseif $input = "back" then
          My1stFuncingExperience($previoushotkey)

     elseif $input = "previous" then
          My1stFuncingExperience($previoushotkey)

     elseif $input = $cd1 then
          My2ndFuncingExperience($cd1, $CD1local)

     elseif $input = $cd2 then
          My2ndFuncingExperience($cd2, $CD2local)

     elseif $input = $cd3 then
          My2ndFuncingExperience($cd3, $CD3local)

     elseif $input = $cd4 then
          My2ndFuncingExperience($cd4, $CD4local)

     elseif $input = $cd5 then
          My2ndFuncingExperience($cd5, $CD5local)

     elseif $input = $cd6 then
          My2ndFuncingExperience($cd6, $CD6local)

     else
          msgbox(48,"CD Loader information","'" & $input & "'" & " was not found in the database")
     endif
wend

Func My2ndFuncingExperience(ByRef $parm1, ByRef $parm2)
     ProgressOn("CD Loader", "Closing Existing Player", "0 percent")
     winclose($playername)
     ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")
     RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)
     ProgressSet(20 , "CD Loader", "Mounting New Image")
     RunWait(@COMSPEC & $Mount & $parm2, $AlcoholDir, @SW_HIDE)
     ProgressSet(40 , "CD Loader", "Waiting For Player")
     winwait($playername)
     ProgressSet(60 , "CD Loader", "Minimizing Player")
     WinSetState ($playername,"",@SW_MINIMIZE)
     ProgressSet(80 , "CD Loader", "Opening Tray Message")
     TrayTip ($trayplaymessage,$parm1,20,1)
     ProgressSet(100 , "CD Loader", "Finalizing...")
     sleep(1000)
     ProgressOff()
EndFunc

Func My1stFuncingExperience(ByRef $parm1)
          winactivate($playername)
          winwait($playername)
          send($parm1)
          WinSetState ($playername,"",@SW_MINIMIZE)
EndFunc
how about replacing the $cd and $cdlocal variables with an array? and some other changes

i haven't tried this, but seems like it should work

AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("TrayIconDebug", 1)
;(----------------------This is a list of the CD's in Inventory----------------------)

;===Directory Information===
$IniFile = @ScriptDir & "\settings.ini"
$cdloaderdir = IniRead ($IniFile , "Misc", "cdloaderdir","nf_error")
$AlcoholDir = @ProgramFilesDir & "\Alcohol Soft\Alcohol 120\"

;===Mount util Command===
$alcoholcmd = IniRead ($IniFile , "Command", "alcoholcmd","nf_error")
$Mount = IniRead ($IniFile , "Command", "mount","nf_error")
$Unmount = IniRead ($IniFile , "Command", "unmount","nf_error")

;===Player Stuff===
$trayplaymessage = IniRead($IniFile, "Misc", "trayplaymessage","nf_error")
$playername = IniRead ($IniFile, "Misc", "playername","nf_error")

;===Track Movements===
$nexthotkey = IniRead ($IniFile, "Track Movement", "next","nf_error")
$previoushotkey =IniRead ($IniFile, "Track Movement", "previous","nf_error")

; first dimention is $cdX and second is $CDXLocal
Global $cd[6][2]
;===Names of CD's===

for $i = 0 to 5
   $cd[$i][0] = IniRead($IniFile, "CD Titles", "cd" & $i,"nf_error")
  ;==Location and filenames of CD's===
   $cd[$i][1] = IniRead($IniFile, "CD Locations", "CD" & $i & "local","nf_error")
next


;(----------------------This is the start of the loop----------------------)

$loopy = 0
while $loopy = 0
     $input = InputBox ( "CD Loader", "type here (type list for help)","","",170,40,0,0)

     If @error then
          exit
  ;(----------------------Here are the commands for input values----------------------)

     elseif $input = "list" then
          MsgBox(0, "CD inventory List", $cd1 & @CRLF & $cd2 & @CRLF & _
               $cd3 & @CRLF & $cd4 & @CRLF & $cd5 & @CRLF & $cd6)

     elseif $input = "forward" OR $input = "next" then
          My1stFuncingExperience($nexthotkey)

     elseif $input = "back" OR $input = "previous"then
          My1stFuncingExperience($previoushotkey)

     elseif StringInArray($input) >= 0 then
          My2ndFuncingExperience($input, $cd[StringInArray($input)][1])

     else
          msgbox(48,"CD Loader information","'" & $input & "'" & " was not found in the database")
     endif
wend

Func My2ndFuncingExperience(ByRef $parm1, ByRef $parm2)
     ProgressOn("CD Loader", "Closing Existing Player", "0 percent")
     winclose($playername)
     ProgressSet(0 , "CD Loader", "Un-Mounting Old Image")
     RunWait(@COMSPEC & $Unmount, $AlcoholDir, @SW_HIDE)
     ProgressSet(20 , "CD Loader", "Mounting New Image")
     RunWait(@COMSPEC & $Mount & $parm2, $AlcoholDir, @SW_HIDE)
     ProgressSet(40 , "CD Loader", "Waiting For Player")
     winwait($playername)
     ProgressSet(60 , "CD Loader", "Minimizing Player")
     WinSetState ($playername,"",@SW_MINIMIZE)
     ProgressSet(80 , "CD Loader", "Opening Tray Message")
     TrayTip ($trayplaymessage,$parm1,20,1)
     ProgressSet(100 , "CD Loader", "Finalizing...")
     sleep(1000)
     ProgressOff()
EndFunc

Func My1stFuncingExperience(ByRef $parm1)
          winactivate($playername)
          winwait($playername)
          send($parm1)
          WinSetState ($playername,"",@SW_MINIMIZE)
EndFunc

; A form of this function should really exist as part of the standard includes
Func StringInArray(ByRef $param1)
        for $x = 0 to 5
          if $cd[$x][0] = $param1 then return $x
        next
        return -1
endFunc
Edited by MattNis

[quote]I was busy waiting all night for the Columbus Day Bunny to come down my chimney and light fireworks in my pumpkin.There's so much wrong with that.Oh, I'm sorry, i forgot you were Jewish.[/quote]

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...