RestrictedUser Posted April 5, 2019 Share Posted April 5, 2019 (edited) document.au3 Hello guys! I've searched many times in AutoIt Forum and Help file examples to find-out how to change between two GUIs in two function, but i didn't understand well about Gui Event Mode and so on. under this post, i have uploaded my source-code, but second gui's buttons doesn't work even Close Button! Edited April 6, 2019 by Colduction Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2019 Moderators Share Posted April 6, 2019 (edited) Colduction, Try reading the Managing Multiple GUIs tutorial in the Wiki - that should help you understand how to get your GUIs playing together nicely. M23 Edit: And I have given up trying to amend your script to make it function as the logic flow is so tortuous that I have no idea just what is supposed to be happening. What I will say is that you have a (non-terminated) infinite While loop with no escape condition in your MainActivity function - which you also call recursively several times from within other functions. Basically the whole thing is a mess. If you explain carefully what you are trying to do, we might be able to get you something that does work. Edited April 6, 2019 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 2 hours ago, Melba23 said: explain carefully what you are trying to do i had created another script that writes something to microsoft writing tools such as Word, but in this script i wrote close word.exe process if is running after 1-hour, then i can goto login stage with Hot-Key to set some characters to write on word.exe 3 hours ago, Melba23 said: Try reading the Managing Multiple GUIs I've red this article more than 5 times, but it's difficult for me to understand Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 6, 2019 Moderators Share Posted April 6, 2019 Colduction, What aspect of the tutorial is giving you problems? Do the examples not make it clear what is happening in the various cases? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 @Melba23, I'm new to AutoIt, i don't know how to change between forms with function, also buttons doesn't work for me it's so little hard for me to understand experts Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted April 6, 2019 Share Posted April 6, 2019 9 minutes ago, Colduction said: also buttons doesn't work for me Laziness apart, where is your code? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 9 minutes ago, Colduction said: I'm new to AutoIt, i don't know how to change between forms with function, also buttons doesn't work for me it's so little hard for me to understand experts That still doesn't answer why the linked tutorial is difficult to understand, unless you didn't follow it and tried each step yourself. Jos FrancescoDiMuro 1 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 Just now, FrancescoDiMuro said: where is your code? I've posted under my article Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 1 minute ago, Jos said: tried each step I've tried many times, but it's big problem for me Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 (edited) Yea right... so why do you think it will ever go any further that this part?: MainActivity() Func MainActivity() While 1 ; Sleep for decrease CPU Usage Sleep(2000) ; Check process existing For $i = 0 To UBound($BMProcesses) - 1 Step 1 If ProcessExists($BMProcesses[$i]) Then ProcessWaitClose($BMProcesses[$i], 3600) Next ; Sleep for decrease CPU Usage Sleep(100) ; Terminate process For $i = 0 To UBound($BMProcesses) - 1 Step 1 ProcessClose($BMProcesses[$i]) Next EndFunc EDIT: Skip that: Your code it totally screwed up! RUn Tidy on it and Run AU3Check before even asking any question here! Jos Edited April 6, 2019 by Jos FrancescoDiMuro 1 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 4 minutes ago, Jos said: Run AU3Check before even asking any question here! I've ran AU3Check, it doesn't show me any errors Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 Try that again on the posted attached file. 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 10 minutes ago, Jos said: Try that again on the posted attached file. Jos You right! here is edited and fixed code document.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 (edited) Ok, so how do we replicate your problem as you haven't described that yet and what is that problem? Looking at your script a little closer it is clear you do not understand the basics of Func calling yet as you start the Func MainActivity() again after Func LoginForm() is done. You need to simply return from Func LoginForm() as the MainActivity() is still running and will continue. Jos Edited April 6, 2019 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 3 minutes ago, Jos said: what is that problem? buttons in 2nd GUI doesn't work even Close button How to call GUIs that they are in different Func without these problems? (such as buttons are not correctly work) Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 Reread my post as I've updated it. 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 8 minutes ago, Jos said: start the Func MainActivity() again after Func LoginForm() is done you mean that AdlibRegister is my problem? Link to comment Share on other sites More sharing options...
Developers Jos Posted April 6, 2019 Developers Share Posted April 6, 2019 (edited) No ... reread my post please! This part probably needs to be like this: (untested) expandcollapse popupFunc LoginForm() ; Authentication form for accessing main form Global $LoginForm = GUICreate("Login", 201, 161, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX)) Global $CloseBTN = GUICtrlCreateButton("Close", 7, 126, 62, 25) Global $SignInBTN = GUICtrlCreateButton("Sign-in", 71, 126, 90, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") Global $PasswordInput = GUICtrlCreateInput("admin", 8, 88, 185, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER, $ES_PASSWORD)) Global $UsernameInput = GUICtrlCreateInput("admin", 8, 40, 185, 21, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER)) Global $UsernameLBL = GUICtrlCreateLabel("Username:", 8, 21, 55, 17) Global $PasswordLBL = GUICtrlCreateLabel("Password:", 8, 68, 53, 17) Global $ResetCredIcon = GUICtrlCreateButton("res", 160, 126, 32, 25) GUICtrlSetTip(-1, "Reset Credentials via PSIC") GUICtrlSetCursor(-1, 0) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE, $CloseBTN GUIDelete($LoginForm) Return Case $SignInBTN If AuthProcess(GUICtrlRead($UsernameInput), GUICtrlRead($PasswordInput)) = 1 Then MsgBox(64, "", "Welcome!") GUIDelete($LoginForm) Return EndIf Case $ResetCredIcon GUIDelete($LoginForm) PSICGenerator() EndSwitch If GUICtrlRead($UsernameInput) = "" Or GUICtrlRead($PasswordInput) = "" And BitAND(GUICtrlGetState($SignInBTN), $GUI_ENABLE) Then GUICtrlSetState($SignInBTN, $GUI_DISABLE) EndIf If GUICtrlRead($UsernameInput) <> "" And GUICtrlRead($PasswordInput) <> "" And BitAND(GUICtrlGetState($SignInBTN), $GUI_DISABLE) Then GUICtrlSetState($SignInBTN, $GUI_ENABLE) EndIf For $i = 0 To UBound($BMProcesses) - 1 Step 1 If ProcessExists($BMProcesses[$i]) Then GUIDelete($LoginForm) Return EndIf Next AdlibRegister("MainActivity", 250) WEnd EndFunc ;==>LoginForm You have the same problem in Func PSICGenerator()... DO NOT call the calling function but use return to go back to it! Jos Edited April 6, 2019 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. Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 (edited) 4 minutes ago, Jos said: DO NOT call the calling function but use return to go back to it! Thanks @Jos, You are best and more active person in this Forum!❤️ if i get any error, i will tell again Edited April 6, 2019 by Colduction Link to comment Share on other sites More sharing options...
RestrictedUser Posted April 6, 2019 Author Share Posted April 6, 2019 @Jos, doesn't work even with using Return =( Link to comment Share on other sites More sharing options...
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