Talk:FileAssoc: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
(Remove duplication of section (see previous edit))
Line 1: Line 1:
There is a bug in the script (I think...)
In the example you call with five parameters:
<nowiki>
;    !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "$INSTDIR\myapp.exe,0" \
</nowiki>
<nowiki>
;    "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""
</nowiki>
but in the fuction header there is six patrameters declared:
!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND
There must be somthing wrong here or?
/Pontus
: Perhaps a better example would be:
<highlight-nsis>
  !insertmacro APP_ASSOCIATE "myext" "myapp.myext" \
    "My App File" "$INSTDIR\myapp.exe,0" \
    "Open with My App" "$INSTDIR\myapp.exe $\"%1$\""
</highlight-nsis>
* the "My App File" is what shows up in the Explorer details view
* the "Open with My App" is what shows up in the context menu
[[Special:Contributions/86.135.85.25|86.135.85.25]] 23:04, 28 October 2010 (UTC)
== quotes fix for COMMAND ==
== quotes fix for COMMAND ==



Revision as of 18:09, 16 February 2013

quotes fix for COMMAND

Hi,

previous post: obvisously the File Class description is missing in the sample after the file class ID.

In the command if you use double quotes like in myExe.exe "%1", the script will think you have 5 parameters to WriteRegExp ( Nsis 2.12 ). Since it's unlikely anyone will use single quotes in a command, I suggest to fix it by remplacing the double quotes around {COMMAND} in the macro by single quotes:

WriteRegStr HKCR "${FILECLASS}\shell\open\command" "" '${COMMAND}'

Cedric.

Even better, backticks. Done. --kichik 03:45, 31 December 2005 (PST)

Missing param in example

I've just fixed this. Discussion archived below. 127.0.0.1 18:09, 16 February 2013 (UTC)


There is a bug in the script (I think...)

In the example you call with five parameters:

; !insertmacro APP_ASSOCIATE "txt" "myapp.textfile" "$INSTDIR\myapp.exe,0" \

; "Open with myapp" "$INSTDIR\myapp.exe $\"%1$\""

but in the fuction header there is six patrameters declared:


!macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND


There must be somthing wrong here or?

/Pontus

Perhaps a better example would be:
  !insertmacro APP_ASSOCIATE "myext" "myapp.myext" \
    "My App File" "$INSTDIR\myapp.exe,0" \
    "Open with My App" "$INSTDIR\myapp.exe $\"%1$\""
  • the "My App File" is what shows up in the Explorer details view
  • the "Open with My App" is what shows up in the context menu

86.135.85.25 23:04, 28 October 2010 (UTC)