Skip to content
⌘ NSIS Forum Archive

Hide Files and My Documents $?

22 posts

MechMykl#

Hide Files and My Documents $?

Hey, im making an installer where I need the ability to make the folder a hidden one when nsis creates it, and, is there a $ type code for mydocumets? because with xp its C:\Doc and Settings...

Thanks for your help in advance
~Mechy
MechMykl#
Hey, thanks for the $ code, but i cant get the thing for the hidden, help plz 🙂

;Create shortcuts
CreateShortCut "$SMPROGRAMS\Startup\HQubed Webcam.lnk |HIDDEN" "$INSTDIR\booruWebCam.exe /run /minimized"

Oh, and after booruwebcam.exe" /run /minimized
will it work the way it is? as the /run is supposed to be outside of the quote....
MechMykl#
Ok, so I cant edit that post, anyway.

I need an example of how to use the hidden thing. Also, with the above post, will creating a shortcut allow me to have the /run and /minimized after it? Because usually they go after the " in an actual shortcut.

Thanks in advance.
Comperio#
Read the link above:
The hidden attribute is set with the SetFileAttributes command, not with the CreateShortcut command. You'll probably want to create the shortcut first and then set the file attributes on it.

Here's an example which also illustrates the usage of the run minimized command:

SetOutPath "$SMPROGRAMS\Startup"
CreateShortcut "HQubed Webcam.lnk" "$INSTDIR\booruWebCam.exe" "" "" 0 SW_SHOWMINIMIZED "" "Sample Description"
SetFileAttributes "$SMPROGRAMS\HQubed Webcam.lnk" hidden
MechMykl#
Hey, thanks alot, the shortcut is now hidden but I have 2 more questions/problems.

I need to make my installation folder hidden also, is this possible? If so I could use the code 🙂

Secondly, the shortcuts current target is

"C:\Program Files\Michael\Webcam\booruWebCam.exe"

but I need to make it like this

"C:\Program Files\Michael\Webcam\booruWebCam.exe" /run /minimized

and I cant put the /run /minimized in OR out of the quotes in NSIS, is there a way to do this that I dont know about?

I've attached the installer, thanks in advace.
Afrow UK#
1.
CreateShortcut "HQubed Webcam.lnk" '"$INSTDIR\booruWebCam.exe" /run /minimized' "" "" 0 SW_SHOWMINIMIZED "" "Sample Description"
2.
SetFileAttributes $INSTDIR hidden

-Stu
Afrow UK#
Put the SetFileAttributes $INSTDIR hidden code in Function .onInstSuccess

Function .onInstSuccess
SetFileAttributes $INSTDIR hidden
FunctionEnd

Or you could put it in a last hidden section.

Section
SetFileAttributes $INSTDIR hidden
Section

-Stu
MechMykl#
Thanks sooo much, but theres a problem with the shortcut...

This installers attached (updated)
And the acutal exe's at hqubed.com/stuff/hcamai.exe

Check the target of the shortcut, can it be fixed?
MechMykl#
Yes you do.
Afrow UK#
CreateShortcut "$SMPROGRAMS\Startup\HQubed Webcam.lnk" '"$INSTDIR\booruWebCam.exe" /run /minimized' "" "" 0 SW_SHOWMINIMIZED "" "Sample Description"

-Stu
MechMykl#
Yea, like i said, when I do that the shortcut target in startup says this

"C:\"C:\Documents and Settings\Michael\My Documents\HQubed Webcam\booruWebCam.exe" \run \minimized"

If there's no way to get it to say

"C:\Documents and Settings\Michael\My Documents\HQubed Webcam\booruWebCam.exe" /run /minimized

then i'll have to make a shortcut to it myself
Afrow UK#
Put
MessageBox MB_OK $SMPROGRAMS
under your CreateShortcut compile and run the installer!!!

-Stu 😳
MechMykl#
Hey, was gone till 6 for mothers day, here it is.
Afrow UK#
I couldn't find anything significantly wrong with the script that could cause this, but you don't have to create the Startup folder because there's no way a user cannot have it.
Secondly, it may not always be called Startup (apparently) so you should use $SMSTARTUP not "$SMPROGRAMS\Startup"

The SetOutPath call you're using will set the "Start in" path for the proceeding shortcuts. Idealy then you should use SetOutPath $INSTDIR.

-Stu
MechMykl#
Ok, I took your advice and fixed the code, but it seems the shortcut just cant be done... Thanks for all of your help though, www.projects.hqubed.com ; it'll be up there soon.