You are here

How to address C:\Users\Public\Documents with PAL?

5 posts / 0 new
Last post
Gremlin
Offline
Last seen: 3 weeks 1 day ago
Joined: 2010-07-02 04:48
How to address C:\Users\Public\Documents with PAL?

Hi,

I have a question about addressing C:\Users\Public\Documents with Portable Apps Launcher. I searched the PAL documentation and this forum as well as Google but did not find any solution.

I want to move a folder in C:\Users\Public\Documents but what is the right syntax in then launcher.ini? I know how to do it generally but this is the first time I need to move to C:\Users\Public\Documents.

Thanks and cheers

Gremlin

John T. Haller
John T. Haller's picture
Offline
Last seen: 1 hour 47 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
Custom Code

You'd need to use custom code to do this. I think this may work though I do not have time to test as a custom.nsh:

${SegmentFile}

${SegmentInit}
	IntOp $2 0x002e +
	System::Call 'shell32::SHGetSpecialFolderPath(i $HWNDPARENT, t .r1, i r2, i r3) i .r4'

	${If} ${FileExists} "$1\*.*"
		System::Call 'Kernel32::SetEnvironmentVariable(t, t) i("PublicDocuments", "$1").r0'
	${EndIf}
!macroend

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

Gremlin
Offline
Last seen: 3 weeks 1 day ago
Joined: 2010-07-02 04:48
Thanks, I will try that. I am

Thanks, I will try that. I am not familiar with the custom.nsh though.

I need to move the folder with some statement in the 'AppnamePortable.ini' like
TestFolder=%PUBLICDOCUMENTS%\TestFolder
because you simply created a placeholder variable named %PUBLICDOCUMENTS% which points to C:\Users\Public\Documents, right?

Cheers

Gremlin

Gord Caswell
Gord Caswell's picture
Offline
Last seen: 1 month 1 week ago
DeveloperModerator
Joined: 2008-07-24 18:46
Use existing NSIS Variable

I suggest using the existing NSIS Variable for this: $DOCUMENTS, along with PAL's built-in macro for creating environment variables with the extra variants you may need:

${SegmentFile}

${SegmentInit}
	SetShellVarContext all
	${SetEnvironmentVariablesPath} COMMONDOCUMENTS $DOCUMENTS
	SetShellVarContext current
!macroend

Save this as Custom.nsh in the Launcher directory, then run PortableApps.comLauncher.exe against the app directory.

[EDIT] Once you've done the above, you'll be able to use the variable %COMMONDOCUMENTS% in your SomethingPortable.ini file in the DirectoriesMove section, or elsewhere for that matter.

Gremlin
Offline
Last seen: 3 weeks 1 day ago
Joined: 2010-07-02 04:48
Thanks, I will verify your

Thanks, I will verify your suggestion as soon as the application to be portabilized wants to cooperate. Right now it is terminating itself so fast that I can not see what happens in the file system. No logs and thus no fun :o(

Cheers

Gremlin

Log in or register to post comments