18 posts in this topic
How do I keep updating Runtime in my GUI?
I have a text field in my scripts gui which displays the current runtime. I usually update it using a function, in the script, but i was wondering if there is any other way to keep the Runtime running without having to call the runtime function again and again and while my script is carrying out something else and running other functions. I mean autoit does'nt support multithreading does it?
Loading window not closing and not staying on top of main window
I have a main window with one button, when i press that button it brings up a loading screen, but I have two problems with the loading screen at the moment:
1) Once I have pressed the button, if i open something else full screen over this autoit project (eg: chrome), then on my task bar click on the autoit project to bring it up to the front, the loading screen does not stay on top of the main window, I tried using $WS_EX_TOPMOST but this makes the loading screen stay on top of all windows, I only want it to stay on top of $Main (my main window GUI)
2) Once the loading screen has been updated to 100%, it should sleep for a further two seconds then close, but at the moment after that 2 seconds, it goes back down to 25% instead of $LoadingWindow being deleted.
Has anyone got any thoughts or suggestions?
#include <WindowsConstants.au3> #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> #include <FontConstants.au3> $Main = GUICreate("Main Window", 600, 480, -1, -1, -1, $WS_EX_ACCEPTFILES) Global $button_Load = GUICtrlCreateButton("Loading Screen", 484, 98, 89, 20, $WS_GROUP) GUICtrlCreateTab(8, 16, 585, 424) GUICtrlCreateTabItem("Settings") GUICtrlCreateGroup("Settings", 16, 50, 569, 380) GUISetState(@SW_SHOWNORMAL) Func Load() WinSetState($Main, "", @SW_DISABLE) LoadingScreen("Loading @ 25%") GUICtrlSetData($LoadingPercent, 25) sleep(2000) LoadingScreen("Loading @ 100%") GUICtrlSetData($LoadingPercent, 100) sleep(2000) GUIDelete($LoadingWindow) WinSetState($Main, "", @SW_ENABLE) EndFunc Func LoadingScreen($LoadingText) ;Creates a Splash Text Screen with a progress bar. Global $LoadingWindow = GUICreate("", 500, 184, -1, -1, BitOR($WS_POPUP, $WS_BORDER), BitOR($WS_EX_WINDOWEDGE, $WS_EX_TOOLWINDOW)) Global $LoadingPercent = GUICtrlCreateProgress(18, 144, 461, 25, $PBS_SMOOTH) GUICtrlCreateLabel($LoadingText, 2, 44, 494, 88, $SS_CENTER) GUICtrlSetFont(-1, 15, 800, 0, "Calibra", $CLEARTYPE_QUALITY) GUISetState(@SW_SHOW) EndFunc While (1) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button_Load Load() EndSwitch WEnd
Copying selected data from GUI Edit
I have a GUI with an edit-field and a button.
First I write some text into the edit-field and select a part of it. After that I press the button, and the selection is edited.
How would I do that, though? When the text is selected and I press the button, it's unselected before the button actually raises an event.
GUI problem with While loop and buttons
My problem is that I have no way to work with buttons in a while loop
When i run the form i can exit well clicking a close main window and olso if i click in a exit button but if i start the apllication whith a Start button execute a loop for view a random numbers and then i can't stop the rogram and i can't not exit with a Exit button.
I think the problem is in the use of events but i can not find the solution....
Thank's to all
The exemple is this:
#include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiButton.au3> Opt("GUIOnEventMode", 1) $random_numbers = GUICreate("Random numbers",351,171,-1,-1,-1,-1) GUISetOnEvent($GUI_EVENT_CLOSE, "close") $lavel_number = GUICtrlCreateLabel("",117,36,98,26,BitOr($SS_CENTER,$SS_CENTERIMAGE),$WS_EX_STATICEDGE) GUICtrlSetBkColor(-1,"0xFFFFFF") $start = GUICtrlCreateButton("Start",34,95,100,30,-1,-1) GUICtrlSetOnEvent(-1,"start") $stop = GUICtrlCreateButton("Pause",182,95,100,30,-1,-1) GUICtrlSetOnEvent(-1,"pause") $exit = GUICtrlCreateButton("Exit",112,136,100,30,-1,-1) GUICtrlSetOnEvent(-1,"close") GUISetState(@SW_SHOW) While 1 Sleep (50) Wend Func start() While 1 Sleep(100) Local $a = Random(1,10,1) GUICtrlSetData($lavel_number,$a) WEnd EndFunc Func pause() EndFunc func close() exit EndFunc
Unable to open DLL files
I am trying to open a dll using DLLOpen, however everytime i try to do so the function fails and returns -1 result.
I have the dll in the same folder as the auto it script.
Local $hDLL = DllOpen("C:\Users\310255155\Downloads\COMMGvv2\commg.dll") DllCall($hDLL, "int", "MessageBox", "hwnd", 0, "str", "Some text", "str", "Some title", "int", 0) DllClose($hDLL) MsgBox(0,'result',$hDLL)