AutoHotkey Community

It is currently May 26th, 2012, 9:16 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 

DO WANT!?
YESH!
NESH!
DO NOT KNOW?
TITS OR GTFO!
You may select 1 option

View results
Author Message
 Post subject: #Debug + OutputDebug
PostPosted: July 27th, 2009, 8:02 pm 
Offline

Joined: January 12th, 2008, 7:45 pm
Posts: 131
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...

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2009, 12:42 pm 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2009, 9:55 pm 
Offline

Joined: January 12th, 2008, 7:45 pm
Posts: 131
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'...

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2009, 11:29 pm 
Offline

Joined: October 1st, 2005, 9:55 pm
Posts: 775
Location: Texas, USA
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2009, 8:03 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
OP:
Code:
OutputDebug, This might do something.
NOP:
Code:
;OutputDebug, This won't do anything...
:?:
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


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 5 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group