File Naming in conjunction with scanning software

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

File Naming in conjunction with scanning software

Post by snapper1969 » Thu May 03, 2007 12:34 pm

I don't know if this is possible.

I have to scan 300 A4 sheets using Omnipage software and save each one with a different filename. The filenames that I need to use are in a separate textfile.

Thx,

John

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu May 03, 2007 12:40 pm

Yes, that's possible. Just loop through the file with the ReadLn function - see the help file. In each loop iteration perform the scan and output using the line read by ReadLn as the filename.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

snapper1969
Pro Scripter
Posts: 50
Joined: Fri Mar 23, 2007 10:14 am

Thnaks

Post by snapper1969 » Fri May 04, 2007 7:47 am

Thanks Marcus, it works a treat. The software appends and underscore and 4 digits to the end of the filenames for indexing, is there a way to rename all the files to take away the appended stuff?. Is it a getfiles and another loop?.

Thx,

John

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri May 04, 2007 8:05 am

Hi,

You can use string manipulation commands. E.g. the following code is one way to find the position of the underscore and remove it plus the following 4 characters:

Code: Select all

Let>filename=somefile_1234.dat
Pos>_,filename,1,p
Let>en1=p-1
MidStr>filename,1,en1,part1
Let>st2=p+5
Length>filename,lenf
MidStr>filename,st2,lenf,part2
Let>filename=%part1%%part2%
MessageModal>filename
Not sure if that's exactly what you want but hopefully you get the idea. A more elegant approach would be regular expressions using VBScript, but that's not for everyone.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts