VAN0 Posted June 21, 2020 Share Posted June 21, 2020 (edited) Hello. I'm trying make my script be able run with stable autoit version and beta without modifying the script for each version. Beta version is missing some constants (and wise-versa) How do I check if a constant exists and create one if it doesn't? This works with beta, but fails with stable: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Version=Beta #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> If Not IsDeclared("__WINVER") Then Global Const $__WINVER = "blah" ConsoleWrite("$__WINVER: " & VarGetType($__WINVER) & @CRLF) [EDIT] So far the only work around I could come up with is to define a different constant and use Eval() to retrieve value of existing one: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Version=Beta #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> Global Const $__WINVER_NEW = IsDeclared("__WINVER") ? Eval("__WINVER") : "blah" ConsoleWrite("$__WINVER_NEW: " & VarGetType($__WINVER_NEW) & @CRLF) Edited June 21, 2020 by VAN0 Link to comment Share on other sites More sharing options...
argumentum Posted June 21, 2020 Share Posted June 21, 2020 (edited) Edited June 21, 2020 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted June 21, 2020 Share Posted June 21, 2020 There : #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Run_AU3Check=n ;#AutoIt3Wrapper_Version=Beta #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <WinAPI.au3> If Not IsDeclared("__WINVER") Then Global Const $__WINVER = "blah" ConsoleWrite("$__WINVER: " & VarGetType($__WINVER) & @CRLF) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
jchd Posted June 21, 2020 Share Posted June 21, 2020 Using _WinAPI_GetVersion() directly is simpler. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
Nine Posted June 21, 2020 Share Posted June 21, 2020 @jchd I think OP was giving an example of how declaring a Global Const if it already exist or not. __WINVER was just an example, it could be any other constants. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy 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