GP Software β€’ Twitter
Opus FAQs β€’ Manual β€’ Commands β€’ Objects

Making folder for a file based on file name

#1

Hi guys! :slight_smile:
I have a question about a function I want. I don't know if it is solveable by using the Dopus script or not, or if this function are possible by using the existing functions in Dopus.

I need a function that works like this;

  1. I select a file.
  2. I right click at that file and choose "make a folder with same filename and put file in that folder"
    Just like winrar do "extract to separate folders", only opposite so to speak :slight_smile:
    Preferrably it would work on multiple files.

How should i proceed?
I have never tried Dopus scripting so i have no idea whether this can be fixed using that.

#2

This button should do the trick for you.
New Folder = FileName.dcf (552 Bytes)

this other button does the opposite
names the file the folder name
FileName = FolderName.dcf (605 Bytes)

#3

Try this:

Rename REGEXP IGNOREEXT PATTERN="(.*)" TO="\1\\\1"

Move into New Folder with same name.dcf (415 Bytes)

#4

To add the command to your right click menu, see image below:

#5

Thank you very much guys! :slight_smile:
I placed it on the toolbar and got it to work, even for multiple files!!
But how do i attach it to the context menu?
I'm an idiot, plz explain :slight_smile:

#6

That's what the image above is showing :slight_smile:

Settings / Filetypes / All files / Context Menu Tab / New / Add Action Name (i.e. Move to new folder with same name) then add the code into the box at the bottom of the dialog.

@Leo I think it would be useful if we could drag a .dcf file into the context menu. We can already drag an existing item from one context menu to another so why not a .dcf file as well?

1 Like
#7

Oh yeah. It went better when i ignored the *.dcf file and just pasted the code. :slight_smile:
Thank you :slight_smile:
But how do i do it if i have a dcf-file and no code, and want the function of the .vcf file in a context menu?

#8

...and is there a downloadable opus scripting manual anywhere?
Searched a little, couldn't find any.
A manual with examples and stuff, that starts with the easy things and work its way up?

#9

If you only had a .dcf file, you could put it on a toolbar temporarily and then edit it to see which commands it runs, then paste them into a context menu item.

.dcf files are also text/XML, so you can often just open them in a text editor or the viewer pane to see what they do. But be careful of things like quotes which get encoded to " in the XML, and things like that, which you don't need to worry about if you do it the other way.

Context menus and toolbars are quite different behind the scenes (not least because context menu items might be stored in the registry and need to work outside of Opus, depending on the type of item). That's why .dcf files can't be dragged directly into context menus like they can with toolbars. (Of course, nothing is impossible, so the ability to add that might be added one day, but it has some complexities.)

Push F1 in the program, or use the Manual links at the very top-right of the forum, or on the main GPSoft site.

1 Like
#10

Ok, it worked flawlessly :slight_smile:
And if i want to do the opposite?

  1. Select a folder
  2. Move the file(s) in that folder one step up in the catalog structure and remove the folder
    ?
    If you can make it in script form i would appreciate it :slight_smile:
    It seems code is easier to incorporate into context menus :slight_smile:
#11
@dirsonly 
Rename FROM={filepath$}* TO={filepath$|..}*
Delete {filepath$} NORECYCLE SKIPNOTEMPTY QUIET
2 Likes
How to move multiple files from multiple sub-folders down one level?
#12

Thanks!:slight_smile:
It all works now, thank you very much :slight_smile:
And to the rest of you, thanks for the help :slight_smile:

2 Likes