Possible to reference one button from different locations?

I’ve created a menu button that when clicked shows remote desktop connections to a number of different servers I connect to. I added this button to one of the toolbars in dopus but I now I would like to add it to my floating toolbar as well that I have docked at the top of the screen that I use to launch frequent operations.

At the moment i’ve simply copied the button over but as I semi-frequently have to alter the button to add/remove and alter the connections I’m now having to do this twice. Is there anyway to create the button once and reference it from multiple locations, this way I would only need to alter the button once and all the referenced locations would automatically get updated.

Thanks.

You can create User Commands which are defined in a central place and can be referenced from multiple places. User Commands are like individual buttons, though.

What you really want is a centrally-defined sub-menu, containing multiple commands, which can be inserted into other menus/toolbars... I don't think there is a way to do that (other than manually copying the sub-menu into different menus/toolbars).

However:

For a list of Remote Desktop connections you can get what you want using a Go FOLDERCONTENT button.

Create a normal shortcuts or .RDP files for each of the computers you want to connect to and put them in a folder somewhere (I've used /appdata/RemoteDesktop in my example, so they're part of my roaming profile), then create Opus buttons like this to turn that folder into a menu:

Go PATH "/appdata/RemoteDesktop" FOLDERCONTENT

Now you can modify that menu by simply creating/removing files from that folder.

That's an interesting idea, creating a button to show the contents of a folder. If I was just using .rdp files that would be great but i'm routing the remote desktop connection via a ssh connection so the dopus button contains a bit of code.

Each connection looks like this. If you have suggestions by the way on improving the code please let me know.

@set serverIP = 100.100.100.5
@set userName = administrator
@set loopback = 127.0.0.1
@set privateKey = "D:\Remote Desktop Connections\keys\server1.ppk"
@set numOfPings = 4

@async "C:\Program Files (x86)\Putty\plink.exe" -ssh {$serverIP} -C -L {$loopback}:3389:{$serverIP}:3389 -l {$userName} -i {$privateKey}

ping 127.0.0.1 -n {$numOfPings}

C:\Windows\System32\mstsc /v {$loopback}

I'm using dopus variables to store different values and then i'm passing these to putty to make the ssh connection. The only hacky bit is the need for the pings. This is needed because it takes some time to make the ssh connection before I can run the remote desktop command mstsc. Each server take a different amount of time to connect so I have to alter the amount of pings I send for each server.

I seem to have gone off at a tangent here, back to the original problem. Would it be possible to package this soft of code up into some kind of physical file, like a bat file? Then I could use your original suggestion and create a button that lists the remote desktop connections.

Yes, putting those commands into batch files would work fine.

You'd have to change the command slightly since the batch file syntax is different to the Opus button syntax.

Something like this probably:

[code]set serverIP = 100.100.100.5
set userName = administrator
set loopback = 127.0.0.1
set privateKey = "D:\Remote Desktop Connections\keys\server1.ppk"
set numOfPings = 4

start "C:\Program Files (x86)\Putty\plink.exe" -ssh %serverIP% -C -L %loopback%:3389:%serverIP%:3389 -l %userName% -i %privateKey%

ping 127.0.0.1 -n %numOfPings%

C:\Windows\System32\mstsc /v %loopback%[/code]

Thanks Leo, i'll give the batch file idea a go.