GP SoftwareTwitter
Opus FAQsManualCommandsObjects

Assign selected file/foldername as a value to a variable?

I've just started to learn more about using variables in DOpus. I may have overlooked something,
but is it possible to assign the selected file or foldername as a value to a variable?

This doesn't work:

@SET test={o|noext} CREATEFOLDER "{$test}"
(just an example, it can be done by using CREATEFOLDER {o|noext}, but i would like to know if the above is possible...)

Also found this:(:

If you use a MS-DOS Batch Function button, each one of the following codes will work :smiley:

@runmode hide @set test = "{o|noext}" mkdir {$test}

@nofilenamequoting @set test = {o|noext} Createfolder "{s}{$test}"

Regards

Searcher123, thank you for your reply!

So, when I use variables, i must always select 'MS-DOS Batch Function'...
But could you explain what you mean by: "DOpus cannot set the value of {o} , {f}, etc. to a local variable in many cases''.

Regards, Cris

Of course not always :slight_smile: just when you want to define a local variable of DOpus internal file(s)/Path(s) variables (i.e {o}, {f}, etc). Other variables will be defined without any problem under Standard Function mode.

Apparently the Leo method will be worked too, however, I didn't test it under different situations. I just can say Leo know DOpus much better of me and I learn many things of his letters. You could use his method under Standard Function and if not answered, test my method afterward.

Hmmm....Hardly ever I have saw I can define a local variable of DOpus internal file/path variables under Standard Function mode without any problem. I cannot remember that situations, but my experience is learned me I have not to define a local variable of DOpus internal file/path variables under this mode. Always I use MS-DOS Batch Function for this purpose.

Best Regard

Ok, it's all clear to me now (i hope...):

1. When i want to use Files or Paths arguments there are 2 options:

a. Use Opus standard function and the @runonce modifier:

@nofilenamequoting @runonce:@set dirname={o|noext} CREATEFOLDER "{s}{$dirname}"

OR:

b: Use MS-DOS Batch Function without the @runonce modifier:

@nofilenamequoting @set dirname={o|noext} CREATEFOLDER "{s}{$dirname}"

2. When i use Dialogs or Miscellaneous arguments:

a: Use Opus standard function without the @runonce modifier:

@nofilenamequoting @set dirname={dlgstringS|Enter name of folder|Name} CREATEFOLDER "{s}{$dirname}"

OR:

@nofilenamequoting @set dirname={date} CREATEFOLDER "{s}{$dirname}"

3. When i combine Dialogs or Miscellaneous arguments and Files or Paths arguments:

a. Use Opus standard function and the @runonce modifier:

@nofilenamequoting @runonce:@set dirname={dlgstringS|Enter name of folder|{o|noext}} CREATEFOLDER "{s}{$dirname}"

OR:

b: Use MS-DOS Batch Function without the @runonce modifier:

@nofilenamequoting @runonce:@set dirname={dlgstringS|Enter name of folder|{o|noext}} CREATEFOLDER "{s}{$dirname}"

Conclusion: Isn't this a bit inconsistent? :wink:

I filed a report to GPSoftware along those lines earlier today.

@Leo: Thank you for filing a report!

You have classified the threat very fine :smiley:

I must mention just two thing:

1. [quote="Christiaan"]
2. (...)

@nofilenamequoting @set dirname={date} CREATEFOLDER "{s}{$dirname}"

(...)
[/quote]

If your system used the "yyyy/mm/dd" format for date, you will receive an error in any situation, because "/" is not reliable in a Dir/File name.

2.

[quote]3. (....)

@nofilenamequoting @runonce:@set dirname={dlgstringS|Enter name of folder|{o|noext}} CREATEFOLDER "{s}{$dirname}"
[/quote]

@runonce: is not need under MSDOS Batch Function :wink:

Regards

@searcher123:

@runonce: is not need under MSDOS Batch Function:

Yes, it's a typing error (or: copy-paste error), but i couldn't edit my own post...

If your system used the "yyyy/mm/dd" format for date (...)

I just used the {date} argument as an example :wink: