LibreOffice writer:创建一个打开 ssh 的超链接

发布于 2025-01-06 14:55:14 字数 957 浏览 1 评论 0原文

我想知道是否可以在 LibreOffice 文档中创建类似超链接的东西,当调用该超链接时,会打开一个终端 ssh-ing 到所选的“超链接”? IP

问题是,我有时需要通过 ssh 连接到远程计算机。我有一个 LibreOffice .odt(编写器)文档,其中包含这些计算机 IP 的列表。我想这样做,这样我就可以单击其中一个 IP,它会自动打开一个 gnome 终端并与其建立 ssh 连接。主要是为了避免打开终端并输入 ssh [email protected]

我创建了一个似乎有效的宏:

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

这似乎可以满足我的需要。现在,我想转到我的 LibreOffice 文档,选择我在其中列出的 IP 之一,然后执行类似“使用所选 ip 作为参数运行‘OpenSSH’例程”之类的操作,

我真的不需要任何花哨的东西,或者使用宏发送密码或类似的复杂内容,我只需要它来打开运行 ssh 命令的 gnome 终端,

我正在运行带有 LibreOffice 3.4.4 的 Ubuntu 11.10。复杂的(对我来说)宏世界

提前谢谢你。

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 [email protected]

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

两相知 2025-01-13 14:55:14

是的,这应该是可能的。您只需在超链接中使用宏 URL 即可。

我在 Libreoffice Calc 的一项自动测试中使用以下 URL:

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

据我所知,语法应该是 protocol:Package.Module.Method

我不确定其余部分对您是否有必要。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文