Modify

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#2511 closed Feature Request (Rejected)

New Macro @SourceName

Reported by: Fulgor Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:

Description

;start file1.au3 ------------------------------------------------
;file1.au3



#include "file3.au3"
#include "file2.au3"
local $a=1
local $b=1
MsgBox(0,@ScriptName & ", " & @ScriptLineNumber,"a = b")



#cs
this program shows 3 times always the SAME message

--------------
File1.au3, 10       <== always file one and always line 10, but the message are from different sourcefiles
a=b
OK
--------------

I cannot recognize where is the message from


My Wish:
========
a new macro: @SourceName


for purpose
MsgBox(0,@SourceName & ", " & @ScriptLineNumber,"a = b")

this should show 3 different messages
--------------
File3.au3, 10       <== file three and line 10
a=b
OK
--------------
--------------
File2.au3, 10       <== file two and line 10
a=b
OK
--------------
--------------
File1.au3, 10       <== file one and line 10
a=b
OK
--------------
#ce
;end file1.au3 ==================================================




;start file2.au3 --------------------------------------------------
;file2.au3





local $a=1
local $b=1
MsgBox(0,@ScriptName & ", " & @ScriptLineNumber,"a = b")

;end file2.au3 ====================================================




;start file3.au3 --------------------------------------------------
;file3.au3





local $a=1
local $b=1
MsgBox(0,@ScriptName & ", " & @ScriptLineNumber,"a = b")

;end file3.au3 ====================================================


Attachments (1)

Wish Macro SourceName.zip (991 bytes) - added by Fulgor 11 years ago.
Wish New Macro @SourceName

Download all attachments as: .zip

Change History (7)

Changed 11 years ago by Fulgor

Wish New Macro @SourceName

comment:1 Changed 11 years ago by TicketCleanup

  • Version Other deleted

Automatic ticket cleanup.

comment:2 follow-up: Changed 11 years ago by BrewManNH

Once you compile that script, the "source" won't matter any longer because it's all one long script. If you want different file names to be displayed in your message boxes, why didn't you write them to display the correct file name instead of the "source"? You're overthinking it.

I don't see the point or value of what you're requesting.

comment:3 Changed 11 years ago by Jpm

  • Resolution set to Rejected
  • Status changed from new to closed

@ScriptName relates to the script launched not the include files.
as stated by BrewManNH, compiles script will no longer have reference to include lines.
so even the @ScriptLineNumber will be irrelevant.

We don't intend to modify the way Compile script can use @ScriptName and @ScriptLineNumber

comment:4 in reply to: ↑ 2 Changed 11 years ago by Fulgor

Replying to BrewManNH:
Somebody overthinking, others underthinking.

Before a script was compiled, the compiler knows the sourcename and the linenumber.
The compiler could make two passes
first it changes all @scriptlinenumber/@sourcename to the corresponding values as a constant.
In a second pass it compile the script, like it it does today.

And that I may add the values for myself ​​into the messagebox is a truism, no one
needs this advice.

comment:5 follow-up: Changed 11 years ago by BrewManNH

Before a script was compiled, the compiler knows the sourcename and the linenumber.

As does the programmer, so the programmer should be dealing with it.

The compiler could make two passes

It could, but who would it benefit besides a very few edge cases? This would double the compile time, or perhaps even longer, for very little gain.

first it changes all @scriptlinenumber/@sourcename to the corresponding values as a constant.

So it would have to first parse the main script, keeping track of every line, then it would have to parse every include file, and every file that the include includes? Have you looked in some of the standard UDF files? There are some that include a half dozen or more other files. Some of those included files include other files, and some include files you're already adding. Can you see how complicated this is getting at this point?

And that I may add the values for myself ​​into the messagebox is a truism, no one
needs this advice.

Seems like one person needed it.

comment:6 in reply to: ↑ 5 Changed 11 years ago by Fulgor

Replying to BrewManNH:

Your answer gives the impression as if each source uses all existing Autoit-UDFs/includes simultaneously.
However, the fact is, that usally only a very small part of them is in every source.
But regardless of this, the compiler solved this problem and these difficulties are completely independent from any existing @scriptlinenumber/@sourcname.

Beside this, the UDFs/autoit-Includes have no @scriptlinenumber-Messageboxes, I never get one.
It is only nessessary for the compiler to examine the user-scripts/includes and replace @scriptlinenumber/@sourcename before the compiler creates Your "long script".

Today the compiler put for every @scriptlinenumber a -1 in the exe, why not the corresponding linenumber?

Maybe only one person needs @sourcename, but nobody needs the advice to write it for himself in the sourcefile.

Is it newly necessary, that everybody has first to start an online-survey and collect a signature-list?
How many signatures must he have, before it is him allowed to express a wish/request?

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.