How to make 'create shortcut to current folder' button?

I would like to make my own favorites button and I need a function that would make a shortcut to the current folder im in.

I read all there is about Dopus raw commands but couldn't figure out how to do it.

Is it possible?

Anyone?

Here's a command that should work for you:

COPY MAKESHORTCUT

See How to use buttons and scripts from this forum for how to use it.

The COPY MAKESHORTCUT will create the shortcut in the destination lister. So, if you have two listers (or a lister in dual mode), it will put the shortcut in the other folder. If you want it to always make the shortcut in the same folder, we add a 'HERE' option, like so:

COPY MAKESHORTCUT HERE

Good luck!

--
Ric Fischer
The guy with a real name.

1 Like

Easiest thing to do is right-click the :opusicon: icon in the titlebar and, still holding the mouse button down, drag it into the lister, then choose Create Shortcut Here.

I think you could do the same thing via a button if you want, but do you want the shortcut to end up in the same directory as it points to or in some other place? The answer to that changes how the button works to some degree so let me know...

(Posted before I saw Ric's response. Maybe still useful, depending on exactly what you want to do. I'm pretty sure you can make a button which does the makeshortcut on the current directory (rather than a selected directory) but the exact format depends on where you want the resultant shortcut to be.)

To RicFischer:
That's the first time I see those commands! It's not in the manual. How did u find out about it?

To Nudel:
I still haven't tried out RicFischers button cause I'm at work so I don't know if thats what I'm looking for.

I want to create my own favorites button (and folder as well). 'My Favorites' folder would be somewhere in My Documents.

With right click on my button I could add current folder I'm in to 'My Favorites' so I need a function that would put a shortcut there.

Left click on my button would show a menu with all the shortcuts from 'My Favorites' folder (and maybe some more customisations).

Hope this time its more clear.

Regards, Raisers

Raiser,

First, the "COPY" command is in the manual and the help file. To find the "MAKESHORTCUT" part I used, just search for "MAKESHORTCUT" in either help or the manual. If you pay close enough attention, you'll see that MAKESHORTCUT is an option of the COPY command.

As for your "My Favorites" idea, do you realize you're kind of reinventing the wheel, so to speak?

Have you tried playing around with the "Favorites" menu in DOpus?


Ric Fischer

1 Like

RicFischer:
I'm sorry I was looking at your commands very briefly and thought that all of that text u typed goes into advanced menu of button edit window.

I actually thought Name, Color, Icon, Flags, Func1 were raw commands :slight_smile: And its not reinventing the wheel its customizing and improving it.

And to answer u thats not what I'm looking for.
Copy MAKESHORTCUT (HERE) would only make a shortcut of SELECTED files and folders and not of a CONTAINING FOLDER what I'm looking for.

So, the q still stands - how to make a shortcut of containing folder (not selected folders and files) in dopus with a button?

(Edit November 2020: The below is no longer necessary. You don't need to use DOpusRT at all for this these days.)


You have to use the DOpusRT trick to get the current directory into the command's arguments, but it works fine.

Here you go:

dopusrt /cmd Copy FILE {sourcepath$} MAKESHORTCUT TO {sourcepath$}

If you want the shortcut created somewhere other than the current directory, just change the second {sourcepath$} into the place you want the shortcuts to end up.

If you're using Opus 6 you'll have to give the full path to DOpusRT.exe instead of just "dopusrt" at the start of the command. e.g. "c:\program files\gpsoftware\directory opus\dopusrt.exe" /cmd Copy ...

Thanks nudel, thats what I was looking for.

Now, if I put all the shortcuts to folders and files into one folder named 'my shortcuts', how can I make a menu button that that automaticly shows all the containing shortcuts from that folder?

Regards, Raisers

If you want the shortcuts to be listed in a menu you're better off using the Opus favorites system which does all this, including making a shortcut (favorite) to the current directory, adding all the shortcuts to menus and also, if you like, being able to have several folders of different shortcuts and showing different folders in different menus.

I would like to have 'favorite programs' as well in my favorites and dopus only puts folders into favs.

I could put them manualy on a toolbar menu button but that's not elegant.

This is what I want:

Button menu 'Favorites'

Favorite programs (submenu) -> Add file to favorites (button)
program1
program2
program3
Add folder to favorites (button)
Edit favorites (button)
Favorite list

I can do favorites nicely but not favorite programs submenu.

(Edit November 2020: Opus can show directory lists inside toolbars/menus these days. The below is no longer accurate for current versions.)


I see... Don't think you can do what you want right now, since Opus can't show directory lists inside toolbars/menus and I don't think you can put files into the Opus favorites, as you say. (I could swear that you could but I must be thinking of something else as I can't get it to work now!)

Hi Ric, thank you for your code, button works well. Help me please, I don't want to have the " - Shortcut" added at the end, how can I achieve that?
Stay safe!

Uncheck Preferences / File Operations / Options / Append " - Shortcut" when creating shortcuts.

2 Likes