Question

I was wondering if it's possible to create something like a hyperlink in a LibreOffice document that when called, opens a terminal ssh-ing to the selected "hyperlinked?" IP

The issue is that from time to time, I need to connect via ssh to remote machines. I have a LibreOffice .odt (writer) document with a list of those machines IPs'. I'd like to make it so I can click on one of the IPs and it automatically opens a gnome-terminal with an ssh connection to it. Mainly just to avoid having to open a terminal and type ssh myusername@what.ever.ip

I have created a macro that seems to work:

Sub OpenSSH(remoteIP as Integer, Optional remoteSSHPort as Integer)
If IsMissing(remoteSSHPort) then
    remoteSSHPort = 22
End if
sshCommand = "gnome-terminal --command 'ssh -Y -p " + remoteSSHPort + " myusername@" + remoteIP + "'"
Shell(sshCommand)
End Sub

This seems to be working for what I need. Now, I would like to go to my LibreOffice document, select one of the IPs I have listed there, and do something like "Run the 'OpenSSH' routine with the selected ip as a parameter'

I don't really need anything fancy, or having the macro sending passwords or complex things like that. I just need it to open a gnome-terminal running the ssh command.

I am running Ubuntu 11.10 with LibreOffice 3.4.4. And I am a total newbie to the intricate (to me) macros world.

Thank you in advance.

Was it helpful?

Solution

Yes this should be possible. You just need to use the macro URL in the hyperlink.

I use the following URL in one of Libreoffice Calc's automatic tests:

vnd.sun.Star.script:Standard.Module1.Macro1?language=Basic&location=document

As much as I remember the syntax should be protocol:Package.Module.Method

I'm not sure if the rest is neccesary for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top