Hi there, i want to eject the USB Drive my script is running from, i guess is will requirey to detect and close the handle of @ScriptFullPath. however, for the beginning i will focus on the eject, wich deos not work on my win7 ent.: #include <ejectUSB.lib.au3>
#NoTrayIcon
#AutoIt3Wrapper_Au3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
;;;EXAMPLE
Global $drive = InputBox("Eject Drive", "Enter drive (letter only):", "", " M1", 200, 130)
If @error Then Exit
$drive = StringUpper(StringLeft($drive, 1))
If Not FileExists($drive & ":") Then
MsgBox(0 + 16, "Error", "Drive not found.")
Exit
EndIf
Global $driveInfo[9] = ["Device Number", "Drive Type", "DOS Device Name", "Device Path", "Device ID", "Device Instance", "Device Instance Parent", _
"Parent Device ID", "IsRemovable"]
Global $driveArray = _QueryDrive($drive)
For $i = 0 To UBound($driveArray) - 1
ConsoleWrite("-" & $driveInfo[$i] & ": " & $driveArray[$i] & @CRLF)
Next
ConsoleWrite("-Is USBHDD: " & _IsUSBHDD($driveArray) & @CRLF)
If (6 = MsgBox(4 + 32, "Eject?", "Eject this drive?")) Then ConsoleWrite("Ejecting drive <" & $drive & ":> - " & _QueryDrive($drive, True) & @CRLF)
If (6 = MsgBox(4 + 32, "Restart?", "Restart this drive?")) Then ConsoleWrite("Restarting drive <" & $drive & ":> - " & _RestartDrive($driveArray) & @CRLF)
>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "P:\OC\autoit\conti\ejectUSB.au3" /UserParams
+>13:09:33 Starting AutoIt3Wrapper v.14.801.2025.0 SciTE v.3.4.4.0 Keyboard:00000407 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409)
+> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper
>Running AU3Check (3.3.12.0) params:-q -d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 from:C:\Program Files (x86)\AutoIt3 input:P:\OC\autoit\conti\ejectUSB.au3
+>13:09:33 AU3Check ended.rc:0
>Running:(3.3.12.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "P:\OC\autoit\conti\ejectUSB.au3"
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
-Device Number: 1
-Drive Type: 2
-DOS Device Name: \Device\HarddiskVolume5
-Device Path: \\?\usbstor#disk&ven_jetflash&prod_transcend_16gb&rev_8.01#7q9wxdi5&1#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
-Device ID: 2172
-Device Instance:
-Device Instance Parent:
-Parent Device ID:
-IsRemovable:
-Is USBHDD: False
"P:\OC\autoit\conti\ejectUSB.lib.au3" (281) : ==> Variable used without being declared.:
$res = DllCall("setupapi.dll", "dword", "CM_Query_And_Remove_SubTreeW", "dword", $DevInstParent, "dword*", 0, "wstr", "", "ulong", 260, "ulong", $CM_REMOVE_UI_OK)
$res = DllCall("setupapi.dll", "dword", "CM_Query_And_Remove_SubTreeW", "dword", ^ ERROR
->13:09:36 AutoIt3.exe ended.rc:1
+>13:09:36 AutoIt3Wrapper Finished.
>Exit code: 1 Time: 4.048
any idea?