access application name inside custom script - nsis

I am working on an installer for the application written using electron and electron-builder. I was able to manage most of the issues but one. During uninstall process i have to remove registry key previously set outside of nsis installer. I already found a way to do that:
DeleteRegValue HKCU "Software\Microsoft\Windows\CurrentVersion\Run" "APP_NAME_GOES_HERE"
The problem i am having is, i would like to avoid hard coding the name of app and get it instead from some variable already defined by electron or electron builder.
This is how installer looks:
As you can see there is application name in a title of window KIOSKMEGA-JS and its also set at the bottom of page along with the version and its also visible in a path string. I did not define the name anywhere aside from package.json file. Which means that electron is somehow passing this name to nsis.
Does anyone know how i can access this value in my installer.nsh custom script? I tried things like $APPNAME or $NAME, without luck.

Use $(^Name) to access the standard language string set by the Name attribute in a script.
It looks like electron-builder has a define named ${PRODUCT_NAME}.

Related

How to access the path of Inno Setup installed program from OUTSIDE of Inno Setup?

According to the docs, Inno Setup uses AppName or AppId to allow you to create an update program that will automatically put its files in the same path which the user installed the initial application to.
I need to be able to determine where Inno Setup installed files to based on AppId, but NOT from within Inno Setup. For example, I need to be able to determine this from a Python script.
One use case: patching a file in the installed program location. It would be overkill to package an entire installer just to, say, conditionally add or edit a line in a text file. A simple Python script could accomplish this, plus the user could review the script if they desired. I cannot and should not assume the user just installed to the default location, hence why I need to be able to see where the user installed the program.
Inno Setup obviously stores this somewhere since it is able to make its own patches, but I can't seem to find it in the registry. I've searched the Registry for my app ID but I only see it in the Uninstall section. I can probably pull it from there, but I think you can also create installers without uninstallers – where would this end up in that case?
The path is stored to registry to HKLM (administrative install mode) or HKCU (non administrative install mode) to a subkey named after the AppId with _is1 suffix, stored under a key SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall (as you alraedy know). The value name is Inno Setup: App Path. The path is also stored to InstallLocation with additional trailing slash, as that's where Windows reads it from. But Inno Setup reads the first value.
An example for HKLM:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\appid_is1]
"Inno Setup: App Path"="C:\\Program Files\\My Program"
"InstallLocation"="C:\\Program Files\\My Program\\"
You can see this in dozens questions, that show how to read the value in Inno Setup code. For example:
How to get path of installation of target game/application from registry when installing mod/plugin using Inno Setup?
If you create an installer what cannot be uninstalled (CreateUninstallRegKey=no or CreateUninstallRegKey=no), then the path is not store anywhere. In such case you would have to explicitly code your installer to store the path for you somewhere.

Robot Framework cannot create folder via Create Folder keyword

I observe very strange situation my Robot Framework script cannot create folder via Create Directory keyword. Code is very simple
Create Directory folder_name
According to log step ends with success but actually folder is not created.
I use Robot Framework 3.2.2 on latest version of xubuntu. I suppose that something wrong with access to file system from script. But I cannot fond out where
Please use double slashes (//)
to separate the folders forming the path argument
("folder_name", as you've named it).
This notation is for Windows.
The idea can be explored from here on.

Error in Preparing your Environment: The system cannot find the path

I am trying to start my first API with Spotify.
I am using this site for my walkthrough.
I have downloaded the specified version of Node.js, and I have saved the code provided into a sublime file under the name server.js, and stored on the desktop in a folder called njtest.
On the step "Preparing your Environment", I run the cmd prompt and I get the error "The system cannot find the path specific".
Am I missing prompts in my js file and my cmd prompt?
You need to specify the PATH. If you're using Windows go to the start menu and type in Edit the system environment variables. From there go to Environment variables. Then in the system variables section, find where it says PATH and double click it. Click "New" and type in the path (should be whatever you saved it under. Something along the lines of C:\Node.js\bin) Remember that PATH's are case sensitive. If you have any more detailed questions about specifying the path, a quick internet search should yield many answers. Hope this helps!! Good luck and don't give up.

Installshield Environment Variables

I'm fairly new to using InstallShield, and I've ran into an issue, I'm currently creating an installer for an addon product after they accept the license agreement dialog I want InstallShield to check for a specific environment variable, if it exists store it as a string if it doesn't, show a dialog to set a path (then store it and set the variable).
The path is for the installation directory of the main product installer was built by someone else, not the addon they are installing.
I used VBScript to solve this!
Also there was a problem with environmental variables being user only and not machine.

Can I keep the application settings when updating with installshield?

I finally managed to get my application updating through installshield LE, without the user having to uninstall manually first, what I am now wondering is:
Can I get the installer to use the application settings from the previous install, so the users saved settings don't change, causing the user to enter their settings every time there is an update. But at the same time, add any new settings to the config file.
Is there anyway to get the installer to not update certain files, for example, the database file is held in a folder called 'db' inside the program files directory, I obviously don't want the users database getting overwritten with a blank one.
Thank you.
Im not sure what programming language you are writing in, but I had this concern with a C# application I wrote. I see 2 easy ways of doing it:
1) With C# you can setup application setting variables that get written to an XML file in the users Application Data (on WinXP) directory. The nice thing about this is that writing to and reading from the settings file is really easy through the API:
To save and store a variable:
Properties.Settings.Default.UserName = UserName_txtbox.Text; // save contents of UserName_txtbox to UserName setting variable
Properties.Settings.Default.Save(); // write variable to file
To restore a variable:
UserName_txtbox.Text = Properties.Settings.Default.UserName; //load contents of UserName variable to UserName_txtbox
Because the file that contains these are not included in the installation directory of the application, they are preserved.
If you are using a different programming language, you can try to implement the same concept.
Create a settings file that your program updates externally from the install location. (Perhaps it can be in the install location. Im not sure how your installer "updates". Does it replace files or uninstall the old version and install the new version automatically? Play this this to find out...)
Your settings file can be a simple txt file, a bin file, an XML file, etc. Anything that you can read and parse easily. Then you can load settings from the file when the program loads and save settings to the file when the program exits.

Resources