faw872
24th June 2010, 00:11
I'm creating a desktop shortcut to distribute to our applications users but I've noticed it only creates a new file if you change the filename you are passing to a filename not yet used. When its a new .URL filename, it creates a new .URL file with the current data. If I keep using the old .URL filename, it doesn't update the file that already exists. Even if I delete the old .URL file manually and even clear my recycle bin and then I run the script again, if I'm re-using a file name, it manages to create the old file with old url again. I've tried this in XP and Windows 7. Do I need to do something with temp files? I haven't seen that in anyone elses code. Thanks! I've been trying to figure out this final detail for hours. Here's the excerpt of the code:
Section "" ;No components page, name is not important
!macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
nsislog::log "c:\logfile.txt" "Creating Internet shortcut."
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
!macroend
!insertmacro CreateInternetShortcut \
"$DESKTOP\Econ 3" \
"http://mysite" \
"$SYSDIR\favicon.ico" "0"
SectionEnd ; end the section
Section "" ;No components page, name is not important
!macro CreateInternetShortcut FILENAME URL ICONFILE ICONINDEX
nsislog::log "c:\logfile.txt" "Creating Internet shortcut."
WriteINIStr "${FILENAME}.url" "InternetShortcut" "URL" "${URL}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconFile" "${ICONFILE}"
WriteINIStr "${FILENAME}.url" "InternetShortcut" "IconIndex" "${ICONINDEX}"
!macroend
!insertmacro CreateInternetShortcut \
"$DESKTOP\Econ 3" \
"http://mysite" \
"$SYSDIR\favicon.ico" "0"
SectionEnd ; end the section