vi779900 Posted February 8, 2017 Share Posted February 8, 2017 I set up a msg on my first function for a case in my GUI but when i move on to case 2, to my second function and put in a msg it gives an error saying variable used without being declared. Can anyone give examples of how to properly do this? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 8, 2017 Moderators Share Posted February 8, 2017 vi779900, It would greatly assist us to help you if you were to post your code - see here how to do it. 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...
vi779900 Posted February 14, 2017 Author Share Posted February 14, 2017 Sorry work got hectic, but here is the script i was working on, and i'm having trouble with adding a popup message prompt to each function @Melba23 Version 1.0.au3 Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2017 Developers Share Posted February 14, 2017 Don't think you actually read what @Melba23 pointed you to...right? So tell me: What exactly is your problem adding that msgbox()? ps. maybe you want to run Tidy on your code to make it a little more readable. 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...
vi779900 Posted February 15, 2017 Author Share Posted February 15, 2017 (edited) expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=C:\Users\trioptics\Desktop\Autopositioner\JSF.kxf Global $JSF = GUICreate("JSF", 402, 485, -1, -1) Global $First = GUICtrlCreateButton("T8-77454200-05", 0, 0, 75, 25) Global $Second = GUICtrlCreateButton("77454212-001", 0, 24, 75, 25) Global $Third = GUICtrlCreateButton("T8-77454200-06", 0, 48, 75, 25) Global $Fourth = GUICtrlCreateButton("77454211-001", 0, 72, 75, 25) $Button5 = GUICtrlCreateButton("Button5", 0, 96, 75, 25) $Button6 = GUICtrlCreateButton("Button6", 0, 120, 75, 25) $Button7 = GUICtrlCreateButton("Button7", 0, 144, 75, 25) $Button8 = GUICtrlCreateButton("Button8", 0, 168, 75, 25) $Button9 = GUICtrlCreateButton("Button9", 0, 192, 75, 25) $Button10 = GUICtrlCreateButton("Button10", 0, 216, 75, 25) $Button11 = GUICtrlCreateButton("Button11", 0, 240, 75, 25) $Button13 = GUICtrlCreateButton("Button13", 0, 288, 75, 25) $Button12 = GUICtrlCreateButton("Button12", 0, 264, 75, 25) $Button14 = GUICtrlCreateButton("Button14", 0, 312, 75, 25) $Button15 = GUICtrlCreateButton("Button15", 0, 336, 75, 25) $Button16 = GUICtrlCreateButton("Button16", 0, 360, 75, 25) $Button17 = GUICtrlCreateButton("Button17", 0, 384, 75, 25) $Button18 = GUICtrlCreateButton("Button18", 0, 408, 75, 25) $Button19 = GUICtrlCreateButton("Button19", 0, 432, 75, 25) $Button20 = GUICtrlCreateButton("Button20", 0, 456, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $First StartFirst() Case $Second StartSecond() Case $Third StartThird() Case $Fourth StartFourth EndSwitch WEnd Func StartFirst();T8-77454200-05 WinActivate('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]') ControlCommand('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:45]', 'Check') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:6]') Send('{HOME}{DOWN}{DOWN}{DOWN}{ENTER}') Sleep(1000) ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:3]') Send('{HOME}{DOWN}{DOWN}{ENTER}') Sleep(1000) WinWait('OptiCentric 3.3.11') Send('{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:RichEdit20A; INSTANCE:8]', '200') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:24]', 'left', 1) EndFunc Func StartSecond();77454212-001 WinActivate('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]') ControlCommand('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:45]', 'UnCheck') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:6]') Send('{HOME}{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Edit; INSTANCE:7]', '258.318') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:3]') Send('{HOME}{DOWN}{DOWN}{ENTER}') Sleep(1000) WinWait('OptiCentric 3.3.11') Send('{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:RichEdit20A; INSTANCE:8]', '128') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:24]', 'left', 1) EndFunc Func StartThird();T8-77454200-06 WinActivate('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]') ControlCommand('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:32]', 'Check') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:5]') Send('{HOME}{DOWN}{DOWN}{DOWN}{ENTER}') Sleep(1000) ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:1]') Send('{HOME}{DOWN}{DOWN}{ENTER}') Sleep(1000) WinWait('OptiCentric 3.3.11') Send('{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:RichEdit20A; INSTANCE:5]', '200') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:12]', 'left', 1) EndFunc Func StartFourth();7745211-001 WinActivate('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]') ControlCommand('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:32]', 'UnCheck') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:5]') Send('{HOME}{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Edit; INSTANCE:3]', '151.13') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:ComboBox; INSTANCE:1]') Send('{HOME}{DOWN}{DOWN}{DOWN}{DOWN}{DOWN}{ENTER}') Sleep(1000) WinWait('OptiCentric 3.3.11') Send('{ENTER}') Sleep(1000) ControlSetText('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:RichEdit20A; INSTANCE:5]', '355.778') ControlClick('OptiCentric 3.3.11 - Trioptics GmbH - [Reflection]', '', '[CLASS:Button; INSTANCE:12]', 'left', 1) EndFunc My bad! Edited February 15, 2017 by vi779900 Link to comment Share on other sites More sharing options...
vi779900 Posted February 15, 2017 Author Share Posted February 15, 2017 When i add a msg box to more than one function only the first function works while the others give me an error that variable is not found. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2017 Moderators Share Posted February 15, 2017 vi779900, If you add #include <MsgBoxConstants.au3> to the start of the script, this works for me: While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $First MsgBox($MB_SYSTEMMODAL, "Function", "Starting First") StartFirst() MsgBox($MB_SYSTEMMODAL, "Function", "Ending First") Case $Second MsgBox($MB_SYSTEMMODAL, "Function", "Starting Second") StartSecond() MsgBox($MB_SYSTEMMODAL, "Function", "Ending Second") Case $Third MsgBox($MB_SYSTEMMODAL, "Function", "Starting Third") StartThird() MsgBox($MB_SYSTEMMODAL, "Function", "Ending Third") Case $Fourth MsgBox($MB_SYSTEMMODAL, "Function", "Starting Fourth") StartFourth() ; Added () <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< MsgBox($MB_SYSTEMMODAL, "Function", "Ending Fourth") EndSwitch WEnd 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...
vi779900 Posted February 15, 2017 Author Share Posted February 15, 2017 So i will be able to have a different message box for each function, each giving different set of instructions? Link to comment Share on other sites More sharing options...
vi779900 Posted February 15, 2017 Author Share Posted February 15, 2017 Thanks! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 15, 2017 Moderators Share Posted February 15, 2017 vi779900, As you can see above, each of the MsgBoxes has a different message - you just write what you require in each one. 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...
vi779900 Posted February 15, 2017 Author Share Posted February 15, 2017 Thank you, you have a great one! 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