Extracting part of file name

Discuss RoboTask here
Post Reply
Robasso
Posts: 4
Joined: Sun Sep 07, 2008 5:16 am

Extracting part of file name

Post by Robasso »

Hi,
I'd like to create a task that can recognize which part of a file name it needs to copy. Files (they're pfds btw, but I guess it doesn't matter) are always formatted as:
author - year - title.pdf
of which I'd like to copy only the "title" part. What would be the easiest way of doing this?
Thanks in advance,
Rob
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Extracting part of file name

Post by Oleg »

You may use "delemit variable" action.

Suppose you get the file name in the file loop
C:\myfiles\John Smith - 1995 - My book.pdf

In order to extract filename only use variable {ExtractFileNameNoExt()}.
You will get the string "John Smith - 1995 - My book"

Next, use delemit variable and you get standartd comma-separated string: "John Smith","1995","My book"
If you store the result into variable MyVar (for example) you can get any part by number, like this:
MyVar(0) = John Smith
MyVar(1) = 1995
MyVar(2) = My book
Last edited by Oleg on Mon Sep 08, 2008 11:24 am, edited 1 time in total.
Robasso
Posts: 4
Joined: Sun Sep 07, 2008 5:16 am

Extracting part of file name

Post by Robasso »

Thanks!
It works brilliant now!
Great software!
Rob
Post Reply