Sign in to follow this  
Followers 0
laidback01

Calling Constants out of includes file

4 posts in this topic

Hi, I've made a very simple includes file, for lookups of the error codes that MSIexec produces when run. An example of this includes is

Global Const $MSI_0 = "SUCCESS"                                 ; The action completed successfully.
Global Const $MSI_13 = "ERROR_INVALID_DATA"                     ; The data is invalid.
Global Const $MSI_87 = "ERROR_INVALID_PARAMETER"                ; One of the parameters was invalid.
Global Const $MSI_120 = "ERROR_CALL_NOT_IMPLEMENTED"            ; This value is returned when a custom action attempts to call a function that cannot be called from custom actions.
Global Const $MSI_1259 = "ERROR_APPHELP_BLOCK"                  ; If Windows Installer determines a product may be incompatible with the current operating system, it displays a dialog box informing the user and asking
Global Const $MSI_1601 = "ERROR_INSTALL_SERVICE_FAILURE"        ; The Windows Installer service could not be accessed. Verify that the Windows Installer service is properly registered.
Global Const $MSI_1602 = "ERROR_INSTALL_USEREXIT"               ; The user cancels installation.
Global Const $MSI_1603 = "ERROR_INSTALL_FAILURE"                ; A fatal error occurred during installation.
Global Const $MSI_1604 = "ERROR_INSTALL_SUSPEND"                ; Installation suspended, incomplete.
Global Const $MSI_1605 = "ERROR_UNKNOWN_PRODUCT"                ; This action is only valid for products that are currently installed.
Global Const $MSI_1606 = "ERROR_UNKNOWN_FEATURE"                ; The feature identifier is not registered.
Global Const $MSI_1607 = "ERROR_UNKNOWN_COMPONENT"              ; The component identifier is not registered.
Global Const $MSI_1608 = "ERROR_UNKNOWN_PROPERTY"               ; This is an unknown property.oÝ÷ ٩ݲ'|°k"7öjîx§l¢iÛ%G­+ºÚ"µÍÔ[[Ý[ÈXY
ËÂÌÍÜ[H[ØZ]
    ][ÝÛÚY^XÈÞÐPÍÍN
LMÑPÎMÍKL
Ì
HÜ[][ÝË  ][ÝÐÎÌLÉ][ÝÊBÔXÛÜÙÂ[]J   ÌÍÛÙË  ][ÝÔ[[Ý[ÙXÜØ]XY
ËÈ[]Ý]È  ][ÝÈ  [È ÌÍÜ[ [È ][ÝÈ  ][ÝÈ  [ÈÕT  [È ][ÝÎ][ÝÈ    [ÈRS   [ÈÔoÝ÷ Ù8^/{
âµë)¶ayê뢹hX¤zØb±«­¢+ÙIµ½Ù°½É½ÐIÈܸÀ¸Ì¹Ý¥Ñ ÍÑÑÕÌÄØÀÔÈÈèÀoÝ÷ ÙhZ´Ø­¶hËhµ©¶­zºè­Êz«¨·^´æ«¨µ©Ýq©e¶¢ú(ºÚrì·Mú1"5ëNVêÞ#f§
è¬-¢Ö¤zØ^éz½zÓ§v·z·§qëayÊ'²×(®·¶az¼(­Û-ê.¶­#§¶+-+ºÚ"µÍ[[Ý[ÙXÜØ]XY
ËÈ[]Ý]ÈTÔÕSÓÕÓÔÑPÕ

Hopefully I've explained this well enough. I know it's doable, but I'm just not sure how to create the varaible name out of the MSI error code and then use that variable's contents.

thanks for any help!

Share this post


Link to post
Share on other sites



Not sure if this is what you want or not but both of these MsgBox()s work

MsgBox(0,"Test", $MSI_1605)
SetError(1605)
$test = Eval("MSI_" & @Error)
MsgBox(0, "TEST 2", $Test)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

That's perfect, I changed my script to this:

;Removing Reader 7.0.3
$run = RunWait( "msiexec /x {AC76BA86-0000-7EC8-7489-000000000704} /qn", "C:\")
;Record log
FileWrite($log, "Removal of Acrobat Reader 7.0.3 Ended with status " & Eval($MSIprefix & $run) & " " & @HOUR & ":" & @MIN & @CRLF)

and it works as expected.

thanks very much!

Share this post


Link to post
Share on other sites

You're most welcome.

Just goes to show that even I get to be right every now and then. :)


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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
Sign in to follow this  
Followers 0