Madlik, Monika (LNG-VIE) wrote:
>
> I tried to write a macro-command which searches for a file in several
> subfolders.
>
> This is my current macro:
>
> <cfg:command name="holen">
> <cfg:macro>
> <cfg:sequence>
> <cfg:command name="prompt" parameter="'Zu suchende
> Judikatennummer...' 'Judikatennummer:'"/>
> <cfg:set variable="judnum" expression="%_" plainString="true"/>
> <cfg:get expression="$judnum"/>
> <cfg:command name="XXE.open"
> parameter="file:///H:/judikatur/%_.xml"/>
> </cfg:sequence>
> </cfg:macro>
> </cfg:command>
>
> At the moment the file will be opened, if it is located at
> H:/judikatur/. But - needless to say - not if it is located at
> H:/judikatur/ar/ or H:/judikatur/str/ (There will be more subfolders
> than these two!).
>
> Is it possible to sift through different subfolders and, if the searched
> file is found, to open it at XML-Mind?
>
Yes. This macro works fine on my Linux box.
---
<cfg:command name="openDocument">
<cfg:macro>
<cfg:sequence>
<cfg:command name="prompt"
parameter="'Document name'
'Document name (without the .xml extension):'"/>
<cfg:command name="run"
parameter="find /home/hussein/src/xxe/docsrc/
-name '%_.xml'"/>
<cfg:get expression="substring-before('%_',' ')"/>
<cfg:choice>
<cfg:sequence>
<cfg:test expression="string-length('%_') = 0" />
<cfg:command name="alert"
parameter="Sorry, I don't find this document!"/>
</cfg:sequence>
<cfg:command name="XXE.open" parameter="%_"/>
</cfg:choice>
</cfg:sequence>
</cfg:macro>
</cfg:command>
<binding>
<keyPressed code="F4" />
<command name="openDocument" />
</binding>
---
You'll have to adapt it to your environment. That is, on Windows, you'll
have to find an equivalent of Unix command "find".
http://en.wikipedia.org/wiki/Find