You are here

PicPick Portable portablization

11 posts / 0 new
Last post
Gord Caswell
Gord Caswell's picture
Offline
Last seen: 5 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
PicPick Portable portablization

I've started this thread to continue discussion on the portablization of PicPick, so as to keep the Outdated Apps thread clean. The following is an explanation in detail of everything occurring in the launcher.ini, Custom.nsh and installer.ini when I updated the package for 3.2.7.

PicPickPortable.ini

[Launch]
ProgramExecutable=picpick\picpick.exe
DirectoryMoveOK=yes
SupportsUNC=yes

This section has not been touched.

[Activate]
Registry=true

[RegistryValueBackUpDelete]
1="HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\PicPick Start"

The addition of this section ensures that from this point on, if the user checks the "Run program at Startup" checkbox in the app's settings, that this setting does not affect the base computer. Of course, if this setting has previously been checked, the registry value may still be in the registry, but as we do not mess with pre-existing registry settings, we'll leave it be. It won't, however, affect the portable app, as it gets backed up.

[FilesMove]
picpick.ini=%PAL:AppDir%\picpick

[Language]
Base=%PortableApps.comLocaleName%
CheckIfExists=%PAL:AppDir%\picpick\language\%PAL:LanguageCustom%.ini
DefaultIfNotExists=English

These two sections have not been touched.

[LanguageStrings] 	
SimpChinese=Chinese Simplified	
TradChinese=Chinese Traditional
Farsi=Persian
Portuguese=Portuguese (Portugal)
PortugueseBR=Portuguese	
SerbianLatin=Serbian_Latin

In order to ensure all languages recognized by PAL & PAP are used automatically, all languages that are displayed differently in the app than in their Language:Base equivalent have been added in this section. This is necessary due to the way languages are handled in PAL. See here for those details.

[LanguageFile]
Type=INI
File=%PAL:DataDir%\picpick.ini
Section=Setting
Key=Language2

[FileWrite1]
Type=INI
File=%PAL:DataDir%\picpick.ini
Section=Setting
Key=Language2
Value=%PAL:LanguageCustom%

[FileWrite2]
Type=Replace
File=%PAL:DataDir%\picpick.ini
Find=%PAL:LastDrive%%PAL:LastPackagePartialDir%\
Replace=%PAL:Drive%%PAL:PackagePartialDir%\

[FileWrite3]
Type=Replace
File=%PAL:DataDir%\picpick.ini
Find=%PAL:LastPortableAppsBaseDir%\
Replace=%PAL:PortableAppsBaseDir%\

[FileWrite4]
Type=Replace
File=%PAL:DataDir%\picpick.ini
Find=%PAL:LastDrive%\
Replace=%PAL:Drive%\

With the exception of a change in N-numbers, these particular sections have been left untouched.

[FileWrite5]
Type=INI
File=%PAL:DataDir%\picpick.ini
Section=Setting
Key=CheckUpdate
Value=0

This section has been added to ensure that the checkupdate setting is off on every run of the app. This works in conjunction with the original setting in the same manner, as per DefaultData.

Finally, the following FileWrite section was deleted, as it is not necessary to write the value every launch. This value is auto-written by the app on install, as well as on upgrade.

 [FileWrite2]
Type=ConfigWrite
File=%PAL:DataDir%\picpick.ini
Entry='FirstRun='
Value=3260

Custom.nsh

${SegmentFile}
Var CustomFirstRunDone

This section sets the varialbe indicated, for use later in the file.

${SegmentPrePrimary}
	ReadINIStr $0 "$EXEDIR\Data\settings\PicPickPortableSettings.ini" "FirstRun" "Done"
	${If} $0 != true
		ClearErrors
		MessageBox MB_ICONINFORMATION|MB_OK "FOR PERSONAL(HOME) USE ONLY$\r$\n$\r$\nThis version is provided as freeware for only personal use. In this case, you are granted the right to use this program free of charge. Otherwise, you need to pay for a license for commercial use."
	StrCpy $CustomFirstRunDone false
	${Else}
		StrCpy $CustomFirstRunDone true
	${EndIf}
!macroend

The section does a number of things. First, it reads for the value of "FirstRun" in PicPickPortableSettings.ini. Next, If that value is not "true", and only then, It displays the MessageBox as required by the publisher, and sets the custom variable to "false".

Otherwise, if FirstRun is "true", it sets the custom variable to "true".

Note that this section happens prior to the app running.

${SegmentPost}
StrCmp  $CustomFirstRunDone "true" +2 0	
		WriteINIStr "$EXEDIR\Data\settings\PicPickPortableSettings.ini" "FirstRun" "Done" "true"
!macroend

This section compares the custom variable to "true". If they match, it does nothing. If, however, they do not, and the variable is then "false", It writes the "FirstRun" variable as "true" - meaning that the app has just been run for the first time, and the messagebox was displayed.

installer.ini

[Languages]
ENGLISH=true
BOSNIAN=true
BULGARIAN=true
CATALAN=true
CROATIAN=true
CZECH=true
DANISH=true
DUTCH=true
FARSI=true
FINNISH=true
FRENCH=true
GEORGIAN=true
GERMAN=true
GREEK=true
HEBREW=true
HUNGARIAN=true
INDONESIAN=true
ITALIAN=true
;JAPANESE=true
KOREAN=true
LITHUANIAN=true
POLISH=true
PORTUGUESE=true
PORTUGUESEBR=true
RUSSIAN=true
SERBIAN=true
SERBIANLATIN=true
SIMPCHINESE=true
SLOVAK=true
SLOVENIAN=true
SPANISH=true
SWEDISH=true
THAI=true
TRADCHINESE=true
TURKISH=true
UKRAINIAN=true
VIETNAMESE=true

This section ensures that the languages available in the installer are the same languages as in the app itself. This is to ensure that there is no confusion by users installing the app and having their preferred language available on install but not on running the app - They will either be available both times, or neither.

You'll note that I have excluded the PortableApps.comInstallerCustom.nsh. This is because, upon further discussion and testing, I've determined that the base app does exactly what that section was intended to do.

Unfortunately, it appears the app still shows the setting menu on first run after upgrade, no matter whether the firstrun value is 3270 or not.

[EDIT] Fixed launcher.INI language handling.

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
unanswered

In the Outdated Apps thread I have taken position in a variety of contributions to your version. But until now you doesn't answered one of my posts. This is not really very convincing.

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 5 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
stand corrected, moved here

I stand corrected on LanguageStrings. I'll update above.

As the Outdated Apps thread is supposed to be for reporting of outdated apps, not discussion about them, I started this topic for that purpose.

I thought I've outlined the reasons for each section above, which should answer your questions from before. if anything is unclear, please say so, and I'll try to clarify.

John T. Haller
John T. Haller's picture
Online
Last seen: 3 min 20 sec ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Languages

I believe that you only need every language defined if you use Default:
https://portableapps.com/manuals/PortableApps.comLauncher/ref/launcher.i...

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

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 5 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
indeed

Hmm, it looks like I've been misinterpreting that section.

This'll make language handling easier. Smile

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
Supplements to your statements

The addition of this section ensures that from this point on, if the user checks the "Run program at Startup" checkbox in the app's settings, that this setting does not affect the base computer. Of course, if this setting has previously been checked, the registry value may still be in the registry, but as we do not mess with pre-existing registry settings, we'll leave it be. It won't, however, affect the portable app, as it gets backed up.

In the past I also thought about this possible situation, where the user checks the "Run program at Startup" checkbox in the app's settings. Therefore your added sections [Activate] and [RegistryValueBackUpDelete] improve actually my previous version.

Finally, the following FileWrite section was deleted, as it is not necessary to write the value every launch. This value is auto-written by the app on install, as well as on upgrade.

Is it really so, that due to my section [FileWrite2] at every launch the value was written new, though after the first launch this value is already written?

EDIT: Also great thanks for your indeed very good explanations in this thread Smile

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 5 months 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
yes

yes, at every launch it would be (re)written, that's how that type of FileWrite works. It writes whatever the content is desired, no matter what's already there.

By contrast, Replace works by finding text and replacing it. If thetect isn't found, it isn't replaced. That's how we sometimes have default paths replaced: by having the path defined in Default Data as THISPATHNEEDSREPLACING, or something like it, and having FileWrite1 replace that with something useful.

[EDIT] You're welcome, glad to help.

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
further supplements

Gord wrote ...

Unfortunately, it appears the app still shows the setting menu on first run after upgrade, no matter whether the firstrun value is 3270 or not.

This statement is incorrect for 2 reasons.

Firstly is contained the file picpick.ini in the folder DefaultData. In the section [Settings] of this file appears the instruction "OpenEditorWhenStart=1". As a result of this instruction the app shows now the Editor window on first run after an upgrade (and not the settings menu).

Secondly I've reached through my developed section [FileWrite2], that no checkmarks next to "Run Program at Startup" and "Check for program updates" will appear. Of course I can't prevent with this precaution, that the user later sets an appropriate checkmark. But with your both developed sections [[Activate] and [RegistryValueBackUpDelete] you've created a suitable countermeasure with respect to one of these both checkmarks. Accordingly we should examine, if the other checkmark also influence the portability negative.

Due to these explanations I again indicate to the necessity of my developed section [FileWrite2], even if it means a new write to the drive after every new launch of the app.

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
Inclusion of the file installer.ini

Gord wrote ...

This section ensures that the languages available in the installer are the same languages as in the app itself. This is to ensure that there is no confusion by users installing the app and having their preferred language available on install but not on running the app - They will either be available both times, or neither.

I agree with your statement completely.

Finally, I like to thank you again for this great collaboration.

I will now adapt my developed version under inclusion of your created supplements.

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
Remarks to the segment ${SegmentPrePrimary}

Gord wrote ...

The section does a number of things. First, it reads for the value of "FirstRun" in PicPickPortableSettings.ini. Next, If that value is not "true", and only then, It displays the MessageBox as required by the publisher, and sets the custom variable to "false".

Otherwise, if FirstRun is "true", it sets the custom variable to "true".

Immediately after the first launch of the app exists in the file PicPickPortableSettings.ini no section "FirstRun", in which is contained a key "Done" with an appropriate value ("true" or "false").

Accordingly the instruction

ReadINIStr $0 "$EXEDIR\Data\settings\PicPickPortableSettings.ini" "FirstRun" "Done"

reads nothing from the key "Done" in the section "FirstRun" of the file "PicPickPortableSettings.ini" and stores no value into the variable $0. Therefore the variable $0 is empty. Due to this fact it fulfills the requirement, that the value of the variable $0 (it's currently empty) is not "true". Are these considerations so far correct?

tapsklaps
Offline
Last seen: 5 years 6 months ago
Developer
Joined: 2010-10-17 08:11
Deviation

I've detected now a strange deviation. The file installer.ini contains 36 languages. But during the installation I can only select under 34 possible languages. How is this explainable?

Log in or register to post comments