Extract original filename

Discussions and Tech Support related to website data extraction, screen scraping and data mining using iMacros.
Forum rules
iMacros EOL - Attention!

The renewal maintenance has officially ended for Progress iMacros effective November 20, 2023 and all versions of iMacros are now considered EOL (End-of-Life). The iMacros products will no longer be supported by Progress (aside from customer license issues), and these forums will also no longer be moderated from the Progress side.

Thank you again for your business and support.

Sincerely,
The Progress Team

Before asking a question or reporting an issue:
1. Please review the list of FAQ's.
2. Use the search box (at the top of each forum page) to see if a similar problem or question has already been addressed.
3. Try searching the iMacros Wiki - it contains the complete iMacros reference as well as plenty of samples and tutorials.
4. We can respond much faster to your posts if you include the following information: CLICK HERE FOR IMPORTANT INFORMATION TO INCLUDE IN YOUR POST
Post Reply
skabaas
Posts: 16
Joined: Mon Sep 06, 2010 9:03 am

Extract original filename

Post by skabaas » Mon Sep 06, 2010 9:11 am

Is there a way to extract the original filename (preferably WITH the extention) of, or full path to the file you've just downloaded using ONDOWNLOAD ? I do not want to change the original filename, but I have to use the full path to the file later on in my script code, to be able to send an e-mail with the file attached...
skabaas
Posts: 16
Joined: Mon Sep 06, 2010 9:03 am

Re: Extract original filename

Post by skabaas » Tue Sep 07, 2010 7:38 am

Anyone? I'm really stuck here... :(
Tom, Tech Support
Posts: 3834
Joined: Mon May 31, 2010 4:59 pm

Re: Extract original filename

Post by Tom, Tech Support » Thu Sep 09, 2010 9:47 pm

Hi skabaas,

Sorry, this is currently not supported, but it's a great suggestion and I've added it to our feature request list.

You could devise another way to retrieve the filename using script code, but it would be a bit more involved. For example, you could download the file into an empty folder, then use the FileSystemObject to retrieve the name of the only file in that folder.
Regards,

Tom, iMacros Support
skabaas
Posts: 16
Joined: Mon Sep 06, 2010 9:03 am

Re: Extract original filename

Post by skabaas » Tue Sep 14, 2010 9:49 am

Tom, iOpus wrote:Hi skabaas,

Sorry, this is currently not supported, but it's a great suggestion and I've added it to our feature request list.

You could devise another way to retrieve the filename using script code, but it would be a bit more involved. For example, you could download the file into an empty folder, then use the FileSystemObject to retrieve the name of the only file in that folder.
Great, thanks! I solved my problem (for now) using the following VB.net code (I'm using iMacros in combination with VB.net):

Code: Select all

'Use LINQ to retrieve all the files and order them by creation date descending.
Dim allFiles = From path In System.IO.Directory.GetFiles(downloadLocation) _
Let files = New System.IO.FileInfo(path) _
                Order By files.CreationTime Descending _
                Select files

'The first file in the allFiles variable is the newest File!
Dim newestFile As IO.FileInfo = allFiles.First
Post Reply