Ask Your Question
0

Link to browser in Writer

asked 2018-09-28 21:59:06 +0200

It would be very helpful to have a way to highlight a word or phrase in Writer and select it to open a search in a browser to find that word or phrase.

I do considerable research when I'm writing and have to copy and paste words and phrases into my browser search. Google Docs does this, but, of course, that is all done from within the browser.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2018-09-28 23:31:06 +0200

Ratslinger gravatar image

updated 2018-09-29 23:01:40 +0200

Hello,

Have recently answered this here -> Internet lookup.

The solution is to use a macro. The text is highlighted then a right click and select Google_search. Have just retested this on Mint 18.3 using LO v 6.1.0.3 and have no problems.

Sample (macros included) --- InternetSearch.odt

Please refrain from comments such as Google Docs does this.... It doesn't matter who else does what. If LO doesn't do something then a request should be made on Bugzilla.

EDIT:

Sorry but I should have mentioned that the macro in the sample is set to use Firefox. If you use a different browser, the macro must be changed.

Edit 2018-09-29:

Not certain why you are having the problem. Have taken this same sample and it obtains whatever is highlighted each time:

image description

Edit #2 2018-09-29:

On the original site where the code is posted, there is a second routine (similar to the first). This one uses the default browser. Also, if a word/phrase is not selected it will search on the word the cursor is on or nearest to.

Sample #2 ---- InternetSearch2.odt

Edit #3 2018-09-29:

From menu -> Tools->Customize and on Context Menus tab:

image description

Notice on left panes the Category of Macros was selected from dropdown list (near bottom). This list the macros available in your document & for the modules. If you want this to be available across ALL Writer documents, you should place the macro in My Macros before assigning this. In the right panes notice my scope was for the document. You could choose Writer. The Target is Text. Once you select the macro wanted and the target, use the arrow (middle section) to create an entry on the right. You can use the Modify button to give it a new name . You can also use the up/down arrows on the far right to move the entry in the list of items.

HTH

edit flag offensive delete link more

Comments

Thank you. I've tried to use the macro in the example document you supplied. I first changed the browser to "google-chrome". With this I either got an error message from Chrome or nothing. I changed the browser back to "firefox" and still got nothing. (I can execute firefox in a terminal window, so I know it's there.) I've also tried Tools>Macros>Run Macro, but no luck.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 19:04:05 +0200 )edit

What OS & LO version are you using?

Ratslinger gravatar imageRatslinger ( 2018-09-29 19:09:09 +0200 )edit

I changed the Macro Security Level to Medium. I got a lookup from firefox (locomotive) once. But not a second time.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 19:11:37 +0200 )edit

Ubuntu 16.04. Latest update. LO 6.0.6.2

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 19:12:26 +0200 )edit

Through trial and error, I got this to work in a terminal:

firefox https://www.google.com/#q=%22locomoti...

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 19:50:40 +0200 )edit

Tried that in macro:

 sGooglePhrase = "https://www.google.com/#q=%22"+sSendPhrase+"%22"

and it works the same for me as the original statement. You may want to try.

Ratslinger gravatar imageRatslinger ( 2018-09-29 20:13:49 +0200 )edit

I think I must have disabled macros somehow when I first opened your example doc. I reopened your example, and when it asked if I waned to enable or disable macros, I picked "enable."

So now it works. My mistake. Thank you very much.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 20:54:26 +0200 )edit

I'm trying to add Google_search to the context menu. I see in your example that you have "Google_search" in the text context menu. I have tried to do that, but I can only get it to add a separator or submenu. Also, I don't see how to assign a macro to the menu item. I've looked at the documentation, but I think some of it is old or I haven't found the right sections. Is there any advice you can give me about adding the menu item and the macro?

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 22:39:56 +0200 )edit

Will edit answer with info on context menu. Hope you looked at 2nd sample as I believe it is actually better than first.

Also, as you have been helped, please help others to know the question has been answered by clicking on the ✔ in upper left area of answer which satisfied the question.

Ratslinger gravatar imageRatslinger ( 2018-09-29 22:48:58 +0200 )edit

Yes, thank you. I will certainly click the checkmark.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-09-29 22:56:16 +0200 )edit
0

answered 2018-09-28 23:30:43 +0200

m.a.riosv gravatar image

Select the text to use as hyperlink and then [Crrl+] or Menu/Insert/Hyperlink.

edit flag offensive delete link more

Comments

Ratslinger,

You were kind enough to provide me a macro to look up phrases from Writer documents. It works well with firefox, but will not reliably work with google-chrome. I learned a bit about writing macros and added a line code to the end:

    Shell(ConvertToURL("google-chrome"),1,sGooglePhrase)
    Shell(ConvertToURL("firefox"),1,sGooglePhrase)

The firefox window appears, but the google-chrome window does not. Also, I can type google-chrome into a terminal window and it works.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-10-13 22:34:35 +0200 )edit

Is there a problem in ConvertToURL with the hyphen in google-chrome?

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-10-13 22:35:00 +0200 )edit

No, that's not it. I created a hyphenated bash script ("part1-part2") that just ran google-chrome $1 and it worked fine when executed from Shell.

roy.kimbrell@gmail.com gravatar imageroy.kimbrell@gmail.com ( 2018-10-13 23:47:38 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2018-09-28 21:59:06 +0200

Seen: 52 times

Last updated: Sep 29 '18