Jump to content

Recommended Posts

Posted

@ScriptName and @ScriptFullPath is not correct when referenced within an #include file. @ScriptLineNumber is correct in those cases and TrayIconDebug shows the correct file name.  Why aren't the others correct? Thanks!

Posted

For example, running "main.au3" with #include <common.au3"> ... main.au3 calls a function within common.au3. That function includes a debug statement that logs @ScriptName as "main.au3" instead of "common.au3". @ScriptLineNumber is logged as the correct line number within common.au3. And if script is paused at that point, the TrayIconDebug popup shows correct file name. Why doesn't @ScriptName have access to correct file name displayed in TrayIconDebug?

Posted

it'd be a problem otherwise. When the script runs, it's all added together ( in AutoIt ) so the running script is the name and full path.
If you run from SciTE it'll tell you what part/script is faulty/failed but once compiled you'd go to the script line number.
In the AutoIt3Wrapper there are things you can do to have the pre-compiled script that will match the compiled script to the line number.

I hope this helps. Otherwise, explain the limitation in a running code example to take it from there :) 

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted
  On 3/5/2023 at 8:52 PM, _Ed_ said:

For example, running "main.au3" with #include <common.au3"> ... main.au3 calls a function within common.au3. That function includes a debug statement that logs @ScriptName as "main.au3" instead of "common.au3". @ScriptLineNumber is logged as the correct line number within common.au3. And if script is paused at that point, the TrayIconDebug popup shows correct file name. Why doesn't @ScriptName have access to correct file name displayed in TrayIconDebug?

Expand  

Compiled ? Unclompiled ?

If you want to have this in compiled then try to use:

#AutoIt3Wrapper_Run_Au3Stripper=Y
#Au3Stripper_Parameters=/MO /RSLN

 

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted

My example above was in context of running an uncompiled script, using _DebugOut(@ScriptName&": "&@ScriptLineNumber) at line# 94 within common.au3

It produces a log statement like this:

    main.au3: 94

The line number is correct, but not the file name. I expect:

    common.au3: 94

If I put a pause right after the debug statement, i.e. "While True Sleep (100) WEnd" the AutoIt TrayIconDebug tooltip has correct file name for that paused position in script. I would expect @ScriptName or some other macro could provide same thing:

image.png.bcba93dae45c12efc2665c32f54422c0.png

The Au3Stripper tip for compilation is helpful, thanks. Running main.exe, I get:

    main.exe: common:94/19557

... or if running main_stripped.au3:

    main_stripped.au3: common:94/19557

But this seems like an inefficient extra steps that must be done with every change to original files.

  • Developers
Posted

Looks indeed like an issue after making 2 simple replicator scripts:

Test.au3:

; Script test.au3
#include "test2.au3"
ConsoleWrite('@@> Debug(' & @ScriptLineNumber & ') : @ScriptName= ' & @ScriptName & @CRLF) ;### Debug Console
Test()
ConsoleWrite('@@> Debug(' & @ScriptLineNumber & ') : @ScriptName= ' & @ScriptName & @CRLF) ;### Debug Console

Test2.au3:

; Script test2.au3
Func test()
    ConsoleWrite('@@- Debug(' & @ScriptLineNumber & ') : @ScriptName= ' & @ScriptName & @CRLF) ;### Debug Console
    ConsoleWrite('@@- Debug(' & @ScriptLineNumber & ') : @ScriptName= ' & @ScriptName & @CRLF) ;### Debug Console
EndFunc   ;==>test

Output:

>Running:(3.3.16.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "D:\Development\AutoIt3\programs\test\test\test.au3"    
+>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart. --> Press Ctrl+BREAK to Stop.
@@> Debug(2) : @ScriptName= test.au3
@@- Debug(3) : @ScriptName= test.au3
@@- Debug(4) : @ScriptName= test.au3
@@> Debug(4) : @ScriptName= test.au3
+>09:16:59 AutoIt3 ended. rc:0

 

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted

I realize now, @ScriptName is useful for identifying whether a script is running as the "main" script or as #included. Thanks!

Posted

Ticket #3766 closed Feature Request (Duplicate)
@IncludeScriptFullPath and @IncludeScriptName

Since this is acknowledged, maybe the this ticket can serve as a solution to keep the prior scripts running. Otherwise, if fixed, would be a script breaker.
Keeping the current behavior as is and adding the fix as @IncludeScriptFullPath and @IncludeScriptName would save a world of trouble.

If the behavior is revised and fix, as it has been this way since 3.2.x.x as far as I tested. Don't know if is worth fixing.

Just an idea.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...