Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Logging Autohotkey


  • Please log in to reply
7 replies to this topic
David Andersen
  • Members
  • 140 posts
  • Last active: Jun 28 2011 04:54 PM
  • Joined: 15 Jul 2005
I am automating a complex process in a quite hetrogenous environment. Occationally, the users report an error. Mostly the reporting is something like: "I does not work". It would, therefore, be very nice if I could write an error log in cases when something goes wrong. This error log should contain the last lines of code executed before the error occured. To have the variable content would be an excellent feature, but is not necessary (I do not care if performance in the script is reduced with 95% to achieve this).

I could probably create something like this by writing all code like the following:
send, {enter}
log("send {enter}")
winactivate, Notepad
log("winactivate, Notepad")

Needeless to say, the code would look horrible.

SoLong&Thx4AllTheFish
  • Members
  • 4999 posts
  • Last active:
  • Joined: 27 May 2007
I've seen a logging feature script, by randalff (user with R?) I think (can't find it but it is there)

David Andersen
  • Members
  • 140 posts
  • Last active: Jun 28 2011 04:54 PM
  • Joined: 15 Jul 2005
Thanks hugov. For reference for others the link to the thread is <!-- m -->http://www.autohotke... ... hlight=log<!-- m -->, but it does not provide a stacktrace like what I am after. I did not find what I am after, so I believe I have to live without it.

it is also worth mentioning that there is debugging functionality as well in Autohotkey (<!-- m -->http://www.autohotke... ... atures.htm<!-- m -->), but it would be a lot nicer if one could get an error stack trace (like in Java) when an executable script fails.

codybear
  • Members
  • 600 posts
  • Last active: May 05 2014 02:42 AM
  • Joined: 15 Sep 2009
I personally find the error reports from AutoHotkey, SciTE for AutoHotkey (beta version) and error levels enough for me to figure stuff out...but that's just on my own personal computer...
I would use a file append or soemthing along those lines every so often to a log txt file that would just show what the script is doing, and then if it fails after a certain point, you'll know why...
Other than that, I can't really help you...

PS: Oh and make sure the commands are compatible with the users' operating system version.

Carcophan
  • Members
  • 1578 posts
  • Last active: Nov 27 2013 06:46 PM
  • Joined: 24 Dec 2008
In the past, I have used 'MailTo' through Outlook.

The menu for my GUI's has a help option, within 'help' is 'report bug'.

User selected 'report bug', it would generate an email to a specific address and prepopulate the email with specific information about the script or action.


It would report open windows, processes, time/duration of actions, which buttons were used/unused on the gui itself, and the 'state' of the gui (as in where the user was in the actual work process when they selected the report bug menu option) which would basically let me recreate the situation on my work station.





I toyed with the idea of taking a screenshot and sending that along with the text-data, but the IT people didn't like that idea.


[rant]
Saddest part, 99.999999999999999999% of the time it was user-error :(
All the HelpFiles, web pages, or power point slides on eath... still can help some people learn how to operate a 4 button gui. I've even put '1','2','3' in the button titles, numbered.... still wound up doing things wrong..... sigh
[/rant]

HotKeyIt
  • Moderators
  • 7109 posts
  • Last active: Yesterday, 10:19 PM
  • Joined: 18 Jun 2008
How about to copy the lines from ListLines?
DetectHiddenWindows,On

Process,Exist

PID:=ErrorLevel

WinMove,ahk_pid %PID% ahk_class AutoHotkey,,10000000,10000000,0,0

ListLines

ControlGetText,Error,Edit1,ahk_pid %PID% ahk_class AutoHotkey

MsgBox % RegExReplace(Error,"^(.+\R\R)|(\R\R.*)$")


David Andersen
  • Members
  • 140 posts
  • Last active: Jun 28 2011 04:54 PM
  • Joined: 15 Jul 2005
It is a good idea, I will consider it. It means that if something goes wrong, the user will see a window flashing in front of them, which seems like a small price to pay.

HotKeyIt
  • Moderators
  • 7109 posts
  • Last active: Yesterday, 10:19 PM
  • Joined: 18 Jun 2008
Does it flash for you? It does not for me.