Internal variable usage - and alternatives?

Well, not sure if there are any plans to extend the internal commands and functions in this direction - but here goes:

I'd REALLY REALLY love to be able to assign the results of various internal (and hey - external too) functions to Dopus variables. This could allow for more complex macro routines without having to resort to the kind of kludgey things I've tried doing by combining Dopus with external apps... case in point:

To get around some strange behavior I've seen for awhile with the commands discussed in this thread in order to copy/move files to a new folder created in the destination directory, I started trying something like this instead:[b]runmode hide sync:dopusrt /cmd setx.exe mypath "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}" sync:dopusrt /cmd CreateFolder %mypath% sync:dopusrt /cmd Copy MOVE TO %mypath%[/b]It 'would' work if the setx.exe from the MS resource kit exposed the variable you set with it within the same environment instance, but it doesn't. So after it's initially set the first (at which point the command fails) subsequent usages of this command 'work' but always move the itmes to the 'previous' path stored in the variable.

If we could do something like this:[b]sync:dopusrt /cmd [u]DSET[/u] mypath "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}" sync:dopusrt /cmd CreateFolder {%mypath%} sync:dopusrt /cmd Copy MOVE TO {%mypath%}[/b]...it would fix this problem and open the door for new functionality (and bugs you say :slight_smile:?)

Failing that, for the copy/move to new folder commands purpose above it would be nice to have an additional option for Dopus' Copy command that would act a bit like the /I arg for WinXP's xcopy command... this would allow a single command something like this to work:[b]dopusrt /cmd Copy MOVE TO [u]NEWDIR[/u] "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}"[/b]Or like this:[b]dopusrt /cmd Copy MOVE TO CreateFolder "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}"[/b]...if we could stack commands like Copy and CreateFolder together.

As it it is, I've opted to do this to get around all of this:[b]sync:dopusrt /cmd CreateFolder {d}\foo sync:dopusrt /cmd Copy MOVE TO {d}\foo sync:dopusrt /cmd Rename TYPE=dirs {d}\foo "{dlgstring|Specify the folder-name in {d} to create and MOVE items to...}"[/b]...and I dislike it quite a bit :frowning:. Thoughts, criticism, alternatives?

Hi Steje !

Just a quick reply here.
I've only been glancing at the forums lately as I've been quite distracted by other 'pursuits' ....

I understand what you're attempting here and I was actually thinking of a similar problem earlier today.
But that's another thread.

This can probably be done using batch files and 4NT.
John Zeman also uses 4NT.
We both found some time ago that Dopus users really aren't interested much in it, but John and I can converse about it.

More to the real point of your question, I'm wondering if a C++ program can be written to accomplish the following:

  1. Allow a user to create a Dopus 'variable' or perhaps a few 'variables' by writing ( appending ) them to a text file.
    Even I can write this part.

  2. Allow a user to read the text file to access the value of a Dopus 'variable'.
    Even I can write this part.

  3. Output the result to the clipboard.
    It takes Nudel to write this part.
    Unfortunately, this would not be very useful unless the contents of the clipboard could be retrieved as well.

There would also have to be a command to delete the textfile.
What operations the program could perform on these Dopus 'variables' in open to conjecture, but would probably be very limited.
It would be up to us to use it so that Dopus gets intellegent data chronologically from it.
Obviously, more thought is needed before anyone attempts to write this.

Regards,
:opusicon: porcupine

ActiveX scripting is the answer to this. No need to reinvent the wheel, although adding comprehensive scripting support to Opus is still no mean task.

Porc:
Long time no read, hope you're well - I wouldn't be as opposed to 4NT (I bought 4Dos once upon a time) as some - I just wasn't looking to but more software at the moment :slight_smile:.

Nudel:
Not that I know the first thing about ActiveX scripting, but knowing you I'm sure it's a way to go...

both:
I guess by 'alternatives' I was hoping there was some facility in Dopus I just wasn't aware of to do this 'type' of thing... but hey, since I don't have an acceptable solution for the particular copy/move thing I used as an example for the use of such 'internal' functionality I won't spite myself a solution to this particular problem - though I'd still like to see something like this offered within opus.

