Running a macro when clicking in a Hyperlink in Writer
-
brunnerdan
- Posts: 43
- Joined: Tue Nov 29, 2011 12:41 am
Running a macro when clicking in a Hyperlink in Writer
Is it possible (or how is it possible) to specify a macro that should be run when clicking on an URL (hyperlink) that is defined in a Writer document ?
OOO 3.3 on Solaris/Windows
Re: Running a macro when clicking in a Hyperlink in Writer
Do you wish to merely run a macro as the hyperlink, or to open a hyperlink to another file and run the macro on it?
Apache OpenOffice 4.1.16 on Xubuntu 24.04.4 LTS
-
brunnerdan
- Posts: 43
- Joined: Tue Nov 29, 2011 12:41 am
Re: Running a macro when clicking in a Hyperlink in Writer
I would like to run the macro as a hyperlink. The idea is that the macro get the "description" of the hyperlink and executes a macro taking the description as parameter.
OOO 3.3 on Solaris/Windows
Re: Running a macro when clicking in a Hyperlink in Writer
This URL: vnd.sun.star.script:MyLibrary.MyModule.MyRoutine?language=Basic&location=document&MyExtraArg=AnythingElse
calls the following macro MyLibrary.MyModule.MyRoutine with the full URL string as argument:
See also: http://user.services.openoffice.org/en/ ... rl#p214392 where you can copy function getArgumentFromURL.
calls the following macro MyLibrary.MyModule.MyRoutine with the full URL string as argument:
Code: Select all
Sub MyRoutine(sURL$)
print sURL 'prints the above URL
myArg = getArgumentFromURL(sURL,"MyExtraArg")
print myArg 'prints AnythingElse
End Sub
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
brunnerdan
- Posts: 43
- Joined: Tue Nov 29, 2011 12:41 am
Re: Running a macro when clicking in a Hyperlink in Writer
Thanks for this feature that I didin't know but is not exactly what I need.
I try to give some more explanation. Lets say that I add a description in a writer document that points to a website (for example Oracle = description, URL = http://www.oracle.com). When I open the writer document and I <crtrl>+<mouseclic> on the Oracle, I open the website of Oracle in a webrowser. My wish would be able to define a specific macro that is called if Iwhen I make a <simpleclic> on Oracle.
I hope that my explanation is clear enough.
I try to give some more explanation. Lets say that I add a description in a writer document that points to a website (for example Oracle = description, URL = http://www.oracle.com). When I open the writer document and I <crtrl>+<mouseclic> on the Oracle, I open the website of Oracle in a webrowser. My wish would be able to define a specific macro that is called if Iwhen I make a <simpleclic> on Oracle.
I hope that my explanation is clear enough.
OOO 3.3 on Solaris/Windows
Re: Running a macro when clicking in a Hyperlink in Writer
I think you can not have what you want easily. Hyperlinks pointing to Oracle.com point to nothing but Oracle.com. Anything else would be a security flaw.
This is the best I can get with some copied Basic code:
This is the best I can get with some copied Basic code:
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice