Hi Support Team,
Am I right in my assumption that
- any action providing a combo box for the variable (e.g. Check For Process) does not require the variable to be defined in advance (Set Variable)
- any action with only an edit field for the variable (e.g. Call DLL Function) requires the variable to be defined earlier in the script?
Or is the key difference Build-In Command vs. Plug-In Command?
Best regards
Michael
(Pre-) Definition of Variables
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: (Pre-) Definition of Variables
Dear Michael,
it's Always required to declare "CUSTOM" variables before to use them.
Regards
it's Always required to declare "CUSTOM" variables before to use them.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
Re: (Pre-) Definition of Variables
Dear Francesco,
I do not agree with you. Please try the following:
Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir into GUCKSTDU
MessageBox: Huhu, $GUCKSTDU$
{MSI Script:
~InstallAware Clipboard Data~
~MessageBox~
~{4EDD1630-D9DB-41E9-A0AC-0BFE26F00C7D}~
~Huhu~
~$GUCKSTDU$~
~0~
~1~
~~
~Read Registry~
~{2922F9C7-CDD5-4F33-9410-58D70A5F9B26}~
~GUCKSTDU~
~2~
~SOFTWARE\Microsoft\Windows\CurrentVersion~
~CommonFilesDir~
}
This works fine without any error. I'm pretty sure that GUCKSTDU is not a predefined variable and thus considered a custom variable. It is NOT declared in the Compiler Variables section or anywhere else before use.
I also discovered during PlugIn development that I can add variables to the 'Variables' argument of function 'RunTimeExecute' without any error - the added variable and its value is accessible (and correct) in my Native Setup MSI Script. Therefore using undeclared variables is also successful using my PlugIn's.
I have not very often an error message claiming the usage of undefined variables (but I remember that I've had some... - but I cannot remember the commands/actions raising the error).
Does the script above raise an error in your IA IDE?
Best regards
Michael
I do not agree with you. Please try the following:
Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir into GUCKSTDU
MessageBox: Huhu, $GUCKSTDU$
{MSI Script:
~InstallAware Clipboard Data~
~MessageBox~
~{4EDD1630-D9DB-41E9-A0AC-0BFE26F00C7D}~
~Huhu~
~$GUCKSTDU$~
~0~
~1~
~~
~Read Registry~
~{2922F9C7-CDD5-4F33-9410-58D70A5F9B26}~
~GUCKSTDU~
~2~
~SOFTWARE\Microsoft\Windows\CurrentVersion~
~CommonFilesDir~
}
This works fine without any error. I'm pretty sure that GUCKSTDU is not a predefined variable and thus considered a custom variable. It is NOT declared in the Compiler Variables section or anywhere else before use.
I also discovered during PlugIn development that I can add variables to the 'Variables' argument of function 'RunTimeExecute' without any error - the added variable and its value is accessible (and correct) in my Native Setup MSI Script. Therefore using undeclared variables is also successful using my PlugIn's.
I have not very often an error message claiming the usage of undefined variables (but I remember that I've had some... - but I cannot remember the commands/actions raising the error).
Does the script above raise an error in your IA IDE?
Best regards
Michael
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: (Pre-) Definition of Variables
Dear Michael,
it Always a good and recommended practice to DECLARE CUSTOM VARIABLES before to use them ... you may have un-expected results and especially when passing values to a plugin.
I full understand what you are trying to prove and under some circumstances it may work ... but believe me, I highly recommend you to declare them.
Regards
it Always a good and recommended practice to DECLARE CUSTOM VARIABLES before to use them ... you may have un-expected results and especially when passing values to a plugin.
I full understand what you are trying to prove and under some circumstances it may work ... but believe me, I highly recommend you to declare them.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: (Pre-) Definition of Variables
InstallAware@Jelich.info wrote:Dear Francesco,
I do not agree with you. Please try the following:
Read Registry Key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\CommonFilesDir into GUCKSTDU
MessageBox: Huhu, $GUCKSTDU$
Michael,
Don't ignore Francesco's advice about declaring your variables before you use them. I would say 99.9% of the time you will get away with it if you don't declare them. Most statements and plugins will be kind to you. Don't push your luck because one day an undeclared variable just might turn around and bite you. I've never had a problem with my own plugins but I always make sure I declare my variables at the top of the script and give them default values where possible.
Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
-
- Posts: 41
- Joined: Mon Apr 13, 2009 8:58 am
Re: (Pre-) Definition of Variables
Peter and Francesco,
I assumed that pre-definition was a 'relict' from earlier versions because I very often see undeclared variables used (e.g. SELECTED, SUCCESS,...)
Thank you for your advice. I'll consider your recommendation. Should not be difficult
But if it is of that importance, what do you think about a check during compile? (like 'OPTION EXPLICIT' in other 'languages'?) In case undeclared variables are used compile should fail or at least generate a warning...
Best regards
Michael
I assumed that pre-definition was a 'relict' from earlier versions because I very often see undeclared variables used (e.g. SELECTED, SUCCESS,...)
Thank you for your advice. I'll consider your recommendation. Should not be difficult

But if it is of that importance, what do you think about a check during compile? (like 'OPTION EXPLICIT' in other 'languages'?) In case undeclared variables are used compile should fail or at least generate a warning...
Best regards
Michael
Re: (Pre-) Definition of Variables
I like that idea of an OPTION EXPLICIT concept. It would certainly be useful. I'd envisage it being implemented as an IDE setting. I will ask someone who knows someone at InstallAware who might be able to punt it for consideration.
Francesco? Are you there?
Francesco? Are you there?

Peter. Smartly dressed, he still resembles an unmade bed.
InstallAware MVP
InstallAware MVP
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: (Pre-) Definition of Variables
I am having a beer on a lost beach of a unreachable country ...bip ...bip... can you hear me?
Let me check your request!
Regards

Let me check your request!
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: (Pre-) Definition of Variables
Dear Michael and Peter,
I am sorry ... but I believe it'll be very very difficult to implement a sort of OPTION EXPLICIT.
In reality the compiler already checks variables declaration, but this is limited to those used with internal IA commands or statements.
Unfortunately this is not possible when a script entry refers to a plugin statement or similar.
In this circumstances the compiler cannot verify if a variable has been used with a specific "script line". This due the fact that the compiler ignores the logic that stays behind a plugin entry ... and this cannot be different ... unless the plugin doesn't implement a specific "build time method" at such purpose ... but this becomes to be a complicated thing.
Regards
I am sorry ... but I believe it'll be very very difficult to implement a sort of OPTION EXPLICIT.
In reality the compiler already checks variables declaration, but this is limited to those used with internal IA commands or statements.
Unfortunately this is not possible when a script entry refers to a plugin statement or similar.
In this circumstances the compiler cannot verify if a variable has been used with a specific "script line". This due the fact that the compiler ignores the logic that stays behind a plugin entry ... and this cannot be different ... unless the plugin doesn't implement a specific "build time method" at such purpose ... but this becomes to be a complicated thing.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Who is online
Users browsing this forum: No registered users and 154 guests