RyanOlson Posted October 10, 2008 Posted October 10, 2008 (edited) Ok I have 2 working guis one for a eula and password and one for the program. My problem how do I get the eula to launch the program gui in the same script if possible so I dont have 2 separate program. and just one long script. expandcollapse popup#include <GUIConstants.au3> $picpath = @WindowsDir & "\dir\eula.jpg" FileInstall("C:\Autoit files\Power settings\eula.jpg", @WindowsDir & "\dir\") $Form1 = GUICreate("User Agreement", 486, 311, 193, 125) ;~ GUICtrlSetState(-1, $GUI_SHOW) $Pic = GUICtrlCreatePic($picpath, 0, 0, 481, 241) ;~ GUICtrlSetState(-1, $GUI_DISABLE) ;~ $picpath = @WindowsDir & "\GreenPcTech\greenpc.jpg" ;~ FileInstall("C:\Autoit files\Power settings\greenpc.jpg", @WindowsDir & "\dir\") ;~ GUICtrlSetState(-1, $GUI_SHOW) ;~ $Form1 = GUICreate("User Agreement", 486, 311, 193, 125) ;~ $Pic = GUICtrlCreatePic($picpath, 0, 0, 481, 241) ;~ GUICtrlSetState(-1, $GUI_DISABLE) $enterkey = GUICtrlCreateInput("Enter your key here.", 8, 248, 105, 21) $Ok = GUICtrlCreateButton("Ok", 8, 280, 75, 25, 0) $Cancel = GUICtrlCreateButton("Cancel", 88, 280, 75, 25, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $Ok If $enterkey = "green" Then $Form1_1 Else MsgBox(0, "Invalid", "Password Invalid. Try Again.") Exit EndIf EndSelect Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $Cancel Exit EndSelect DirCreate(EnvGet("windir") & "\dir\") $win = @OSVersion $picpath = @WindowsDir & "\dir\greenpc.jpg" FileInstall("C:\Autoit files\Power settings\greenpc.jpg", @WindowsDir & "\dir\") $Form1_1 = GUICreate("", 632, 550, 193, 122) GUICtrlSetState(-1, $GUI_SHOW) $Pic = GUICtrlCreatePic($picpath, 0, 0, 633, 465) GUICtrlSetState(-1, $GUI_DISABLE) EndSwitch WEnd getting these errors C:\Autoit files\Power settings\eula.au3(38,15) : ERROR: syntax error $Form1_1 ~~~~~~~~^ C:\Autoit files\Power settings\eula.au3(40,6) : ERROR: missing EndSelect. Else ^ C:\Autoit files\Power settings\eula.au3(37,33) : REF: missing EndSelect. If $enterkey = "green" Then ~~~~~~~~~~~~~~~~~~~~~~~~~~~^ C:\Autoit files\Power settings\eula.au3(40,6) : ERROR: missing EndSwitch. Else ^ C:\Autoit files\Power settings\eula.au3(33,10) : REF: missing EndSwitch. Select ~~~~~~^ C:\Autoit files\Power settings\eula.au3(40,6) : ERROR: missing Wend. Else ^ C:\Autoit files\Power settings\eula.au3(30,14) : REF: missing Wend. Switch $nMsg ~~~~~~~~~~~~^ C:\Autoit files\Power settings\eula.au3 - 4 error(s), 0 warning(s) Any help is very much appreciated since I am still learning this too. Edited October 10, 2008 by RyanOlson
Bert Posted October 10, 2008 Posted October 10, 2008 I'm trying to make out what you are trying to do, but your code is a mess. (No offense) Give me a few minutes, and I'll come up with what you need. The Vollatran project My blog: http://www.vollysinterestingshit.com/
RyanOlson Posted October 10, 2008 Author Posted October 10, 2008 I know it is a mess it's all test just trying to get it working.
martin Posted October 10, 2008 Posted October 10, 2008 That's a bit of a mess! Well, actually, a lot of a mess. Maybe this will help expandcollapse popup#include <GUIConstants.au3> ;$picpath = @WindowsDir & "\dir\eula.jpg" ;FileInstall("C:\Autoit files\Power settings\eula.jpg", @WindowsDir & "\dir\") $Form1 = GUICreate("User Agreement", 486, 311, 193, 125) ;$Pic = GUICtrlCreatePic($picpath, 0, 0, 481, 241) ;~ GUICtrlSetState(-1, $GUI_DISABLE) ;~ $picpath = @WindowsDir & "\GreenPcTech\greenpc.jpg" ;~ FileInstall("C:\Autoit files\Power settings\greenpc.jpg", @WindowsDir & "\dir\") $enterkey = GUICtrlCreateInput("Enter your key here.", 8, 248, 105, 21) $Ok = GUICtrlCreateButton("Ok", 8, 280, 75, 25, 0) $Cancel = GUICtrlCreateButton("Cancel", 88, 280, 75, 25, 0) GUISetState(@SW_SHOW) Global $proceed = false While Not $proceed $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Ok ;this is how you read tyhe contents of the edit If GUICtrlRead($enterkey) = "green" Then $proceed = true Else MsgBox(0, "Invalid", "Password Invalid. Try Again.") ;Exit can't try again if you exit EndIf Case $Cancel Exit EndSwitch WEnd GUIDelete($Form1) ;DirCreate(EnvGet("windir") & "\dir\") ;$win = @OSVersion ;$picpath = @WindowsDir & "\dir\greenpc.jpg" ;FileInstall("C:\Autoit files\Power settings\greenpc.jpg", @WindowsDir & "\dir\") $Form1_1 = GUICreate("Main form", 632, 550, 193, 122) ;$Pic = GUICtrlCreatePic($picpath, 0, 0, 633, 465) GUISetState() while 1 $msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Bert Posted October 10, 2008 Posted October 10, 2008 Here you are. Try this and see if this does what you need expandcollapse popup#include <GUIConstants.au3> $picpath = @WindowsDir & "\dir\eula.jpg" FileInstall("C:\Autoit files\Power settings\eula.jpg", @WindowsDir & "\dir\") $Form1 = GUICreate("User Agreement", 486, 311, 193, 125) $enterkey = GUICtrlCreateInput("Enter your key here.", 8, 248, 105, 21) $Ok = GUICtrlCreateButton("Ok", 8, 280, 75, 25, 0) $Cancel = GUICtrlCreateButton("Cancel", 88, 280, 75, 25, 0) GUISetState(@SW_SHOW,$Form1 ) While 1 $nMsg = GUIGetMsg() Select Case $nMsg = $GUI_EVENT_CLOSE ExitLoop Case $nMsg = $Ok $text = GUICtrlRead($enterkey) If $text = "green" Then _Form1_1() Else MsgBox(0, "Invalid", "Password Invalid. Try Again.") EndIf EndSelect WEnd func _Form1_1() GUISetState(@SW_HIDE,$Form1 ) $Form2 = GUICreate("User Agreement", 486, 311, 193, 125) $Pic = GUICtrlCreatePic($picpath, 0, 0, 481, 241) $yes_check = GUICtrlCreateCheckbox("Accept", 20, 280, 50, 22) $continue_button = GUICtrlCreateButton("Install", 100, 275, 50, 30) $cancel = GUICtrlCreateButton("Cancel", 170, 275, 50, 30) GUICtrlSetState($continue_button, $GUI_DISABLE) GUISetState(@SW_SHOW,$Form2 ) while 1 $nMsg2 = GUIGetMsg() select Case $nMsg2 = $GUI_EVENT_CLOSE or $nMsg2 = $Cancel GUIDelete($Form2) GUISetState(@SW_SHOW,$Form1 ) guictrlsetdata($enterkey, "") ExitLoop Case $nMsg2 = $yes_check $check_state_of_checkbox = GUICtrlRead($yes_check) if $check_state_of_checkbox = $GUI_CHECKED then GUICtrlSetState($continue_button, $GUI_ENABLE) if $check_state_of_checkbox = $GUI_UNCHECKED then GUICtrlSetState($continue_button, $GUI_DISABLE) Case $nMsg2 = $continue_button GUIDelete($Form2) MsgBox(0, "", "Software will install") exit EndSelect wend EndFunc ;~ ;~ DirCreate(EnvGet("windir") & "\dir\") ;~ $win = @OSVersion ;~ $picpath = @WindowsDir & "\dir\greenpc.jpg" ;~ FileInstall("C:\Autoit files\Power settings\greenpc.jpg", @WindowsDir & "\dir\") ;~ $Form1_1 = GUICreate("", 632, 550, 193, 122) ;~ GUICtrlSetState(-1, $GUI_SHOW) ;~ $Pic = GUICtrlCreatePic($picpath, 0, 0, 633, 465) ;~ GUICtrlSetState(-1, $GUI_DISABLE) The Vollatran project My blog: http://www.vollysinterestingshit.com/
RyanOlson Posted October 10, 2008 Author Posted October 10, 2008 Thanks guys I decided just to run another exe file once they have the password in it just cleans things up and simplifys it. Thanks for the help once again.
TehWhale Posted October 10, 2008 Posted October 10, 2008 Hello, It appears you have found your answer to your question. Please take the time to edit your thread title with [RESOLVED] so others know that is it resolved. You can do this by scrolling to the top of your thread, clicking EDIT and then Full Edit and adding: "[RESOLVED]" to the front of your thread title. Thanks for your cooperation.
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