ArtoAllan Posted March 1, 2020 Posted March 1, 2020 Hey guys. So recently I wanted to update my old script to a newer version. I've been running it with a gui and never had any issues with it. However with this new code I cant seem to understand why the script is just closing whenever I click a button. I basically just needs it to run the openmla function on $button1. The openmla function worked before adding the gui, but I cant figure out where I am missing the error. Need a pair of fresh eyes on it! expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ImageSearch.au3> #Include <File.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #Region ### START Koda GUI section ### Form= Global $Form1_1 = GUICreate("Form1", 609, 416, 199, 108) Global $Pic1 = GUICtrlCreatePic("C:\Users\allan\Desktop\Autoit\FaceCom\background.bmp", 0, -17, 625, 432) GUICtrlSetState($Pic1, $GUI_DISABLE) Global $url1 = GUICtrlCreateInput("url1", 40, 76, 121, 21) Global $url2 = GUICtrlCreateInput("url2", 40, 108, 121, 21) Global $url3 = GUICtrlCreateInput("url3", 40, 140, 121, 21) Global $url4 = GUICtrlCreateInput("url4", 40, 172, 121, 21) Global $Radio1 = GUICtrlCreateRadio("", 184, 76, 17, 17) Global $Radio2 = GUICtrlCreateRadio("", 184, 108, 17, 17) Global $Radio3 = GUICtrlCreateRadio("", 184, 140, 17, 17) Global $Radio4 = GUICtrlCreateRadio("", 184, 172, 17, 17) Global $cmt1 = GUICtrlCreateRadio("", 344, 295, 17, 17) Global $cmt2 = GUICtrlCreateRadio("", 344, 263, 17, 17) Global $cmt3 = GUICtrlCreateRadio("", 344, 231, 17, 17) Global $cmt4 = GUICtrlCreateRadio("", 456, 295, 17, 17) Global $cmt5 = GUICtrlCreateRadio("", 456, 263, 17, 17) Global $cmt6 = GUICtrlCreateRadio("", 456, 231, 17, 17) Global $Numbercmt = GUICtrlCreateInput("Comments", 136, 248, 121, 21) Global $Input6 = GUICtrlCreateInput("Likes/Hearts", 136, 280, 121, 21) Global $Button1 = GUICtrlCreateButton("", 15, 335, 115, 49, $BS_BITMAP) GUICtrlSetImage(-1, "C:\Users\allan\Desktop\Autoit\FaceCom\start.bmp", -1) Global $Button2 = GUICtrlCreateButton("", 151, 335, 115, 49, $BS_BITMAP) GUICtrlSetImage(-1, "C:\Users\allan\Desktop\Autoit\FaceCom\stop.bmp", -1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Global $i = GUICtrlRead($Numbercmt)+1 Global $Likes = GUICtrlRead($Input6) openmla() Case $Button2 Terminate() EndSwitch WEnd HotKeySet("{Esc}", "Terminate") HotKeySet("{F1}", "openmla") HotKeySet("{F2}", "comment") HotKeySet("{F3}", "reaction") HotKeySet("{F4}", "openurls") #Region Variables Global $a = @DesktopWidth / 2 Global $b = 10 Global $x = 1 Global $y = 1 Global $i = 10 Global $cmt = 0 Global $MLA = 285 Global $Likes = 10 Global $Likecount = 0 Global $cmtfile = "test.txt" #EndRegion Func openmla() While $i > $cmt WinActivate("Multilogin - 4.5.3 Fire") ToolTip("waiting", $a, $b, "Finding MLA session", 1, 1) Sleep(10) mouseclick("left",1812, $MLA ,1,10) ; Open MLA profile Sleep(1000) $MLA=$MLA+40 ToolTip("", $a, $b, "Profile loading", 1, 1) sleep(1000) ExitLoop Wend EndFunc
Subz Posted March 1, 2020 Posted March 1, 2020 You need to add your global variables to the top of your script, $cmt isn't created until after the GUI so is never set. ArtoAllan 1
Nine Posted March 1, 2020 Posted March 1, 2020 Same goes with your hotkeyset... “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
ArtoAllan Posted March 1, 2020 Author Posted March 1, 2020 17 minutes ago, Subz said: You need to add your global variables to the top of your script, $cmt isn't created until after the GUI so is never set. Thanks man! Not sure how I can miss that, haha.
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