AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

#Debug + OutputDebug

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  

DO WANT!?
YESH!
57%
 57%  [ 4 ]
NESH!
14%
 14%  [ 1 ]
DO NOT KNOW?
0%
 0%  [ 0 ]
TITS OR GTFO!
28%
 28%  [ 2 ]
Total Votes : 7

Author Message
Ice_Tea



Joined: 12 Jan 2008
Posts: 131

PostPosted: Mon Jul 27, 2009 7:02 pm    Post subject: #Debug + OutputDebug Reply with quote

Hey, just got a great idea, since BigVent gave tips to new ppl.

He mentioned that one could put Msgbox all over the code to tell what's happening, and i recommended outputdebug as it isn't super duper important that you remove it afterwards. and it's also simple to remove later as you could use Search and Replace functions that a lot of text editors has, to comment out the outputdebug lines...

So i thought why not go further:

Code:
#Debug 1
OutputDebug, Yaye this text will appear


Code:
#Debug 0
OutputDebug, OH LAWD WHAT HAVE YOU DONE ;will not appear


Basically, before the script executes, it will decide whether or not it should include those outputdebug lines

Also, optionally you could add a DbgMsgbox
for ppl who prefer that box popping up...
;sry couldn't bother with writing a 'proper' post, very sorry if I'm doing it wrong...
_________________
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Wed Jul 29, 2009 11:42 am    Post subject: Reply with quote

If you don't have a program running, listening for debug messages, OutputDebug won't do anything. Furthermore, it is easy to write a wrapper function which calls OutputDebug/MsgBox if a global flag is set, and does nothing otherwise. There is no need for a "#Debug" directive.
Back to top
View user's profile Send private message Visit poster's website
Ice_Tea



Joined: 12 Jan 2008
Posts: 131

PostPosted: Wed Jul 29, 2009 8:55 pm    Post subject: Reply with quote

Lexikos wrote:
If you don't have a program running, listening for debug messages, OutputDebug won't do anything. Furthermore, it is easy to write a wrapper function which calls OutputDebug/MsgBox if a global flag is set, and does nothing otherwise. There is no need for a "#Debug" directive.


Yeah, that may be true... Maybe, some day, I will write a script to do the search and replace stuff <_<... Kinda wanted all this to be processed before the script launches, so that there isn't any 'unnecessary slowdown'...
_________________
Back to top
View user's profile Send private message
jballi



Joined: 01 Oct 2005
Posts: 748
Location: Texas, USA

PostPosted: Wed Jul 29, 2009 10:29 pm    Post subject: Reply with quote

Ice_Tea wrote:
Maybe, some day, I will write a script to do the search and replace stuff <_<... Kinda wanted all this to be processed before the script launches, so that there isn't any 'unnecessary slowdown'...

I had the same idea a many moons back. That's why I put in a request for a new NOP (No operation) command. No one was interested. My idea, similar to yours, was to do a mass replace of the outputdebug command with NOP before moving the script to production. Leaving the NOP commands in the script makes it very easy to reverse the search/replace and it keeps the script line numbers intact for debugging.

Oh well. C'est la vie.
Back to top
View user's profile Send private message Send e-mail
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Thu Jul 30, 2009 7:03 am    Post subject: Reply with quote

OP:
Code:
OutputDebug, This might do something.
NOP:
Code:
;OutputDebug, This won't do anything...
Question
Quote:
Kinda wanted all this to be processed before the script launches, so that there isn't any 'unnecessary slowdown'...
It is negligible.
jballi wrote:
In my tests, I was able to perform 10,000 iterations of OutputDebug in 306 ms.
Source: Question for the experts: OutputDebug overhead
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group