Valuater Posted June 15, 2005 Share Posted June 15, 2005 heres the senerio.. While 1 $msg = GUIGet Message if $msg = $Button_1 then run(a program) .... .... Wend func find() If $Files>= 5 then return $button_1 ?????? return what ... ... EndFunc i want $button_1 to be called thx 8) Link to comment Share on other sites More sharing options...
MHz Posted June 15, 2005 Share Posted June 15, 2005 Could you expain what you are doing. These bits and pieces, do not make much sense? Is $Button_1 executing the find() function? I'm not even sure, if you need a return value? Link to comment Share on other sites More sharing options...
Valuater Posted June 15, 2005 Author Share Posted June 15, 2005 (edited) no, $button_1 is not executing the function.. $button 12 calls the function if the correct info is found in the function i want to leave the function and run/operate $button_1 hope that helps thx EDIT heres the actual function Func Toggle_Start() $Data=GUICtrlRead($Data_L1) If $Data = "Restore" Then Return $Start_1 -1 If $Data = "Adware" Then Return $msg=$Start_2 If $Data = "Spyware" Then Return $msg=$Start_3 If $Data = "AutoClean" Then Return $msg=$Start_4 If $Data = "Registry" Then Return $msg=$Start_5 If $Data = "Defrag" Then Return $msg=$Start_6 If $Data = "Full Menu" Then Return $msg=$Start_7 If $Data = "Share" Then Return $msg=$Start_8 If $Data = "Exit" Then call("Set_Exit") EndFunc I am trying to clean-up my program from a lot of this If $Msg = $tab14OK And $Set_Restore = "ok" Or $Msg = $Start_4 And $Set_Restore = "ok" Then thx Edited June 15, 2005 by Valuater Link to comment Share on other sites More sharing options...
buzz44 Posted June 15, 2005 Share Posted June 15, 2005 To me you are doing this an odd way.If $msg = $Button_1 Then Run(a program)Either put the run command into a function and call that, or call Run() explicitly each time you need to. Depending how much much code takes up what amount for certain situations you to decided what to do. If you are using Run() for then a couple times then put it in a fuction.And the info you provided is not very clear.While 1$msg = GUIGet Messageif $msg = $Button_1 then run(a program)Wendfunc find()If $Files>= 5 then return $button_1Â Â ?????? return whatEndFunc<{POST_SNAPBACK}>Return? Why would you need to return anything? Why not just go...Func Find() If $Files >= 5 Then Run(a program) EndFuncOr call the function of you created one.And then...no, $button_1 is not executing the function..$button 12 calls the functionEDIT heres the actual functionFunc Toggle_Start() $Data=GUICtrlRead($Data_L1) If $Data = "Restore" Then Return $Start_1 -1 If $Data = "Adware" Then Return $msg=$Start_2 If $Data = "Spyware" Then Return $msg=$Start_3 If $Data = "AutoClean" Then Return $msg=$Start_4 If $Data = "Registry" Then Return $msg=$Start_5 If $Data = "Defrag" Then Return $msg=$Start_6 If $Data = "Full Menu" Then Return $msg=$Start_7 If $Data = "Share" Then Return $msg=$Start_8 If $Data = "Exit" Then call("Set_Exit")EndFunc<{POST_SNAPBACK}>Button12? Typo? Then you provide 'the actual function', giving a function called Toggle_Start(), when in your first post its Find() and has totally different coding. Please explain... qq Link to comment Share on other sites More sharing options...
Valuater Posted June 15, 2005 Author Share Posted June 15, 2005 (edited) @ MHz and @Burrup When I reviewed my first post, I realize that my scenario/example was explained so poorly and improperly that I should be thankful anyone would take the time to respond. For this, I thank you both. In my second effort, the explanation was at best vague. The funny part is, I write nearly 500 appraisal reports for lending institutions valuating over $300,000,000 annually in Real Estate for a living. With my recent posts on this board, that would seem difficult to comprehend. Again, simply responding for clarification was appreciated. In the future I will make an effort to be clearer. **************** @ All Please remember my first post was a poorly constructed example/scenario. This is my actual "$button_1" EXAMPLE A ; controls Restore Point If $Msg = $tab11OK Or $Msg = $Start_1 Then If $Msg= $Start_1 Then SoundPlay($Sound_clk) If $Full = "show" Then WinSetState($MAIN, "", @SW_MINIMIZE); Stops you from changing anything If FileExists(@SystemDir & "\restore\rstrui.exe") Then TraySetState (@SW_TRAYFLASH) MsgBox(64, "* NOTE * ", "Please close all open Programs", 5) TrayTip("If Possible, close some of these Programs", " **But not this one** ", 5, 1) Sleep(2000) TraySetState (@SW_TRAYNOFLASH) $PID = Run(@SystemDir & "\restore\rstrui.exe") WinWaitActive("") Call("Cycle") _FileWriteLog(@WindowsDir & "\XPClean.log", "Restore Point Initialized") $Set_Restore = "ok" If $Full = "show" Then GUISwitch($MAIN) Else MsgBox(64, "Sorry! ", "This Win XP Program - was not found", 8) EndIf If $Full = "show" Then WinSetState($header, "", @SW_RESTORE); This turns the window back on $begin = TimerInit() EndIf Until now, this button was "executed" from two buttons. Now I would like to include a third "execute" from the function below. EXAMPLE B Func Toggle_Start() $Data=GUICtrlRead($Data_L1) If $Data = "Restore" Then Return $Start_1 -1 If $Data = "Adware" Then Return $msg=$Start_2 If $Data = "Spyware" Then Return $msg=$Start_3 If $Data = "AutoClean" Then Return $msg=$Start_4 If $Data = "Registry" Then Return $msg=$Start_5 If $Data = "Defrag" Then Return $msg=$Start_6 If $Data = "Full Menu" Then Return $msg=$Start_7 If $Data = "Share" Then Return $msg=$Start_8 If $Data = "Exit" Then call("Set_Exit") EndFunc I would like to "execute" the remaining buttons in this function in a similar manor. Most of these buttons are "executed" only once from one location. All are included in the "While 1" loop. In the past I have placed a $variable to carry this "execute" to the button I am requesting, for example using Example B line 2 EXAMPLE C If $Data = "Restore" Then $ST1="go" ;>>> this is the added $Variable Return Endif If I add the $Variable in Example C, then I need to add a similar $Variable to each desired "execute" within the function Example B, Then I need to add the $Variable to the button that has been requested, for example using Example A with this $Variable in line 1 ($ST1="go") EXAMPLE D If $Msg = $tab11OK Or $Msg = $Start_1 Or $ST1="go" Then Then stop the "execute" inside Example A with $ST1="". This process would be necessary for each of the "execute" requests in Example B. I thought I had seen a similar scenario recently in a post that stated (this is not a quote) something like If not $Button1 then $Button1 I was just searching for an answer that would allow the "execute" requests from the function in Example B without 1. Moving each of the buttons from the "GetMessage loop" into functions and 2. Additional $Variables as noted in Example C and Example D to each button I realize this is a difficult question and I believe I have explained it in layman's terms. Thanks for you response 8) Edited June 15, 2005 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted June 16, 2005 Author Share Posted June 16, 2005 I C 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