qiuqiu
September 3, 2019, 8:11am
1
HashFile.zip (491 Bytes)
<?xml version="1.0" encoding="UTF-8"?>
<usercommand backcol="none" hide_from_menu="no" textcol="none">
<label>HashFile</label>
<tip>Generate hash file.</tip>
<template>Type/K[MD5,SHA1]</template>
<user_label>Generate MD5 hash file.</user_label>
<icon1>#opus12flattaeicons:calcmd5checksum</icon1>
<function type="normal">
<instruction>@nodeselect </instruction>
<instruction>@disablenosel </instruction>
<instruction>Clipboard COPYNAMES=hash2 </instruction>
<instruction>Clipboard PASTE AS checksums.md5</instruction>
<instruction>Clipboard SET ""</instruction>
</function>
</usercommand>
How do I get the value of the "type" field from the command? And set the file name for "Clipboard PASTE AS" based on this value?
Leo
September 3, 2019, 11:25am
2
With a Type/K
argument, use &Type&
to insert the parameter that was given to it.
(Documented here: User-defined commands .)
qiuqiu
September 3, 2019, 1:17pm
3
How to determine the value of the "type" parameter?
@ifset:&TYPE&="MD5"
Clipboard COPYNAMES=hash2
@ifset:&Type&="SHA1"
Clipboard COPYNAMES=hash5
or
@if:&TYPE&="MD5"
Clipboard COPYNAMES=hash2
@if:&Type&="SHA1"
Clipboard COPYNAMES=hash5
The value of the "type" argument was not taken.
Leo
September 3, 2019, 1:27pm
4
You would need to use scripting to do conditional branching based on the value of an argument.
Jon
September 4, 2019, 1:38am
5
In the next update we'll make it so you can do simple tests on the arguments without resorting to a script. The following command will work from 12.16.5:
@if:&&TYPE&&=MD5
Clipboard COPYNAMES=hash2
@if:&&TYPE&&=SHA1
Clipboard COPYNAMES=hash5
qiuqiu
September 9, 2019, 6:17am
7
Clipboard PASTE=enc:utf16 AS checksums.&TYPE&
return filename
checksums.&TYPE&
can not get the value of the "type" keyword.
Directory Opus 12.16.5.0