Old 10th August 2020, 17:59   #1
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
Script to refresh my desktop icons (windows 10)?

Hey,
How I can refresh my desktop icons ? Does anyone know which script I can use before finish the nsis installation? My desktop shortcut stay blank until I'm refreshing my desktop....
Does anyone know how to solve it please ?
galtech is offline   Reply With Quote
Old 10th August 2020, 18:39   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,295
Does the target (.exe or whatever) exist before you call CreateShortcut?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th August 2020, 19:42   #3
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
I assume yes, because I'm calling for the shortcut creation in the end of the script (after all my files are installed).

I'm really really new with this kind of nsis scripting, I hope someone can help...I'm so frustrated with this ... hours....

I also created a exe file that refresh my desktop icons when I double click on it, but the file not really executed through nsis.. I tired so many options.. like:

Section
ExecWait "$INSTDIR\reic\refresh.exe"
SectionEnd


So I give up on this line cause it's not working for me...


I edit the Modren.nsh file this way (current state):


;Change this file to customize zip2exe generated installers with a modern interface

!include "MUI2.nsh"
!define MUI_ICON "${NSISDIR}\contrib\graphics\icons\install.ico"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

Section "Desktop Shortcut" SectionX
SetShellVarContext current
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\DeskMate.lnk" "$INSTDIR\DeskMate.exe" "" "$INSTDIR\.icon\m.ico" 0
SectionEnd
galtech is offline   Reply With Quote
Old 10th August 2020, 20:20   #4
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
I'm really new into it... This is my script ...
I don't know what I'm doing wrong ... my icon is blank (white color)... just if I'm refreshing my desktop it's visible.... :\ I also checked it in other pc... same issue...

;Change this file to customize zip2exe generated installers with a modern interface

!include "MUI2.nsh"
!define MUI_ICON "${NSISDIR}\contrib\graphics\icons\install.ico"

!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES

Section
SetShellVarContext all
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\app.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\.icon\m.ico" 0
SectionEnd

!insertmacro MUI_LANGUAGE "English"
galtech is offline   Reply With Quote
Old 10th August 2020, 20:23   #5
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
Hi Andres .. I'm not sure if you received my quick reply.
I reply here too, so I hope you can check my code. Thanks for you time to help.
galtech is offline   Reply With Quote
Old 10th August 2020, 20:39   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,295
You need to make sure that you extract the .exe and .ico before calling CreateShortcut.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th August 2020, 20:55   #7
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
How can I make sure it's happen before?

I think it's created before because this line:

!insertmacro MUI_PAGE_INSTFILES

is executed before:

Section
SetShellVarContext all
SetOutPath "$INSTDIR"
CreateShortCut "$DESKTOP\app.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\.icon\m.ico" 0
SectionEnd

Am I right?...

I'm really new with this... I'm not sure about that ...
galtech is offline   Reply With Quote
Old 10th August 2020, 22:21   #8
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,295
PHP Code:
Section Main app
SetOutPath 
"$INSTDIR"
File c:\mystuff\app.exe
SetOutPath 
"$INSTDIR\.icon"
File c:\mystuff\m.ico
SectionEnd

Section 
"Desktop shortcut"
CreateShortcut "$DESKTOP\app.lnk" "$INSTDIR\app.exe" "" "$INSTDIR\.icon\m.ico" 0
SectionEnd 

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 11th August 2020, 06:43   #9
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
Sorry for the dumb question......but what is the path I should replace with:

File c:\mystuff\app.exe

and

File c:\mystuff\m.ico


This path should not be ...?

File $INSTDIR\app.exe

File $INSTDIR\.icon\m.ico
galtech is offline   Reply With Quote
Old 11th August 2020, 07:09   #10
galtech
Junior Member
 
Join Date: Aug 2020
Posts: 8
Now I set each file path to my project folder (that already exist\extracted).
And after I run the setup file - it's all works great ! The icon appear without issue.

I didn't get it How it's actually works when my setup installer run the second time, after it get built. It's actually use these files because they are already exist? they saved somewhere in advance in my setup package, so my shortcut built correctly ?
galtech is offline   Reply With Quote
Old 11th August 2020, 09:49   #11
JasonFriday13
Major Dude
 
JasonFriday13's Avatar
 
Join Date: May 2005
Location: New Zealand
Posts: 891
The "File" command specifies where the source file is on your computer, so that the compiler knows where to get it from to put it into the installer. When the installer is run, it extracts that file to $OUTDIR, which can be set multiple ways but usually SetOutPath is used.

"Only a MouseHelmet will save you from a MouseTrap" -Jason Ross (Me)
NSIS 3 POSIX Ninja
Wiki Profile
JasonFriday13 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump