You are here

PortableApps Launcher Questions?

14 posts / 0 new
Last post
vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
PortableApps Launcher Questions?

Updated info 2012-03-23 00:37

Updated information posted here

I am looking for some information. I am working on an app, I would like to know whether what I want to do requires a complete custom launcher, a custom.nsh file or if it can be done using the existing structure?

OK I will try to be clear as possible with my needs.

I have an ini file that will be in the Data\settings folder
In the ini there will be an entry FirstRun=Y

I need to read that entry, if it =Y then I wish to bypass the ProgramExecutable and Launch a different Config.exe file which will allow the user to setup the program. (It actually writes to the same ini file)

Also It would need to read the Path=PTB and replace the PTB with value found in the ini file created by the installer (the one PA creates to handle drive letter changes)

I would also like it to read the value of the language setup string and write that to the ini file

Then it would need to launch the Config.exe

Once run the launcher would need to write to the ini file and change the value of FirstRun=Y to FirstRun=N

I hope that his makes sense because I am even starting to get confused.

Ok so now that his has all been accomplished The Launcher would then just read then ini file see that FirstRun=N and proceed to run the regular launcher (hopefully this could be done otherwise I would need a complete custom.nsi file as I wanted to utilize things like drive letter changes, etc with the PA Launcher) That part I know how to do with PA Launcher but not necessarily with a custom launcher.

I hope that this makes sense what I want, I guess the big question from start would be is this even a plausible idea?

So in a nutshell Can PA Launcher do this out of the box? If so how?
OR
Can I just write a custom.nsh file to handle the first run stuff?
OR
Do I need to write a total custom launcher and compile it myself?

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Sorry

I used the pre because of it being so lengthy guess I should not have?

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
No

<pre> is for text that should be monospaced, only. For asking a question in, like this, it detracts significantly from the readability.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Thank You

for taking the time to fix it as well as explaining it. Lesson learned

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
OK without help I been trying to tackle this myself

here is my Custom.nsh in the App/Appinfo\Launcher folder. Here are my two launcher .ini files TBTrayConfigPortable.ini and the second one is TBTrayPortable.ini. Also I will include the ini file they both refer to it is TBTray.ini

Using the launcher generator give me an error message about parsing in line 12 of the macro in Custom.nsh

Grabbing the "stock" launcher from the Launch generator folder and renaming it twice to the appropriate file names, TBtrayPortable launches the program but handle no ini writes TBTrayConfig does not launch the config it launches the TRTray program and also dose not do any file writes.

Also custom.nsh still not working and if I choose a different language in config it reverts back to default of English

Anyone care to spec them out and see where I have gome wrong?

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 6 days ago
DeveloperModerator
Joined: 2008-07-24 18:46
Try this
  1. Try this Custom.nsh: http://pastebin.com/gpWcW3At
  2. LanguageStrings: This section is unnecessary in your launcher.ini's
  3. FileWrite 3,4 & 5: Are these supposed to be INI FileWrites or Replace FileWrites? As they are written now, neither will work.
  4. Also, in those FileWrite's, you have unfinished PAL: variables...i assume these are supposed to be Drive & LastDrive, but I could be wrong. It looks like you might also be trying to have PAL:PortableAppsDirectory

Hope that helps some.

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Thanks

Will try out your custom.nsh file

This was going to be my first attempt at language switching since the program supports the languages I set in but uses an ini file to determine the language which is user configurable, so was just trying to do it for them...wrong way I guess...as for the File writes

Here is what I was trying to do They are supposed to be read/write in ini it would read the values and then write new value on first run. ad for 4 and 5 they need to point to the folder that the portable folder is in since this work in conjunction with another program So it is not PAL: thisapp folder but PAL:Thunderbird folder

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Updated

Looked at your file First I had to reverse the Y and N line because they were pointing to wrong place ( my bad) ran it got an error message...Then realized I only gave the Section but not the key value so ran with that got exact same error here is My Revised custom.nsh and here is the Relevant part of error report. Thanks can not believe how far off I was in comparing my original to yours.

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Chris Morgan
Chris Morgan's picture
Offline
Last seen: 8 years 9 months ago
Joined: 2007-04-15 21:08
Here is a fixed version of

Here is a fixed version of your code:

${SegmentFile}

${SegmentPre}
	${IfNot} ${FileExists} "$DataDirectory\TBSettings\TBtray.ini"
		CopyFiles /SILENT  "$EXEDIR\App\DefaultData\TBSettings\TBtray.ini" "$EXEDIR\Data\TBSettings\TBtray.ini"
	${EndIf}
	ReadINIStr $R1 "$EXEDIR\Data\TBSettings\TBtray.ini" "TBConfig" "FirstRun"
	${If} $R2 == Y
		ExecWait "$EXEDIR\TBTrayConfigPortable.exe"
	${ElseIf} $R1 == N
		ExecWait "$EXEDIR\TBTrayPortable.exe"
	${EndIf}
!macroend
  1. You can use ${IfNot}; then you don't need the Goto at all.
  2. ${If} $R2=Y isn't valid: NSIS takes the $R2=Y as a single value; you need it to be space-separated. Also, then, with LogicLib the = operator is for integer comparison, not string comparison.

This approach still isn't correct, but I don't have time to go into the proper way of doing it at present, sorry. I'll try to make time later this evening.

I am a Christian and a developer and moderator here.

“A soft answer turns away wrath, but a harsh word stirs up anger.” – Proverbs 15:1

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Thanks

I will give it a trey Chris, however I seem to be running into a few other issues now that are related to the base app. Mainly it will not allow me to do a files move of the ini file from Data to the App Dir so may need to investigate it more and or shelve it for now. However will try this code out first so it is not for naught.

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 4 months 6 days ago
DeveloperModerator
Joined: 2008-07-24 18:46
R2?

I've updated for R2 - it isn't set in any way, and should be R1

${SegmentFile}

${SegmentPre}
	${IfNot} ${FileExists} "$DataDirectory\TBSettings\TBtray.ini"
		CopyFiles /SILENT  "$EXEDIR\App\DefaultData\TBSettings\TBtray.ini" "$EXEDIR\Data\TBSettings\TBtray.ini"
	${EndIf}
	ReadINIStr $R1 "$EXEDIR\Data\TBSettings\TBtray.ini" "TBConfig" "FirstRun"
	${If} $R1 == Y
		ExecWait "$EXEDIR\TBTrayConfigPortable.exe"
	${ElseIf} $R1 == N
		ExecWait "$EXEDIR\TBTrayPortable.exe"
	${EndIf}
!macroend
vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Great Thanks

I will say I finally was able to get it to create launcher, so now investigating my files move issues I Truly appreciate the help and am actually learning quite a bit

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
R2 Update

With some help from gluxon in IRC I got the launcher.ini working properly, Using using your custom.nsh on clean install launches the config program properly, when I exit it it immediately launches the base app ( not my original intention nor in none portable mode does it do so, but not really a bad thing I would imagine?) However on subsequent launches it appears that it tries to launch the base app twice as base app starts as expected as well as an error saying I can not launch the app as another instance of it is running. So it is recognizing the config I believe. Wonder if I should remove the part about the if it is N part? So it would run the config if it was Y only otherwise would continue on to the launcher.ini?

Update to this comment
I commented out lines 10 and 11 which was what to do if the ${R1}=N and it runs first time with config then launches the base app on closing, second launch launches base app only once. So it appears I am on correct track and unless I can figure out a different idea will probably release it this way?

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

vf2nsr
vf2nsr's picture
Offline
Last seen: 7 years 5 months ago
Developer
Joined: 2010-02-13 17:10
Thanks for all of the help

With your help I have released TBTrya portable feel free to look it over if you think the custom.nsh file still needs more work

“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” Dr. Seuss

Log in or register to post comments