You are here

Launcher and registry keys

9 posts / 0 new
Last post
vdp
Offline
Last seen: 11 years 9 months ago
Joined: 2010-02-25 11:12
Launcher and registry keys

Hi,

I'm new to using the Launcher and would like to have clear instructions on how to do the following.

I'd like my custom PortableApp to register specific protocols so that from the shell or a web browser one could launch the app via, say, 'sip:1234@server'.
However, I'd like to make sure that if HKCU already has this protocol association, save it, modify it with my values and when the portable app terminates, restore the original values.

So, on custom PortableApp startup, do the following:

- backup some specific HKCU keys, if any (such as HKCU\Software\Classes\sip). Can I do this this way?:

[Activate]
Registry=true
[RegistryKeys]
reg_sip=HKCU\Software\Classes\sip

- set my registry values. I suppose I can do this:

[RegistryValueWrite]
HKCU\Software\Classes\sip\shell\open\command=REG_SZ:myapp.exe %1

On custom PortableApp termination, I need to delete my registry values and restore the original, if any.

How is this done?

I read the following page but it's not totally clear to me:
https://portableapps.com/manuals/PortableApps.comLauncher/ref/launcher.i...

Thanks

Pyromaniac
Pyromaniac's picture
Offline
Last seen: 8 years 11 months ago
Developer
Joined: 2008-09-30 19:18
Save/Restore it

If that's the only value you want in the key in the registry when your running your app, you can simply restore that key from your own file and then save it back to the file and return the previous data.

Manually go to the registry and write the value you want, then go to it's key, right-click -> Export Key and then just use [RegistryKeys] to handle the data, using the exported file you got.

vdp
Offline
Last seen: 11 years 9 months ago
Joined: 2010-02-25 11:12
Thanks but I can't manually

Thanks but I can't manually go to the registry. I'm deploying apps so I guess I could do a vbscript to backup the registry key at application startup, then run another vbscript at application termination to restore the saved key(s). However, I thought that the PortableApps Launcher did just that through launcher.ini and that one shouldn't be required to do any extra scripts to manipulate registry keys. I thought that it would automatically save .reg files within Data\settings\ on startup and restore them on shutdown.

John T. Haller
John T. Haller's picture
Online
Last seen: 57 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
It Does

It backs up and restores keys. He's talking about the INITIAL value if you want it to have one. Which you can also do just by backing up / restoring and then manually editing the .reg file. We're talking about the initial value in DefaultData (ie you do it once and it's done), we're not talking about custom scripting or needing each copy to do anything.

The ValueWrite bit should generally not be used for most apps. It has very specific applications. You just set the keys in [RegistryKeys] section and the launcher backs up and restores them. If you need to write out a specific value for each launcher (for example, writing the apps current working directory), you can do that via FileWriteN and write to the .reg file before it is imported. Lots of our apps do this.

Sometimes, the impossible can become possible, if you're awesome!

vdp
Offline
Last seen: 11 years 9 months ago
Joined: 2010-02-25 11:12
Thanks

Thanks

RegEdit
RegEdit's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-03 23:57
How to do

John T. Haller,
Greetings.
Help with the syntax:
I need to have the program register in the registry when launching the lancher. I do the following in the launcher.ini:

[Launch]
ProgramExecutable = bin \ Progma.exe
DirectoryMoveOK = yes
SupportsUNC = yes

[Activate]
Registry = true

[RegistryKeys]
Default = HKLM \ Software \ Wow6432Node \ CompanyName \ Progma \License

[FileWrite1]
Type = INI
File =% PAL: DataDir% \ settings \ Default.reg
Section = HKEY_LOCAL_MACHINE \ Software \ Wow6432Node \ CompanyName \ Progma \ License
Key = "Owner"
Value = "Portableapps.com"
Key = "Key"
Value = "6CZQ3-H3HBL-PMRYE-9RCD2-94L7U"

In the folder DefaulData there is a .reg file:
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE \ SOFTWARE \ Wow6432Node \ CompanyName \ Progma \ License]
"Owner" = "Portableapps.com"
"Key" = "6CZQ3-H3HBL-PMRYE-9RCD2-94L7U"

But the program does not register and does not create keys in the registry ....
How just load and restore settings from regfile on template ?

to portable your life with portableapps.com

John T. Haller
John T. Haller's picture
Online
Last seen: 57 min 57 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Wow6432Node HKLM

Since this is a 32-bit process, you don't need to write it as Wow6432Node. Windows will interpret that bit for you.

Also, this launcher would require admin rights, as you can't write to HKLM without it.

Sometimes, the impossible can become possible, if you're awesome!

RegEdit
RegEdit's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-03 23:57
OK

I already figured out, but thanks for the information anyway.
I made these keys via HKLM\Software & HKCU\Software.

to portable your life with portableapps.com

RegEdit
RegEdit's picture
Offline
Last seen: 6 years 1 month ago
Joined: 2012-02-03 23:57
Off

Thanks for help

to portable your life with portableapps.com

Log in or register to post comments