Sign in to follow this  
Followers 0
zFrank

pause the script until a Removable device is inserted

12 posts in this topic

hi, i am automating a wireless drivers installation setup. therefore i need to know...

1- how to pause the script until a Removable device is inserted?

2- how to safely remove a removable device?

many thanks in advance for the help!


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites



Use Scriptomatic, maybe you'll find what you want.


When the words fail... music speaks

Share this post


Link to post
Share on other sites

what is Scriptomatic and where can i find it? is there no other way to do it? i mean i want to wait for the device to be connected.


[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites

what is Scriptomatic and where can i find it? is there no other way to do it? i mean i want to wait for the device to be connected.

Scriptomatic is here


When the words fail... music speaks

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

maybe this can help you, it's from one of my scripts...

#include <Process.au3>
#include <Constants.au3>
#NoTrayIcon

Global $UsbDrive

Opt("TrayOnEventMode",1)
Opt("TrayMenuMode",1) ; Default tray menu items (Script Paused/Exit) will not be shown.

Call("USBListen")
; FunctionsTraySetState()
Func USBListen()
    
$strComputer = "."
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2")

 $colEvents = $objWMIService.ExecNotificationQuery _
    ("Select * From __InstanceOperationEvent Within 5 Where " _
        & "TargetInstance isa 'Win32_LogicalDisk'")
        
While 1
     $objEvent = $colEvents.NextEvent
    If $objEvent.TargetInstance.DriveType = 2 Then
        Select
        Case $objEvent.Path_.Class()="__InstanceCreationEvent"
                $UsbDrive = $objEvent.TargetInstance.DeviceId
                TraySetIcon("warning")
                TraySetState()
                TraySetToolTip($objEvent.TargetInstance.DeviceId)
                TrayTip("","Drive " & $objEvent.TargetInstance.DeviceId & " has been added." & @CR,3,0)
                Sleep(500)
                _RunDOS("start " & $objEvent.TargetInstance.DeviceId & "\test.txt")
            Case $objEvent.Path_.Class()="__InstanceDeletionEvent"
                TraySetToolTip($objEvent.TargetInstance.DeviceId)
                TrayTip("","Drive " & $objEvent.TargetInstance.DeviceId & " has been removed."& @CR,3,0)
                Sleep(3000)
                TraySetState(2)
        EndSelect
    EndIf
WEnd
EndFunc

Func ExitEvent()
    Exit
EndFunc

Also, post your script and I'll try and edit it to do what you want if you can't

Edited by AoRaToS

s!mpL3 LAN Messenger

Current version 2.9.8.8 [30/09/2015]

Download Here

s!mpL3

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

thanks a lot but i have also tried and succeed...

something like this

$DISK = DriveGetDrive("REMOVABLE")
For $I = 1 To $DISK[0]
    $STATS = DriveStatus($DISK[$I])
    If $STATS = "READY" Then
    Msgbox(0, "Whatever", "Drive is ready")
    EndIf
Next

can i do it by some other way?

Edited by zFrank

[font="Georgia"]GSM Expert[/font] but not AutoIt :DProud to be Admin Of : http://www.gsmhosting.net/visit my Forum... http://www.gsmhosting.net/vbb/index.php
$Life = "Happy"
If @Error Then
$Life = "Risk"

Share this post


Link to post
Share on other sites

still don't know...

how to safely remove a removable device?

anyone please help!

See here

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0