Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


kennethD
2008-12-11T18:31:21Z
I am trying to use {PATH(GetExtension,{TRIGGER(Active,LastTrigger,File.Result.Name)}}, but what ends up being returned is {PATH(GetExtension,filename.txt}, instead of what I expected to be returned - .txt

I tried it entered directly into a task, and as a user variable. Neither worked.

I have had success nesting lasttrigger within the string.replace function.

I have not had success in nesting multiple functions - like trying to strip an extension using string.replace, then removing a datestamp by using string.trimchars so filename20081211.txt as a trigger would end up as filename.

Any help is appreciated.

-Kenneth

Sponsor
Forum information
ErikC
2008-12-12T08:30:13Z
I think I know what is happening here... 🤔

The nested function is working, but if you have a '(' in your filename, it won't work.
This could be the case because the variables of VC uses the '(' for it's own notation.

Even if you try to set the filename 1st to a variable and use this variable in the get extention method, it will fail. (when the filename has '(' in it)

I thought of using the replace method to remove the ( out of the filename, ... but you might have guessed: because of the '(' the replace function is also not working.

The functions are not looking from ',' till ',', but will break if you use a '('. I tested encapsulation of a string with quotes, but also no go..
ohhh, and comma's and { are also allowed in filenames....

So parsing the functions has to be rewritten I think to make this work in every function.

How can this be solved?
:-k
Uses Visualcron since 2006.
ErikC
2008-12-12T09:36:46Z
I have a solution for you, but this is using a 3rd party utility (freeware) called LMOD from Horst Schaeffer.
The version I tested this with is 1.3

I did not include a link to the utility (don't know id I'm allowed to do so) but google for it and it is you 1st hit.

What you do is the following:

Task     : Execute
Command  : C:\WINDOWS\system32\cmd.exe
Arguments: /C ECHO {TRIGGER(Active,LastTrigger,File.Result.Name)} | LMOD /s. [$!]


(set the working dir to the LMOD dir)

What does it do? You echo the filename and you send the output toLMOD (with the use of the pipe).
With the /s you give a delimiter, so /s. uses the . as delimiter.
Between the [] stands the full echo output, but if you use a $ you can get a specific part if you use a delemiter (and we do).
With the $! you get the last part.

So the output of the task will be the extention of the filename (whitou the period).
If you do want the period, use the following arguments:

/C ECHO {TRIGGER(Active,LastTrigger,File.Result.Name)} | LMOD /s. .[$!]

There is a period just before the [$!]

Hope this can help you with your jobs. 🖐

Regards
Erik

Uses Visualcron since 2006.
Support
2008-12-14T19:27:30Z
Instead of comma you can use pipe like:

{PATH(GetExtension|file.txt)}
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
ErikC
2008-12-14T21:58:42Z
That could work for him, but I think the filenames of kennethD contains the character '(' when failing the task.
Btw, kennethD what can you tell us more about the filenames. It's a bit quite on the other site.. ;-)

Regards
Erik
Uses Visualcron since 2006.
kennethD
2008-12-15T17:34:09Z
Thanks to both of you for the help - I have it solved. Turns out, Erik, you led me onto my solution: PEBKAC. You asked about the parenthesis within my filename, which I don't have in my filename. But, upon further inspection, realized that when I nested the two functions, I omitted the right parenthesis of the outer function. So...correcting that little issue got me working...

Thanks to you both!!
:-&
Users browsing this topic
Scroll to Top