KnutJ Posted July 18, 2016 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.
water Posted July 18, 2016 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
KnutJ Posted July 18, 2016 Author 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?
water Posted July 18, 2016 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
orbs Posted July 18, 2016 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 WinPose - simultaneous fluent move and resize 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 Magic Math - a math puzzle Demos: Title Bar Menu - click the window title to pop-up a menu
water Posted July 18, 2016 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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
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