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 

"Step Through" an AHK Script

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
hutch@edge.net



Joined: 16 Sep 2008
Posts: 77

PostPosted: Mon Aug 24, 2009 7:31 pm    Post subject: "Step Through" an AHK Script Reply with quote

Greetings, Gurus.

Is there a built-in function or 3rd part utility that will allow you to "step through" an AHK script, like the F8 function in VBA? Or is ther another means of error checking the scripts?

Thanks in advance.
Back to top
View user's profile Send private message
jethrow



Joined: 24 May 2009
Posts: 1907
Location: Iowa, USA

PostPosted: Mon Aug 24, 2009 8:01 pm    Post subject: Reply with quote

I typically use a MsgBox to stop the code after certain lines & check results.
_________________
Very Happy - in case I forgot to smile
Basic Webpage Controls
COM Object Reference
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger
randallf



Joined: 06 Jul 2009
Posts: 678

PostPosted: Mon Aug 24, 2009 8:03 pm    Post subject: Reply with quote

Is there a way to execute code from a variable?

Could you do this with Loop, Read?

Can you just force it on a line?

% ThisLine%
Back to top
View user's profile Send private message
engunneer



Joined: 30 Aug 2005
Posts: 8255
Location: Maywood, IL

PostPosted: Mon Aug 24, 2009 8:51 pm    Post subject: Reply with quote

my internet connection isn't good enough for me to dig up links, but useful search terms:

run AHK dynamically with pipes
autohotkey.dll
Lexikos' custom ahk build AutohotkeyL
Autohotkey terminal


Also, many built-in tools are sufficient: msgbox, tooltip, listvars, pause, listlines, etc.
_________________

(Common Answers)
Back to top
View user's profile Send private message Visit poster's website
hutch@edge.net



Joined: 16 Sep 2008
Posts: 77

PostPosted: Mon Aug 24, 2009 10:20 pm    Post subject: Reply with quote

Thanks for the response, guys. My previous searches on error checking and step into/trhough didn't turn up anything useful. I'll try the terms you suggested.

Have a good one.
Back to top
View user's profile Send private message
Leef_me



Joined: 08 Apr 2009
Posts: 5334
Location: San Diego, California

PostPosted: Mon Aug 24, 2009 10:54 pm    Post subject: Reply with quote

@hutch@edge.net
search for 'OutputDebug' in the helpfile for other ideas

Edit: poor design in original, useless way to report line number

Code:
; add the debug = 1  line to force the 'breakpoint'
debug=1 ;
if (debug=1) debugger("test",A_LineNumber)

Code:
; insert just this line and if Win-Q is pressed, the next line will be true if/when executed
if (debug=1) debugger("test",A_LineNumber)

Code:
;============================================================
; very rudimentary debugger
;============================================================

;search for 'OutputDebug' in the helpfile for other ideas

debugger(text,linenum)
{
   ; listlines ; I don't seem to be able to show both variables and lines
   ; so I'll report the line number and look at the file listing instead
    listvars
    msgbox  %text%`nline=%linenum% Paused by user, `n`nPress OK to continue
    debug:=0
    return
}

; simple variable to allow pausing the script
#q::  ; Win-Q
debug=1
return
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help 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