John117 Posted December 11, 2007 Share Posted December 11, 2007 (edited) Can this be done? -please dont ask what I am trying to do here. This is a reproducer intended to only prove a concept critical to my actual code. I am trying to get rid of 4 large functions where the only difference is a '+' or '-' expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) HotKeySet("{ESC}", "_Custom_Exit") HotKeySet("{LEFT}", "_left") HotKeySet("{RIGHT}", "_right") $gui = GUICreate("",@DesktopWidth,40,"", "", $WS_POPUPWINDOW) GUISetState(@SW_SHOW, $gui) ; ============================================================================ ; Main Loop ; ============================================================================ While 1 sleep(10) WEnd ; ============================================================================ ; Functions ; ============================================================================ Func _right() Global $sign = '+' _Example() EndFunc Func _Left() Global $ign = '-' _Example() EndFunc Func _Example() MsgBox(0, "Example = 9", 4 + 5) MsgBox(0, "Example = -1", 4 - 5) MsgBox(0, "Example = Right or left sign option", 4 $sign 5) EndFunc ; ============================================================================ ; Functions ; ============================================================================ func _Custom_Exit() Exit EndFunc ;==> _exit() Edited December 11, 2007 by Hatcheda Link to comment Share on other sites More sharing options...
weaponx Posted December 11, 2007 Share Posted December 11, 2007 (edited) MsgBox(0, "Example = Right or left sign option", Execute("4" & $sign & "5")) - or - MsgBox(0, "Example = Right or left sign option", Execute(String(4 & $sign & 5))) Edited December 11, 2007 by weaponx Link to comment Share on other sites More sharing options...
John117 Posted December 11, 2007 Author Share Posted December 11, 2007 MsgBox(0, "Example = Right or left sign option", Execute("4" & $sign & "5"))- or -MsgBox(0, "Example = Right or left sign option", Execute(String(4 & $sign & 5)))Perfect! 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