Jump to content

GUI shows "not responding" as DVD is read


Recommended Posts

Here's my script:

MsgBox(0,'',InsertDisc('D:'))

Func InsertDisc($sDrive)
#Region ### START Koda GUI section ### Form=F:\AutoIt scripts\cChooseFileFolder\frmInsertDisk.kxf MODIFIED
Local $frmInsertDisk = GUICreate("Insert a disk", 316, 157, 192, 114, 0)
Local $cLbl = GUICtrlCreateLabel("Please insert a disk into  drive "&$sDrive, 24, 40, 171, 17)
Local $cBtnClose = GUICtrlCreateButton("Cancel", 208, 96, 65, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
Local $bRet
    While 1
        If GUIGetMsg()=$cBtnClose Then
            $bRet = False
            ExitLoop
        EndIf
        If FileExists('D:\') Then
            $bRet = True
            ExitLoop
        EndIf
    WEnd
    GUIDelete($frmInsertDisk)
    Return $bRet
EndFunc

The steps:

  • Run the script from SciTE. Dialog shows
  • Insert the DVD
  • After some seconds, while the DVD is being read, (Not Responding) is added to the title
  • A few seconds later, MsgBox shows True

I tried If DriveStatus('D:')='READY' rather than If FIleExists('D:') with the same results

I also added ConsoleWrite(WinGetTitle('[ACTIVE]')&@CRLF) in the loop. The console showed Insert a disk without (Not Responding) repeatedly

How do I get rid of (Not Responding) ?

Suggestions?

Edited by c.haslam
Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
Share on other sites

Im not sure you can get around that, it's just that time when it's spinning up, i've never seen any computer not freeze, even a little bit when it's reading the drive.

cd/dvd is on their way out, it's a bit like working with floppy drives :P

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

This works for me
But as careca mentioned, obviously the gui freezes while the dvd is read

MsgBox(0,'',InsertDisc('D:'))

Func InsertDisc($sDrive)
    Local $frmInsertDisk = GUICreate("Insert a disk", 316, 157, 192, 114, 0)
    Local $cLbl = GUICtrlCreateLabel("Please insert a disk into  drive "&$sDrive, 24, 40, 171, 17)
    Local $cBtnClose = GUICtrlCreateButton("Cancel", 208, 96, 65, 25)
    GUISetState(@SW_SHOW)
    
    While DriveStatus('D:\') = "NOTREADY"
         If GUIGetMsg()=$cBtnClose Then Return "failed"
    WEnd
    GUIDelete($frmInsertDisk)
    Return "ok"
EndFunc

 

Link to comment
Share on other sites

Thanks. Why my code showed (Not Responding) I don't know. My working code is:

Func DlgInsertCD()
#Region ### START Koda GUI section ### Form=F:\AutoIt scripts\List files in a path\frmInsertDisc.kxf MODIFIED
Local $frmInsertDisc = GUICreate("Insert a disc", 341, 160, 192, 114)
GUICtrlCreateLabel("Insert a disc", 80, 32, 74, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlCreateLabel("Please insert a disc into the CD-DVD drive", 80, 64, 185, 17)
Local $cbtnCancel = GUICtrlCreateButton("Cancel", 248, 112, 65, 25)
GUICtrlCreateIcon("C:\Windows\System32\shell32.dll", -189, 24, 24, 32, 32)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Local $bRet = True
    While Not FileExists('D:\')
        If GUIGetMsg()=$cbtnCancel Then
            $bRet = False
            ExitLoop
        EndIf
    WEnd
    GUIDelete($frmInsertDisc)
    Return $bRet
EndFunc

I found that with While DriveStatus('D:\') = "NOTREADY" the dialog at least sometimes closed after a few seconds, before the DVD had spun up. I remember a post somewhere in which an MVP doubted whether DriveStatus worked flawlessly in 3.3.8.1. I have seen no problems with my new code.

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Link to comment
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
 Share

  • Recently Browsing   0 members

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