GEOSoft Posted March 21, 2007 Share Posted March 21, 2007 The format for TraySetOnEvent is (Event, "Function") Can I pass a parameter to "Function"? For example TraySetOnEvent(@SW_Hide,"_HideWindow($Window)") George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
nitekram Posted March 21, 2007 Share Posted March 21, 2007 (edited) The format for TraySetOnEvent is (Event, "Function")Can I pass a parameter to "Function"?For exampleTraySetOnEvent(@SW_Hide,"_HideWindow($Window)")No. On any of the event types - though it would be nice.Edit - thought should be though - and also there are examples of this being done with a dummy function with a case or ifelse to work with conditions - and your variables will have to be global (think that is right). Edited March 21, 2007 by nitekram 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator Link to comment Share on other sites More sharing options...
xcal Posted March 21, 2007 Share Posted March 21, 2007 You could just get $window inside the function so you wouldn't need to pass a parameter. Maybe you need to explain better if that won't work for you. How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
GEOSoft Posted March 22, 2007 Author Share Posted March 22, 2007 You could just get $window inside the function so you wouldn't need to pass a parameter. Maybe you need to explain better if that won't work for you.I think What 'I'll have to do is store the name of $Window in variable and because there are 2 functions to be called I'll create another Func that passes the parameter to the proper function. I was just thinking that being able to pass a parameter (or parameters) in the onEvent would make things really simple.Oh well............. George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
LondonNDIB Posted May 8, 2007 Share Posted May 8, 2007 It would! And storing/retrieving the variable means blurring the lines between global and local scopes - you shouldn't have to do that for something this simple. How many times does it need to be suggested before it gets considered? Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 8, 2007 Share Posted May 8, 2007 It would! And storing/retrieving the variable means blurring the lines between global and local scopes - you shouldn't have to do that for something this simple. How many times does it need to be suggested before it gets considered? I think you are wrong. Whatever is set for any *SetOnEvent() is by nature Global because it is a single globally unique instance for that Gui/Ctrl/TrayItem that the event is set for. You can't define a SetOnEvent in one local scope and have the same one defined diferently in another local scope. The second time you call *SetOnEvent() for the same item you either replace or delete the settings. So there is no "local" scope to OnEvent settings. That being the case, any time you set up any *SetOnEvent() settings, keep anything you want the defined function to have access to in Globally accessible places (macros, and Global vars). You lose no functionality at all. An example I posted in another thread: What would you pass to the OnEvent function that the called function wouldn't have access to anyway? If you could do something like this: TrayItemSetOnEvent($ItemID, _MyTrayFunc($var1, 0x1A2B, $var2)) Func _MyTrayFunc($Input1, $Input2, $Input3) ; ... EndFuncoÝ÷ Ùhrr¥v}ý·*.ë-jDz)rv)¶¬jëh×6TrayItemSetOnEvent($ItemID, "_MyTrayFunc") Func _MyTrayFunc() Local $Input1 = $var1 Local $Input2 = 0x1A2B Local $Input3 = $var2 ; ... EndFunc ;==>_MyTrayFunc Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Developers Jos Posted May 8, 2007 Developers Share Posted May 8, 2007 Folks, Shall we do this discussion in the other thread ... makes it easier to discuss .. 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...
LondonNDIB Posted May 8, 2007 Share Posted May 8, 2007 And in that other thread, I refuted why that example wouldn't work... or at least is terribly inefficient for anyone that actually needs parameters for that function. Calling the variables/parameters inside the function brings into question why would have functions at all. The whole POINT of having functions is so that we can call them multiple times depending on various circumstances/settings/PARAMETERS and have them act differently based on them. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 8, 2007 Developers Share Posted May 8, 2007 read it and post your answer there .. 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...
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