Jump to content

Independent GUI, possible?


Recommended Posts

Currently I have a script that has a GUI... there are several input boxes and labels. One of the labels displays the time up to the second. When the current time matches the time in an input box the script kicks off. While the script is running the GUI becomes unresponsive. I would like the time label to keep displaying the current time while the script is running without adding a bunch of label set command throughout the rest of my script.

Is there a way to accomplish this?

I also have tabs(logs) in my GUI which I like to go back and forth between while the script is running. This is often a slow process while the script is running, is there a way to speed this up as well?

Thanks

Link to comment
Share on other sites

Either split everything up in two scripts, or work around it.

1 way to fix the clock:

GUICreate("test", 640, 480)
$label = GUICtrlCreateLabel("", 5, 5, 100, 20)
$ubtton = GUICtrlCreateButton("press me", 5, 50, 100, 20)
GUISetState()

AdlibRegister("_clock")

While 1
    Switch GUIGetMsg()
        Case $ubtton
            _hehe()
        Case -3
            Exit
    EndSwitch
WEnd

Func _hehe()
    ToolTip("clock still works!")
    Sleep(10000)
    ToolTip("")
EndFunc

Func _clock()
    GUICtrlSetData($label, @SEC)
EndFunc

Your second issue is hard to tell, as you gave us no idea what you're doing. Post a reproducer (short runnable/working script).

Edit: improved example.

Edited by AdmiralAlkex
Link to comment
Share on other sites

here is a short example of what I am doing. When I am scanning through thousands of files looking at mod dates. when it finds a file that matches my conditions it logs it in the GUI and a .log file. I have multiple tabs the log different aspects of the search. I want to be able to smoothly switch between them to monitor the search's progress. Once the scan has started the tab movement can become "choppy".

Does this description help? Thanks for you time.

GUICreate("test", 640, 480)
$Clocklbl = GUICtrlCreateLabel("",20,460,100,15)
$Tabs = GUICtrlCreateTab(10,10,575,440)
    $InputTab = GUICtrlCreateTabItem("ScriptInput")
        $dirInput = GUICtrlCreateInput('Enter Search Dir',20,40,200,20)
        $ubtton = GUICtrlCreateButton("press me", 20, 70, 100, 20)
        
    $LogTab = GUICtrlCreateTabItem("Log")
        $Log = GUICtrlCreateEdit("",20,70,540,330)
GUISetState()

AdlibRegister("_clock")

While 1
    Switch GUIGetMsg()
        Case $ubtton
            ScanFolder(GUICtrlRead($dirInput))
        Case -3
            Exit
    EndSwitch
WEnd

Func _clock()
    GUICtrlSetData($Clocklbl, @HOUR & ':' & @MIN & ':' & @SEC)
EndFunc

Func ScanFolder($SourceFolder)
    Local $Search,$File,$FileAttributes,$FullFilePath
    
    $Search = FileFindFirstFile($SourceFolder & "\*.*")  

    While 1
        If $Search = -1 Then
            ExitLoop
        EndIf
        
        $File = FileFindNextFile($Search)
        If @error Then ExitLoop
        
        $FullFilePath = $SourceFolder & "\" & $File
        $FileAttributes = FileGetAttrib($FullFilePath)
        
        If StringInStr($FileAttributes,"D") Then
            ScanFolder($FullFilePath)
        Else
            GUICtrlSetData($Log,$File & @CRLF,1)
        EndIf

    WEnd
    FileClose($Search)
EndFunc
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...