cmbll
10th December 2006 14:04 UTC
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!
Red Wine
10th December 2006 18:14 UTC
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%
cmbll
10th December 2006 20:47 UTC
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)
Red Wine
10th December 2006 20:58 UTC
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 :-)
cmbll
10th December 2006 23:58 UTC
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?
bholliger
11th December 2006 00:31 UTC
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).
Red Wine
11th December 2006 08:44 UTC
writeinistr "$EXEDIR\test.ini" "Link Popup Menu" 'Item, "Text"' \
`"Go to Page, "java script:document.location='http://url/?url='+escape('%l')""`
cmbll
11th December 2006 15:29 UTC
thanks dudes ;)