So for the copy/move to folder specific thing, either of you have any suggestions on where to find some decent ActiveX scripting documentation?

Hi Steje !

4Dos is now obsolete and freeware.
4NT runs much faster, but one of my favorite 'tricks' no longer works.
With 4Dos I could pipe the output of a command line program directly to an environmental variable.
The syntax is ( err, was ) program.exe [options] | input %%data .

Since you have a registered copy of 4Dos, you can upgrade to the current versions of 4NT, either ANSI or Unicode, for $29.95 US .

I think this thread is relevant to what Nudel was saying.
If that is what he meant, PHP does support ActiveScript. :smiley: :sunglasses: :smiley:

Regards,
:opusicon: porcupine

there is no webspace.
i have attachments.
look.

2

3

4

5

6

7

8

?

what i didi is lend the workspace of the cmd-process opus runs in.

so ->
runmode hide
sync:dopusrt /cmd setx.exe mypath "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}"
sync:dopusrt /cmd CreateFolder %mypath%
sync:dopusrt /cmd Copy MOVE TO %mypath%

would be ->
runmode hide
zSetVar "mypath" "{dlgstring|Specify folder-name to create and MOVE items to...|{d}}"
zDOpusrt "CreateFolder %mypath%"
zDOpusrt "Copy MOVE TO %mypath%"
zCleanVar "mypath"


BUT this is just a funny thought though

yurs rfolic

OK,
Why use the Dos Call command here for programs instead of Batch Files?
From an HTML Dos manual I have :

[code]
CALL is used in batch files to invoke a second batch file as a sub-routine.
When the sub-routine finishes, control returns to the parent batch file.
This is in contrast to simply invoking a secondary batch file by name,
in which case control does not return to the primary batch file.

CALL will also work with Dos commands and programs.
However, there is little point in doing this,
as in both cases these can be invoked directly from the batch file and control will be returned on completion. [/code]

:opusicon: porcupine

Second Note:

This thread is really very old, and I'm not at all certain you have fully grasped its' point.
Post 5 indicates this. It's really not that simple and that was the point of the entire thread.

It's a very valiant attempt though and I congratulate you for your efforts !!

The good news is that this function is now natively supported in Dopus.
See this thread .

:opusicon: porcupine

Third Note:

It's not likely that we will see internal variabes or programming branches in DOpus anytime soon, if ever.
The idea of this was kind of killed in this thread, if I understand it correctly.

Until then, we can use command processor replacements such as 4NT,
PHP command line scripting, or command line programming.
PHP has the advantage that it is free and extremely powerful,
but it can possibly freeze your system if the script is incorrect.
See this thread.

:opusicon: porcupine

DOpus does not need any internal variables. The DOpus user commands allow a style of functional programming (albeit without support for control flow (such as branching) and mathematical formulas). Wikipedia link on functional programming: en.wikipedia.org/wiki/Functional_programming

You are making things way more complicated then needed.

Consider the following procedural program
(f and g are functions that do 'something useful' with their argument):

Var = Expr
f(Var)
g(Var)

This can be expressed in a functional style by the program:
def h(param) = f(param) ; g(param)
h(Expr)

This is a bit abstract so look at the example in this thread.

Create a new command:

Name= CopyToNewFolder
Template= mypath
body=
sync:dopusrt /cmd CreateFolder &mypath&
sync:dopusrt /cmd Copy MOVE TO &mypath&

Use it like this:

sync:dopusrt /cmd CopyToNewFolder MYPATH={dlgstring|Specify folder-name to create and MOVE items to...|{d}}

Hmmm... to Caine:

I saw another post you made to a user suggesting using a 'User' command in a similar fashion and meant to reply to it saying that I had not come across anyone using the commands in this way. You've taught me somethign here that I wish I would have been more familiar with before. Interesting...

Note- I'd imagine none of the sync: statements are actually needed in the examples Caine gave - he was probably just leaving them there since they were part of what we had originally been using earlier in the thread.