![]() |
Pass Variable To URL - Printable Version +- Linux Lite Forums (https://www.linuxliteos.com/forums) +-- Forum: Software - Support (https://www.linuxliteos.com/forums/forumdisplay.php?fid=5) +--- Forum: Other (https://www.linuxliteos.com/forums/forumdisplay.php?fid=20) +--- Thread: Pass Variable To URL (/showthread.php?tid=2414) |
Pass Variable To URL - Duckeenie - 11-20-2015 [size=1em]Below we have some code that I expected would evaluate the variable %t before loading the relevant web page. It doesn't work it simply uses %t as a literal string.[/size] Code: /usr/bin/google-chrome-stable %U https://en.wikipedia.org/wiki/%t [size=1em]I know the variable itself works fine so I'm wondering if the code is just badly formatted or the problem needs to be approached differently.[/size] [size=1em]Thought this would be easy but now it's driving me mad. A green glow for the first one with a solution.[/size] Re: Pass Variable To URL - firenice03 - 11-20-2015 Are you wanting "%t" to prompt for search string or reference an external file? The below would populate a blank search box within wikipedia... Might get you closer... Code: http://en.wikipedia.org/wiki/Special:Search?search%QUERY% I've used apps (SlickRun) to do very similar launch google a popup box would populate or I could add the string behind.. I'd type: "google" .. a pop up box prompting for string "Linux Lite" or I could type: "google linux lite" both would yield same... Re: Pass Variable To URL - Duckeenie - 11-20-2015 Hi [size=1em]firenice03,[/size] I'm passing the variable from MOCP music player.[size=1em] I want the browser to search wiki for the track that is playing. %t equates to the title of the track.[/size] This is from the example config for mocp, it might help, didn't notice it earlier: Code: # Programs are run using execv(), not a shell, so you can't do things like Re: Pass Variable To URL - anon222 - 11-20-2015 Shell can't see %t as a variable Variables are marked with $t or ${t} Code: t="elephant" This will do: Code: /usr/bin/google-chrome-stable %U https://en.wikipedia.g/wiki/"$(mocp --format %title)" here a command (mocp --format %title) output is used edit Oh, you want to search wikipedia. ![]() Next will open a browser and run a wiki search query Code: /usr/bin/google-chrome-stable %U https://en.wikipedia.g/wiki/?search="$(mocp --format %title)" Special search: Code: /usr/bin/google-chrome-stable %U http://en.wikipedia.o/wiki/Special:Search?search="$(mocp --format %title)" Re: Pass Variable To URL - Duckeenie - 11-20-2015 (11-20-2015, 09:31 PM)misko_2083 link Wrote: Shell can't see %t as a variable Right now I'm lifting my beer can toward the screen. Cheers! ![]() Just had to edit %title out of your code because apparently the docs are wrong and this in fact returns artist - title - album. Using %t with your code did the job beautifully though. |