Archive: Adding a menu item to Opera


Adding a menu item to Opera
hi, i'm pretty newbie to nsis and got some questions about search in file functions, the forum search feature haven't helped me
here is how opera menu file looks like (Opera\defaults\standard_menu.ini):
...
[Link Popup Menu]

Item, 67389 = Open link
Item, 53018 = Open link in new page
Item, 53019 = Open link in background page
%the_place_i_need_to_put_an_item_to%
--------------------1
...
so i need to put a string to that place, the only method how to do that is finding the postition of '[Link Popup Menu]' and increase the line number pointer by 5
could some1 provide a sample code that implements that? thanx in advance!


Compile the following script:

outfile 'test.exe'

section -
writeinistr "$EXEDIR\test.ini" "Link Popup Menu" "Item, 00000" "This is New Item"
sectionend

Save the following example as test.ini in the same place with the compiled script:
[Link Popup Menu]

Item, 67389 = Open link
Item, 53018 = Open link in new page
Item, 53019 = Open link in background page
%the_place_i_need_to_put_an_item_to%

wow, thamx man! never thought it would be so easy )
i got another question now, how to implement the check whether the item is already added? (e.g. if user would run the installer twice)


http://nsis.sourceforge.net/Docs/AppendixE.html#E.3.2


You don't need that. It's not possible for the same record to be added twice. Run the test several times to see by your self :-)


thanks 4 the answers fellas ) now i got some troubles with quotations
the string i need 2 add is:

Item, "Text" = "Go to Page, "javascript:document.location='http://url/?url='+escape('%l')""

the method described by kichik here http://forums.winamp.com/showthread....ight=quotation isn't suitable cuz i need both single and double quotation marks in the output string
got any suggestions?


Hi cmbll!

Just escape quotation marks with $\"

WriteINIStr "inifile.ini" "???" "Item, $\"Text$\"" "$\"Go to Page, $\"java script:document.location='http://url/?url='+escape('%l')$\"$\""

Cheers

Bruno

edit:

http://nsis.sourceforge.net/Docs/Chapter4.html#4.1

Instead using the escaping trick you could use ` (backward single quote).


writeinistr "$EXEDIR\test.ini" "Link Popup Menu" 'Item, "Text"' \
`"Go to Page, "java script:document.location='http://url/?url='+escape('%l')""`

thanks dudes ;)