On Sat, Jun 15, 2013 at 1:08 PM, Art Heimsoth <artstore@artheimsoth.com> wrote:
 
Is the NSI install script somewhere in the Sourceforge repository?  I could
not find it with a quick search, but may have been looking incorrectly.

Hi Art,

Both the ooRexx and the stand-alone ooDialog scripts are in the repository:

ooRexx: 

svn://svn.code.sf.net/p/oorexx/code-0/main/trunk/platform/windows/install/oorexx.nsi 

ooDilaog:

svn://svn.code.sf.net/p/oorexx/code-0/ooDialog/trunk/install/ooDialog.nsi



I am trying to get the script working for my application.  It pretty much
works, but if ooRexx is not currently installed, I have to run my install
script twice.  That is because I check the REXX_HOME variable to determine
if ooRexx is installed and whether the 32 bit or 64 bit version is installed.  Evidently
this environment variable is not updated until the install ends as I am
reading it after I cause ooRexx and ooDialog to be installed, but the
variable is empty.  I don't know that the ooRexx script would help me
for this problem, and I may need to search to see if/where rexx.exe is
located instead.

The stand-alone ooDialog script might help you there.  In the script I determine if ooRexx is installed and where by reading the registry settings ooRexx creates when it installs.  When ooRexx is uninstalled the registry values are removed, so you can be pretty sure of things.

I don't check if it 32-bit or 64-bit ooRexx is installed, that is pretty much left to the responsibility of the person installing.

The check for ooRexx is done in the onInit function:

Function .onInit

  ; See if the installee is an admin.
  Call IsUserAdmin
  Pop $IsAdminUser
  ${if} $IsAdminUser == "true"
    SetShellVarContext all
  ${endif}

  ReadRegStr $RegVal_installedLocation HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${REXXSHORTNAME}" "UnInstallLocation"

...


 
A different problem I am having is when my application is installed from
a non-admin user account, the uninstall option is only available from
the control panel when the admin is logged in - not from the user account.
This is not the case for ooRexx, so I am looking for what I am not doing
or what I need to do differently.  

The whole Admin non-Admin thing has been complicated a lot by Vista and later.  To tell the truth, I doubt that either the ooRexx or ooDialog installs are following best practices, I haven't dug into the details much.

Part of what you need comes from the NSIS  SetShellVarContext instruction.  I'm not sure what it defaults to, but I'm thinking that it defaults to current user.  You can see in the oorexx.nsi script:

  Call IsUserAdmin
  Pop $IsAdminUser
  ${if} $IsAdminUser == "true"
    SetShellVarContext all
    StrCpy $RxAPIInstallService ${BST_CHECKED}
    StrCpy $RxAPIStartService ${BST_CHECKED}
  ${else}

The other part  comes from the NSIS RequestExecutionLevel instruction.  You can see that I just set it to admin in the scripts.  This is definitely not the best way to do this, but it is the least complicated.

  RequestExecutionLevel admin

 
My icon is correctly installed in the
Start folder and on the desktop for both the Admin and the User in this
case.  Just realized I have not checked to verify I can run the uninstall.exe
from the user account, if so, creating an icon for that may be a workaround.
 
Thanks for any ideas or pointers.

A good idea for your installer would be (might be) to write it as a current user install and try to avoid the UAC prompts.  You do this through request execution level and the shell context level:

RequestExecutionLevel user
 SetShellVarContext current
Her is a pointer to an article that might help:

http://www.klopfenstein.net/lorenz.aspx/simple-nsis-installer-with-user-execution-level

One problem then is that without admin execution level, you probably can't read the registry setting to locate an installed ooRexx.  Still, it would be worth looking into.

As I said, in the ooRexx and ooDialog installers, I've just followed the path of least complication.  This has pretty much forced that the user to have admin privilege to install.  Some day I hope to work on getting a current user install going for ooRexx ... but we'll see.

--
Mark Miesfeld