Markir Posted March 22, 2005 Share Posted March 22, 2005 (edited) 123 Edited March 29, 2012 by Markir Link to comment Share on other sites More sharing options...
Valuater Posted March 24, 2005 Share Posted March 24, 2005 Hello everybody,I have the following script in a new program to at the work the function. Now it works and I would integrated it in my big project, but then it doesn't work :-(Here is the code from the standalone program. And the file in the attachment is my project...expandcollapse popup#include <guiconstants.au3> Global $input_mailserver="", $input_dnsmailserver, $input_lotusnotesuser, $input_lotusnotesdomain Global $input_xpressionsdomain, $input_faxg3alias, $input_faxg4alias, $input_faxg3revalias, $input_smsalias Global $input_dnsmailserver="", $input_lotusnotesuser="", $input_lotusnotesdomain="", $input_xpressionsdomain="" Global $input_faxg3alias="", $input_faxg4alias="", $input_faxg3revalias="", $input_smsalias="" Global $file_mailserver="", $file_dnsmailserver="", $file_lotusnotesuser="", $file_lotusnotesdomain="", $file_xpressionsdomain="" Global $file_faxg3alias="", $file_faxg4alias="", $file_faxg3revalias, $file_smsalias="" opt("GUICoordMode",0) GUICreate("test") GUICtrlCreateLabel("Mail Server", 10, 25, 100, 20) $input_mailserver = GUICtrlCreateCombo("", 100, 0, 120,80,$CBS_DROPDOWNLIST) GUICtrlSetData(-1, " |Exchange 5.5|Exchange 2000|Exchange 2003|Lotus Notes 5|Lotus Notes 6|Lotus Notes 6.5", $file_mailserver) GUICtrlCreateLabel("Name Mail-Server", -100, 25, 100, 20) $input_dnsmailserver = GUICtrlCreateInput($file_dnsmailserver, 100, 0, 120) GUICtrlCreateLabel("Lotus Notes User", -100, 25, 100, 20) $input_lotusnotesuser = GUICtrlCreateInput($file_lotusnotesuser, 100, 0, 120) GUICtrlCreateLabel("Lotus Notes Domain", -100, 25, 100, 20) $input_lotusnotesdomain = GUICtrlCreateInput($file_lotusnotesdomain, 100, 0, 120) GUICtrlCreateLabel("XPressions Domain", -100, 25, 100, 20) $input_xpressionsdomain = GUICtrlCreateInput($file_xpressionsdomain, 100, 0, 120) GUICtrlCreateLabel("FaxG3 Alias", -100, 25, 100, 20) $input_faxg3alias = GUICtrlCreateInput($file_faxg3alias, 100, 0, 120) GUICtrlCreateLabel("FaxG4 Alias", -100, 25, 100, 20) $input_faxg4alias = GUICtrlCreateInput($file_faxg4alias, 100, 0, 120) GUICtrlCreateLabel("FaxG3Rev Alias", -100, 25, 100, 20) $input_faxg3revalias = GUICtrlCreateInput($file_faxg3revalias, 100, 0, 120) GUICtrlCreateLabel("SMS Alias", -100, 25, 100, 20) $input_smsalias = GUICtrlCreateInput($file_smsalias, 100, 0, 120) SetState($file_mailserver) GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $input_mailserver Then SetState(GUICtrlRead($input_mailserver)) EndIf WEnd ; Func SetState($selected) If $selected = ("Exchange 2000") Then $ExchangeServer = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PP-COM\MRS\ExchAPL","Exchange Server") GUICtrlSetData($input_dnsmailserver, $ExchangeServer) Else If $selected = ("Exchange 2003") Then $ExchangeServer = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\PP-COM\MRS\ExchAPL","Exchange Server") GUICtrlSetData($input_dnsmailserver, $ExchangeServer) Else GUICtrlSetData($input_dnsmailserver, "") EndIf EndIf If $selected = ("Lotus Notes 5") Then $setstate = $GUI_ENABLE Else $setstate = $GUI_DISABLE If $selected = ("Lotus Notes 6") Then $setstate = $GUI_ENABLE Else $setstate = $GUI_DISABLE If $selected = ("Lotus Notes 6.5") Then $setstate = $GUI_ENABLE Else $setstate = $GUI_DISABLE EndIf EndIf EndIf GUICtrlSetState($input_dnsmailserver, $setstate) GUICtrlSetState($input_lotusnotesuser, $setstate) GUICtrlSetState($input_lotusnotesdomain, $setstate) GUICtrlSetState($input_xpressionsdomain, $setstate) GUICtrlSetState($input_faxg3alias, $setstate) GUICtrlSetState($input_faxg4alias, $setstate) GUICtrlSetState($input_faxg3revalias, $setstate) GUICtrlSetState($input_smsalias, $setstate) EndFunc;==>SetState<{POST_SNAPBACK}>simple wisdom from a simple mind......... try this ideaexpandcollapse popup; setup main gui, buttons etc #include <GUIConstants.au3> Dim $GUIWidth, $GUIHeight $Edit_info="" $GUIWidth = @DesktopWidth /2 $GUIHeight = @DesktopHeight /2 $My_win = GUICreate("*My GUI Window",$GUIWidth, $GUIHeight,-1,-1,-1,-1) $Edit_1 = GUICtrlCreateEdit("", 10, 40, 480, 300) GUICtrlSetState($Edit_1,0) $_OK = GUICtrlCreateButton("OK", 210, 350, 70, 25) ; Show the GUI GUISetState(@SW_SHOW,$My_win) ; will display the dialog box ; loop for response while 1 $Msg = GuiGetMsg() If $Msg = $GUI_EVENT_CLOSE then Exit If $Msg= $_OK then Call ("do_job") ; calls the function......... this is what you should do.... i think WEnd ;------------------------ end of programs - begin function calls-------------------------------------------- Func do_job() $Edit_info="Hey, " & @CRLF & @CRLF & "i returned info from a function call" & @CRLF & @CRLF & "Enjoy!" GUICtrlSetData($Edit_1, $Edit_info) EndFunchope it helps, good luck Link to comment Share on other sites More sharing options...
Valuater Posted March 24, 2005 Share Posted March 24, 2005 (edited) Now we can place your secondary program in a child window try this... expandcollapse popup; setup main gui, buttons etc #include <GUIConstants.au3> Dim $GUIWidth, $GUIHeight $Edit_info="This is my secondary program" $GUIWidth = @DesktopWidth /2 $GUIHeight = @DesktopHeight /2 $My_win = GUICreate("*My GUI Window",$GUIWidth, $GUIHeight,-1,-1,-1,-1) GUICtrlCreateLabel ("This is my MAIN program", 65,105,260,25) $_OK = GUICtrlCreateButton("OK", 210, 350, 70, 25) ; Show the GUI GUISetState(@SW_SHOW,$My_win) ; will display the dialog box ; loop for response Do $Msg = GuiGetMsg() If $Msg = $GUI_EVENT_CLOSE then Exit If $Msg= $_OK then GuiSetState(@SW_HIDE,$My_win); Stops you from changing anything $My_child = GUICreate("*My GUI Window",$GUIWidth, $GUIHeight,-1,-1,-1,-1,$My_win); start secondary program $Edit_1 = GUICtrlCreateEdit($Edit_info, 10, 40, 480, 300) GUICtrlSetState($Edit_1,0) $_OK2 = GUICtrlCreateButton("OK", 210, 350, 70, 25) ; Show the child GUI............................... shows secondary program GUISetState(@SW_SHOW,$My_child) ; will display the dialog box - as a child window While 1 $Msg2 = GuiGetMsg() If $Msg2 = $GUI_EVENT_CLOSE then GuiSetState(@SW_HIDE,$My_child) GuiSetState(@SW_RESTORE,$My_win) ExitLoop EndIf If $Msg2= $_OK2 then Call ("do_job"); calls the function......... this is what you should do WEnd EndIf Until $Msg = $GUI_EVENT_CLOSE ;------------------------ end of programs - begin function calls-------------------------------------------- Func do_job() $Edit_info="Hey, " & @CRLF & @CRLF & "i returned info from a function call" & @CRLF & @CRLF & "Enjoy!" GUICtrlSetData($Edit_1, $Edit_info) EndFunc hope this will do it... good luck Edited March 24, 2005 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted March 24, 2005 Share Posted March 24, 2005 lastly, if you plan on using the secondary program multiple times... try this expandcollapse popup; setup main gui, buttons etc #include <GUIConstants.au3> Dim $GUIWidth, $GUIHeight $Edit_info1="This is my secondary program" $GUIWidth = @DesktopWidth /2 $GUIHeight = @DesktopHeight /2 $My_win = GUICreate("*My GUI Window",$GUIWidth, $GUIHeight,-1,-1,-1,-1) GUICtrlCreateLabel ("This is my MAIN program", 65,105,260,25) $_OK = GUICtrlCreateButton("OK", 210, 350, 70, 25) ; Show the GUI GUISetState(@SW_SHOW,$My_win) ; will display the dialog box ; loop for response Do $Msg = GuiGetMsg() If $Msg = $GUI_EVENT_CLOSE then Exit If $Msg= $_OK then if WinExists("$My_child") Then GuiSetState(@SW_HIDE,$My_win) GuiSetState(@SW_RESTORE,$My_child) GUICtrlSetData($Edit_1, $Edit_info1) Else GuiSetState(@SW_HIDE,$My_win); Stops you from changing anything $My_child = GUICreate("*My GUI Window",$GUIWidth, $GUIHeight,-1,-1,-1,-1,$My_win); start secondary program $Edit_1 = GUICtrlCreateEdit($Edit_info1, 10, 40, 480, 300) GUICtrlSetState($Edit_1,0) $_OK2 = GUICtrlCreateButton("OK", 210, 350, 70, 25) ; Show the child GUI............................... shows secondary program GUISetState(@SW_SHOW,$My_child) ; will display the dialog box - as a child window While 1 $Msg2 = GuiGetMsg() If $Msg2 = $GUI_EVENT_CLOSE then GuiSetState(@SW_HIDE,$My_child) GuiSetState(@SW_RESTORE,$My_win) ExitLoop EndIf If $Msg2= $_OK2 then Call ("do_job") ; calls the function......... this is what you should do WEnd EndIf EndIf Until $Msg = $GUI_EVENT_CLOSE ;------------------------ end of programs - begin function calls-------------------------------------------- Func do_job() $Edit_info2="Hey, " & @CRLF & @CRLF & "i returned info from a function call" & @CRLF & @CRLF & "Enjoy!" GUICtrlSetData($Edit_1, $Edit_info2) EndFunc ok.... thats it for me 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