Rapid Posted October 2, 2015 Share Posted October 2, 2015 Hi guys, I made a program and I used KODA to create a gui, I'm not really sure how to make it so when the program launches, it will show the gui...I've included the GUI au3 but cant manage to make it work :(. Any help? Link to comment Share on other sites More sharing options...
Developers Jos Posted October 2, 2015 Developers Share Posted October 2, 2015 It probably would help when you show your script. 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...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 Well what do I need to include to make the GUI run?How do u initialize a GUI to work?Should I include the Main files from the GUI file or is it ok include the GUI from the Main program file? It's a program I rather keep private at the moment, when i'm done ill probably release it. Link to comment Share on other sites More sharing options...
BrewManNH Posted October 2, 2015 Share Posted October 2, 2015 Look at the help file for GUICreate, make sure you use GUISetState in your code. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 im still unable to make it launch it ! :(.I've tried adding anythign there, I looked at other scripts and cant manage to make it work :/ Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2015 Moderators Share Posted October 2, 2015 Rapid,Then post a short script which just includes the GUI creation section of your main script - without any code from you we are just guessing.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...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 #include <Functions\GUI.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <ImageSearch.au3> #include <GUIConstants.au3> ; Script Start - Add your code below here GUISetState(@SW_SHOW) HotKeySet("{ESC}", "Terminate") HotKeySet("{F2}", "StartProg") Global Const $sLogFile = 'log.txt' Global $hFileOpen = FileOpen($sLogFile, $FO_APPEND) Func Start() If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False EndIf EndFunc Func StartProg() While(1) ;Initialize() Start() Sleep(1000) WEnd EndFunc Func Terminate() Exit 0 EndFuncthis is the main file just for the test#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 260, 90, 635, 316) $Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25) GUICtrlSetData($Combo1, "250|300") GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25) $Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case 250 $UserSet = 250 Case 300 $UserSet = 300 EndSwitch WEndthat's the GUI file and this is the main script file Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2015 Moderators Share Posted October 2, 2015 Rapid,The GUI displays fine for me - I have adjusted the code so that you will correctly set the $UserSet variable when using the combo:#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $UserSet = "Not Set" $Form1 = GUICreate("Test", 260, 90, 635, 316) $Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25) GUICtrlSetData($Combo1, "250|300") GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25) $Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Combo1 Switch GUICtrlRead($Combo1) Case 250 $UserSet = 250 Case 300 $UserSet = 300 EndSwitch Case $Button1 MsgBox($MB_SYSTEMMODAL, "Selected", $UserSet) EndSwitch WEndNow how is this GUI supposed to fit into the first script?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...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 Well, first the GUI opens, then nothing happens, when the user clicks "start" then it starts the other script.But the problem is the main script, just wont open the GUI.I know the GUI itself will open, but I want to compile the other script and make it open the GUI. Link to comment Share on other sites More sharing options...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 Do I need to program my whole script around the GUI scripts? Like FROM the GUI script? Ive seen a program that just calls it from it's main file. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2015 Moderators Share Posted October 2, 2015 Rapid,I think I understand - does this do what you want?expandcollapse popup#include <GUIConstantsEx.au3> #include <FileConstants.au3> #include <MsgBoxConstants.au3> HotKeySet("{ESC}", "Terminate") HotKeySet("{F2}", "StartProg") Global Const $sLogFile = 'log.txt' Global $UserSet = "Not Set" While 1 Sleep(10) WEnd Func StartProg() $Form1 = GUICreate("Test", 260, 90, 635, 316) $Combo1 = GUICtrlCreateCombo("", 96, 8, 65, 25) GUICtrlSetData($Combo1, "250|300") GUICtrlSetFont($Combo1, 10, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Start", 8, 56, 75, 25) $Label1 = GUICtrlCreateLabel("User Search", 3, 8, 90, 20) GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $Combo1 Switch GUICtrlRead($Combo1) Case 250 $UserSet = 250 Case 300 $UserSet = 300 EndSwitch Case $Button1 $bReturn = Start() ; $bReturn will be True/False depending on what the function returned EndSwitch WEnd EndFunc Func Start() Local $hFileOpen = FileOpen($sLogFile, $FO_APPEND) If $hFileOpen = -1 Then MsgBox($MB_SYSTEMMODAL, "", "An error occurred whilst writing the temporary file.") Return False Else ; Do what you need here MsgBox($MB_SYSTEMMODAL, "", "Now doing something.") FileClose($hFileOpen) Return True EndIf EndFunc Func Terminate() Exit 0 EndFuncM23 Rapid 1 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...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 Yes, you got it, but I wanted to do it from a different file not to overload my main file and make it easy to read. It's not possible to set my GUI in a different file? and just call it from my main file to load? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2015 Moderators Share Posted October 2, 2015 Rapid,You can indeed put the GUI code in a different file and call it from your main script, but I would argue that this is less efficient that keeping all the code in the same script. If you are worried about having too many lines of code in the script and navigation becoming difficult then take a look at the #region keyword - you can find details in the "SciTE4AutoIt3 - Lexer feature" page within the SciTE4AutoIt3 help file. Using that you can keep large scripts under control.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...
Rapid Posted October 2, 2015 Author Share Posted October 2, 2015 I appreciate your help M23, I'll use that I guess :).Thank you for your kind and usefull help ! have a good day. Btw, is there an IRC channel or anywhere for autoit coding help? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 2, 2015 Moderators Share Posted October 2, 2015 Rapid,Glad I could help.As you can see from the above, we are pretty quick at responding when you post here., so I see no reason to do more than that.M23 Rapid 1 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...
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