KnutJ Posted July 18, 2016 Share Posted July 18, 2016 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. Link to comment Share on other sites More sharing options...
water Posted July 18, 2016 Share Posted July 18, 2016 AFAIK macros are initialized when the script starts; there is no function to update them. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
KnutJ Posted July 18, 2016 Author Share Posted July 18, 2016 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? Link to comment Share on other sites More sharing options...
water Posted July 18, 2016 Share Posted July 18, 2016 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
orbs Posted July 18, 2016 Share Posted July 18, 2016 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. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
water Posted July 18, 2016 Share Posted July 18, 2016 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 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now