Forum: UltraISO Topic: ISODrive shell context menu started by: Galapo Posted by Galapo on Oct. 15 2006,19:03
Hi,I have been a user of UltraISO for a while now, but haven't really had the need to join the forum. However, I felt I would join so I could pass on my AutoIT code that allows for the mounting of images via the windows shell context menu (the menu that appears when you right-click on a file. The code requires that the ISODrive be set up to use I:, but that can be changed by modifying the code below. Hope this is useful to somebody (it is for me, anyway). Mount image.au3 CODE #NoTrayIcon DIM $password $szLine = "" For $i = 1 To $CmdLine[0] $szLine = $szLine & $CmdLine[$i] If $i < $CmdLine[0] Then $szLine = $szLine & " " Next If $szLine = "" Then $contextmenu = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Classes\UltraISO\shell\Mount_with_&IsoDrive", "command") If $contextmenu = "" Then $reg = FileOpen("C:\Program Files\UltraISO\drivers\isodrive.reg", 2 ) FileWrite($reg, "Windows Registry Editor Version 5.00" & @CRLF) FileWrite($reg, "" & @CRLF) FileWrite($reg, "[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\UltraISO\shell\Mount_with_&IsoDrive]" & @CRLF) FileWrite($reg, '@="Mount with &IsoDrive"' & @CRLF) FileWrite($reg, "" & @CRLF) FileWrite($reg, "[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\UltraISO\shell\Mount_with_&IsoDrive\command]" & @CRLF) FileWrite($reg, '@="\"C:\\Program Files\\UltraISO\\drivers\\Mount image.exe\" %1"' & @CRLF) FileClose($reg) RunWait(@ComSpec & " /c " & 'c:\windows\system32\reg.exe import "C:\Program Files\UltraISO\drivers\isodrive.reg"', "", @SW_HIDE) FileDelete("C:\Program Files\UltraISO\drivers\isodrive.reg") EndIf MsgBox(0x40000, "", "Image could not be detemined...") Else If StringInStr($szLine, ".isz") Then $password = InputBox("Mounting .ISZ file...", "If this image requires a password, please enter it below." & @CRLF & " " & @CRLF & "If no password is required, leave blank.", "", "*") If @error = 1 Then Exit Else mount() EndIf Else mount() EndIf EndIf $ISODRIVE = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ISODrive\Parameters\Device0", "DRIVE") $DRIVEREVERT = "i:" If $ISODRIVE = "" Then $ISODRIVE = $ISODRIVE & ":" $isodriveinstall = FileOpen("C:\Program Files\UltraISO\drivers\IsoDrive_Install.cmd", 2 ) FileWrite($isodriveinstall, "c:" & @CRLF) FileWrite($isodriveinstall, "cd\" & @CRLF) FileWrite($isodriveinstall, 'cd "C:\Program Files\UltraISO\drivers"' & @CRLF) FileWrite($isodriveinstall, 'isocmd -number 1' & @CRLF) FileWrite($isodriveinstall, 'isocmd -change 1 ' & $ISODRIVE & @CRLF) FileWrite($isodriveinstall, 'isocmd -install' & @CRLF) FileClose ($isodriveinstall) RunWait(@ComSpec & " /c " & '"C:\Program Files\UltraISO\drivers\IsoDrive_Install.cmd"', "", @SW_HIDE) FileDelete("C:\Program Files\UltraISO\drivers\IsoDrive_Install.cmd") EndIf Func mount() $ISODRIVE = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ISODrive\Parameters\Device0", "DRIVE") $ISODRIVE = $ISODRIVE & ":" $mount = FileOpen("C:\Program Files\UltraISO\drivers\mountiso.cmd", 2 ) FileWrite($mount, "c:" & @CRLF) FileWrite($mount, "cd\" & @CRLF) FileWrite($mount, 'cd "C:\Program Files\UltraISO\drivers"' & @CRLF) FileWrite($mount, 'isocmd -eject ' & $ISODRIVE & @CRLF) FileWrite($mount, 'isocmd -mount ' & $ISODRIVE & ' "' & $szLine & '" ' & $password) FileClose ($mount) RunWait(@ComSpec & " /c " & '"C:\Program Files\UltraISO\drivers\mountiso.cmd"', "", @SW_HIDE) FileDelete("C:\Program Files\UltraISO\drivers\mountiso.cmd") EndFunc Once compiled, the created file---which needs to be named Mount image.exe---needs to be placed in the following location: C:\Program Files\UltraISO\drivers\. Double-click it and the context menu registry entries will be installed and hopefully everything will work... EDIT: The pasted code looks like it may have a few problems with wrapping, so I've attached the file if needed. Posted by Galapo on Oct. 15 2006,19:17
Not sure what's wrong with the forum, but can't edit my post after about five minutes (I could in the first couple of minutes). There could be a problem with the previous script. The attached file should makes a slight change.
Posted by xoben on Oct. 15 2006,22:35
Thanks Galapo for sharing the scripts.QUOTE Not sure what's wrong with the forum, but can't edit my post after about five minutes This problem should have been fixed now. Posted by User 69 on Oct. 16 2006,05:00
Thank you, Galapo,it is a good Idea with the context menu. I don't know anything about scripts. It seems to create a registry key. Does it do any thing else? What schould I do to deinstall? Posted by Galapo on Oct. 16 2006,18:24
(User 69 @ Oct. 16 2006,09:00) QUOTE Thank you, Galapo, it is a good Idea with the context menu. I don't know anything about scripts. It seems to create a registry key. Does it do any thing else? What schould I do to deinstall? Just delete the following registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Classes\UltraISO\shell\Mount_with_&IsoDrive And delete the file "Mount image.exe" from C:\Program Files\UltraISO\drivers\ That should be it. Regards, Galapo. |