Sign in to follow this  
Followers 0
WinkleDoodle

@ScriptLineNumber needs an equivalent macro for use with multiple files

2 posts in this topic

#1 ·  Posted (edited)

Once upon a time a script got so large that it had to be organize into several smaller files. happy ever after?, well no, this resulted in the tragic death of my "debuging" function.

Func _Debug($sData, $line=@ScriptLineNumber, $Ext=@extended, $Err=@error, $name=@ScriptName)
    ConsoleWrite('File: ' $name & ' Line ('&$line&') => '& $sData)
    Return SetError($Err, $Ext, 0)
EndFunc

So I have

Main.au3

Script1.au3

Script2.au3

Script3.au3

etc..

_Debug is called from somewhere in Script2.au3 which was included in Main.au3 and Main.au3 was run from scite

Console:

File: Main.au3 Line (202) => This Function: Suffered from serious head blah blah blah..

The problem.. Main.au3 is only 56 lines

@ScriptLineNumber becomes meaningless if I don't know which file it's referring to.

@Scriptname is perfect for what it is, no need to change, etc. but for debugging it's practically useless... , do I need to practice do mnemonic exorcises to debug my shitty, horribly written code? Why can't we also have a @Whichfuckingfileisautoitreadingatthispointintime

[Edit]

I changed the title of the topic so I won't get a single reply ranting how stupid the title of my topic is.. one can hope.

[Edit #2]

I suppose it's a bit naive to assume one even reads the title of this topic...

Edited by WinkleDoodle

Share this post


Link to post
Share on other sites



Suggest you try debugging you scripts before ranting about something not working and therefor in need of some upgrade.

If the problem it is related to your code, but you can't find a way to work around it. Come up with some small example code showing the problem (runneble by others).

Or, IF it is something Not related to you code ... also come up with some small example code. (also runneble by others)

I use a similar Debug #include + functions, with @ScriptLineNumber and other macros. And it has not failed me yet.

... Or you could read the documentation on @@ScriptName. It might/should include something about it only returning the filename of the root or startup file. (Aka: the file you called from Scite.)) ...

Posted Image


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0