Mbee Posted July 27, 2019 Share Posted July 27, 2019 (edited) I certainly accept the wisdom that holds that the Assign statement should be avoided like, say, Cobol, but I don't have a choice -- it is forced upon me. You see, the graphical debugger is rather limited, and so I'm using DBUG instead, which has many benefits (though it has the enormous downside such that the "documentation" doesn't at all deserve the name). Anyway, here's why its forced upon me: I have need of a $WM_NOTIFY message handler in my script, but DBUG uses it extensively, so that if a script also needs to handle that message, you have to let DBUG know. The mechanism the developer chose was to use the Assign statement to set the variable "dbg_NotifyFunc" to the user's handler. Unfortunately, this still seems to interfere with DBUG because whenever my function is invoked, the script stops and a warning page comes up telling me to assign "dbg_NotifyFunc"... I think! It's very confusing. Here's what the message/Help file (which is essentially no help whatsoever) states on this point: Quote 4. Processing GUIRegisterMsg WM_NOTIFY and WM_COMMAND hook to prevent interference with possible message handlers. To automatically hook WM_NOTIFY messages GUIRegisterMsg function the first parameter must be specified by a constant $WM_NOTIFY, but the function itself is located in the current script. If these conditions are not met, it is possible to replace the function GUIRegisterMsg following code ("MY_WM_NOTIFY" - as an example): If IsDeclared("dbg_NotifyFunc") Then Assign("dbg_NotifyFunc", "MY_WM_NOTIFY") Else GUIRegisterMsg(0x004E, "MY_WM_NOTIFY") EndIf or during the debugging execute the command ("MY_WM_NOTIFY" - as an example): $dbg_NotifyFunc = "MY_WM_NOTIFY" Huh? WTF? Why would I want to "automatically" hook WM_NOTIFY? What does that even mean? The best I could figure is as I described above -- a method to allow DBUG to register $WM_NOTIFY for itself, and after processing it internally, it invokes the user function. Does anyone have a better grasp of what that's trying to say? (part of the problem may be that perhaps English is a second language for the writer). Anyway, back to the issue at hand. It seems to me that if I can DE-assign that variable during the majority of the code where I have no need to capture WM_NOTIFY messages, my debugging sessions will not be interrupted as often as they are now. Thus the question of my OP: Is there any way to de-assign a variable? Thanks! Edited July 27, 2019 by Mbee Link to comment Share on other sites More sharing options...
water Posted July 28, 2019 Share Posted July 28, 2019 Would assigning space, zero or NULL help to DE-assign the variable? Mbee 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Mbee Posted July 28, 2019 Author Share Posted July 28, 2019 36 minutes ago, water said: Would assigning space, zero or NULL help to DE-assign the variable? I'll give it a try. Thanks! Link to comment Share on other sites More sharing options...
Gianni Posted July 28, 2019 Share Posted July 28, 2019 https://www.autoitscript.com/trac/autoit/ticket/581 Mbee 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
Mbee Posted July 28, 2019 Author Share Posted July 28, 2019 8 hours ago, Chimp said: https://www.autoitscript.com/trac/autoit/ticket/581 Thank you very much, wise Chimp! Now I don't have to spend more time trying to find a way to do this. And your link is more on point than my OP, since I actually needed to De-declare rather than De-assign. I'll have to use my logging function rather than DBUG. 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