Dentist2026 Posted Sunday at 12:42 PM Posted Sunday at 12:42 PM Hi everyone, I have a noob question: I have a fairly long piece of code, and I've simplified it to the bare essentials to illustrate the problem. When I click a button to trigger a function, I get a spinning hourglass icon in Windows. Strangely enough, the AutoIT GUI works perfectly fine, but I'm sure there must be a small mistake somewhere in the code. Thanks. expandcollapse popup#NoTrayIcon #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <ComboConstants.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <ColorConstants.au3> #include <FontConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <ProgressConstants.au3> #include <WinAPI.au3> $Gui = GUICreate( "GUI", 300, 200) $Button_Connectr = GUICtrlCreateButton("&Call Function", 20, 20, 200, 40) GUIStartGroup() GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE then DriveMapDel("P:") Exit EndIf If $msg = $Button_Connectr then F_LWR() Sleep(5) WEnd Func F_LWR() GUISetCursor(15,1) EndFunc
Developers Solution Jos Posted Sunday at 12:57 PM Developers Solution Posted Sunday at 12:57 PM (edited) 15 minutes ago, Dentist2026 said: Strangely enough, the AutoIT GUI works perfectly fine, but I'm sure there must be a small mistake somewhere in the code. Thanks. Not so strange when you look at your code! 😉 You are overriding the standard cursor icon with the busy icon in the called func. Try this version that will do that for 2 seconds and the return to normal: expandcollapse popup#NoTrayIcon #include <String.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <ComboConstants.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <ColorConstants.au3> #include <FontConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <Date.au3> #include <ProgressConstants.au3> #include <WinAPI.au3> $Gui = GUICreate("GUI", 300, 200) $Button_Connectr = GUICtrlCreateButton("&Call Function", 20, 20, 200, 40) GUIStartGroup() GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then DriveMapDel("P:") Exit EndIf If $msg = $Button_Connectr Then F_LWR() Sleep(5) WEnd Func F_LWR() ; Set hourglass icon GUISetCursor(15, 1) Sleep(2000) ; reset icon GUISetCursor(0, 0) EndFunc ;==>F_LWR Edited Sunday at 12:57 PM by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Dentist2026 Posted 2 hours ago Author Posted 2 hours ago Thank you very much! I really had to laugh when I figured out the solution to my problem. To miss the forest for the trees!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now