KnutJ

How to update the values of @Macros during script execution

6 posts in this topic

Hi there,

how can the value of a @Macro Variable(or all of them) be updated without restarting the script.

e.g. changing IP-Setup from fixed IP to dhcp, but after new ip is assigned, the @IPAddress1 macro still shows the old value.

Via WMI i can get the current IP pretty easy, but there are other macros for which it might be handy to refresh/renew/reload the macro values...

Thanks in advance.

 

P.S: i googled, searched english and german forum, i even asked in the ##AutoIt channel on freenode:

But sadly, didn't find anything concerning my question.


rsRVpv.gif

Share this post


Link to post
Share on other sites



AFAIK macros are initialized when the script starts; there is no function to update them.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Very strange. i really thought there was a way to update/refresh those values by issuing a command in a script.

But this leads to : Why isn't there a way to refresh the macro-values?


rsRVpv.gif

Share this post


Link to post
Share on other sites

There are only 2 macros you can update: @error and @extended by using SetError and SetExtended.

I think there is no need to update the macros. Use variables instead.

Global $IPAddress1 = @IPAddress1
; Your code to change the IPAddress. Then reset variable $IPAddress1
$IPAddress1 = "Your code to change the IPAddress should return the new IPAddress"

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
36 minutes ago, water said:

macros are initialized when the script starts

that is not entirely exact; the time-related macros are updated regularly, so do the @error and @extended macros.

if you think it is necessary, feel free to submit a feature request. meanwhile, use alternative methods to retrieve the data stored in the macros, some of it is stored in the registry, other is accessible via WMI.

Share this post


Link to post
Share on other sites

I said: All macros get INITIALIZED when the script starts. I didn't say anything about when they get UPDATEd. Just that there is no function to UPDATE them except 2.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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