How can I call a group of DOpus commands when launching Opus?
I would like to do something like:
./dopus.exe /cmd 'Toolbar "Tablet Mode" LOADSET=replace; SET FORMAT="Touch Format"; SET FORMATLOCK=on; SET HIDESYSTEMFILES=on; SET LISTERCMD=maximize; SET LISTERTITLE="dOpus Touch (%N)"; SET SHOWCOMPATIBILITYFILES=off; SET TREE=off; SET FONTSCALE=175; SET METAPANE=off; SET VIEWPANE=off'
Semicolon doesn't seem to work for combining commands... Ultimately I want to create a shortcut pinned to the start menu that will call Opus with these parameters.
There are a number of ways you can do it, but if all you want is an icon you can double-click to run an Opus command, create it as a toolbar button in Opus and then (in Customize mode) drag and drop the toolbar onto the desktop to create a .dcf file.
#1. The .DCF isn't a good option for me because the process to pin a .DCF to the Windows 10 start menuseems to be a hack, and with Windows updated so frequently, I don't want to use a method that has such a strong possibility of breaking so easily.
#2. I'm not sure what command should be added to the first line of the .DCF instructions so that a new window will be opened if DO isn't running or modify the front most window if DO is already running. I've tried many permutations of "dopusrt /acmd Go /desktop" or "dopusrt /cmd Go /desktop" or "dopusrt /open" or "dopusrt /show" or "dopusrt /runopus"...
Personally, this has been extremely frustrating. In spite of reading the entire PDF manual, some large scale scripting language development experience, and many years of Unix sysadmin experience, and using DO for almost a year, I still find there are so many nuances about exactly how DO works, it's very difficult to anticipate what will be easy and what will be extremely difficult. Difficult to anticipate how components may interact, and when to use some of the different tools.
I was always a huge Perl fan (TMTOWTDI - there's more than one way to do it) but with DO I can't even guess which direction I should go... The limits of the internal commands vs the scripting language support...
Won't that apply to any method of running the command from outside of Opus? The problem I've found is that the Windows 10 start menu doesn't let you pin things to its top level unless they are somewhere else in the Start Menu already. (It's a bug in Windows 10, IMO, and very annoying, but not specific to .dcf or anything in Opus. I had to jump through hoops to pin a .VBS script file to my start menu, which used to be easy in Windows 7.)
What do you want to do overall, including what happens after that first line? It sounds like something you can do from a simple .dcf file, unless you want to be able to re-use the same sequence of commands and pass it arguments (e.g. which folder to open) to create lots of start menu shortcuts without duplicating/editing the whole set of commands into each shortcut. If you want to do the latter then a user-defined command or script add-in is the way to go, but otherwise a .dcf file will probably be easier.
If you tell us more about what you're trying to do then we can advise on the best way to do it.
I use Opus in two modes on my Surface Pro 4. Day to day (with keyboard attached) I use "Desktop Mode" but I also need a "Tablet Mode" that lets me easily share pictures/documents when the time is right. During those moments (think elevator pitch) you've got pressure and need everything to go as smoothly as it can.
Problem 1: I've created a "Tablet Mode" button that does transform my default "Desktop Mode" DO Window into a "Tablet Mode" window. However, when I try to launch this .DCF from the desktop, the behavior is different than via the command button... Running the exact same command button code, it simply doesn't launch. I've tried adding dopus commands to the .DCF file, but none of them work as expected when DO doesn't have a window already active.
Problem 2: I would prefer to have a .LNK file to DOpus or DOpusRT that has some command line switch that launches my set of commands, rather than relying on the .DCF file which is one more "loose file" to keep track of as I move between systems, so guidence on how to convert this logic into a "User Command" or "Script Add In" would be appreciated.
Problem 3: I want to launch "Tablet Mode" directly from my Windows 10 Start Menu
Note that tablet mode references my "Tablet Mode" toolbar set and "Touch format" folder format, so let me know if you need those files as well. Layout 'Tablet Mode'.dcf (340 Bytes)
Ooops... To many of these irritating .DCF files on my desktop. Attached the wrong one. Anyway, button code is:
// Toolbar "Touch - Left" STATE=left LINE=1
// Toolbar "Touch - Top" STATE=top LINE=1
Toolbar "Tablet Mode" LOADSET=replace
SET FORMAT="Touch Format"
SET FORMATLOCK=on
SET HIDESYSTEMFILES=on
SET LISTERCMD=maximize
SET LISTERTITLE="dOpus Touch (%N)"
SET SHOWCOMPATIBILITYFILES=off
SET TREE=off
SET FONTSCALE=175
SET METAPANE=off
SET VIEWPANE=off
// Set DUAL=Toggle,Vert,ToggleLayout
It's probably possible via just a .dcf but I have a feeling you'll want to turn this into a script, at least if you ever want it to work with multiple windows or tabs in the future, so we might as well use a script from the start.
Download this and drop it on the Preferences / Toolbars / Scripts list.
// Called by Directory Opus to initialize the script
function OnInit(initData)
{
initData.name = "TabletMode";
initData.version = "1.0";
initData.copyright = "(c) 2016 Leo Davidson";
initData.url = "How to name/call group of DOpus Commands?
initData.desc = "Example script";
initData.default_enable = true;
initData.min_version = "12.0.8";
var cmd = initData.AddCommand();
cmd.name = "SwitchTabletMode";
cmd.method = "OnSwitchTabletMode";
cmd.desc = "Switch existing lister into tablet mode or open a new one in that mode";
cmd.label = "SwitchTabletMode";
cmd.template = "";
cmd.hide = false;
cmd.icon = "script";
}
// Implement the SwitchTabletMode command
function OnSwitchTabletMode(scriptCmdData)
{
var cmd = DOpus.Create.Command();
// Open a new lister if none are already open.
if (DOpus.listers.count == 0)
{
cmd.RunCommand("Go NEW");
}
// Send commands to the last active lister (if we just opened one then it'll be that one).
cmd.SetSourceTab(DOpus.listers.lastActive.activetab);
cmd.AddLine('Toolbar "Tablet Mode" LOADSET=replace');
cmd.AddLine('SET FORMAT="Touch Format"');
cmd.AddLine('SET FORMATLOCK=on');
cmd.AddLine('SET HIDESYSTEMFILES=on');
cmd.AddLine('SET LISTERTITLE="dOpus Touch (%N)"');
cmd.AddLine('SET SHOWCOMPATIBILITYFILES=off');
cmd.AddLine('SET TREE=off');
cmd.AddLine('SET FONTSCALE=175');
cmd.AddLine('SET METAPANE=off');
cmd.AddLine('SET VIEWPANE=off');
cmd.AddLine('SET LISTERCMD=ToFront');
cmd.AddLine('SET LISTERCMD=Maximize'); // Best to do this last.
cmd.Run();