Web Recorder question

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
techwriter
Newbie
Posts: 6
Joined: Wed Oct 25, 2006 1:58 pm

Web Recorder question

Post by techwriter » Wed Oct 25, 2006 2:18 pm

I'm attempting to use a variable file name ( uploadname ) as part of the "FieldValue" command, but it doesn't work of course. Here's the code:

Year>runyear
Month>runmonth
Day>runday
Let>uploadname=dailyext%runyear%%runmonth%%runday%.txt

then in the FieldValue I've tried:

Let>FieldValue={"c:\data\daily\uploadname"} didn't work

tried

Let>FieldValue={"c:\data\daily\%uploadname%"} didn't work

Suggestions most welcome. Criticisms humbly accepted.

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

Post by Marcus Tettmar » Wed Oct 25, 2006 2:41 pm

Use:

Let>FieldValue={"c:\data\daily\" + %uploadname%}

Or:

Let>FieldValue=c:\data\daily\%uploadname%
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

techwriter
Newbie
Posts: 6
Joined: Wed Oct 25, 2006 1:58 pm

Post by techwriter » Wed Oct 25, 2006 5:31 pm

Well, I tried both options, neither worked.

when using the second option the Field Value contained:

FieldValue=c:\data\daily\dailyext20061025.txt

this is the correct name
however, the upload did not send any file.

When I hard code the name it works fine but that sort of negates the whole purpose of the variable.

Any other suggestions for me to try? Thanks

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

Post by Marcus Tettmar » Wed Oct 25, 2006 5:34 pm

I don't see what the difference between hard-coding the name and using a variable is. Could you send your entire script? Or at least the part that fails?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

techwriter
Newbie
Posts: 6
Joined: Wed Oct 25, 2006 1:58 pm

Post by techwriter » Wed Oct 25, 2006 5:41 pm

Here you go,

Year>runyear
Month>runmonth
Day>runday
Let>uploadname=dailyext%runyear%%runmonth%%runday%.txt

Let>FrameName={""}
Let>FormName={"SoilSiteIm"}
Let>FieldName={"FileUpload1_File"}
Let>FieldValue=c:\data\daily\%uploadname%
LibFunc>hIE,FormFill,r,%IE[0]%,str:FrameName,str:FormName,str:FieldName,str:FieldValue,0

LibFunc>hIE,WaitIE,r,%IE[0]%
Wait>delay
Wait>30

I ran the script in Debug with Show Watch List option and the variables were set as expected. So I'm confused.
Thanks for your help

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

Post by Marcus Tettmar » Wed Oct 25, 2006 5:47 pm

Is this a file upload box? If so it cannot be scripted. Microsoft have imposed a security limitation on file upload boxes to prevent them from being scripted.

But you say it works when you hard code the value? That is what is confusing me. If it's a file upload (file browse) box then NEITHER should work.

The only thing that WILL work is user simulation:

SetFocus>Microsoft Internet Explorer*
Press Tab * n
Send>c:\some\filename.txt
Press Enter

Where n is the number of times needed to tab to the field. This works because it happens at the user level above the scripting interface.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

techwriter
Newbie
Posts: 6
Joined: Wed Oct 25, 2006 1:58 pm

Post by techwriter » Wed Oct 25, 2006 5:59 pm

Yes, it is a file upload box ( with the appropriate "Browse" button ).
I'll try your suggestion.
Thanks.

techwriter
Newbie
Posts: 6
Joined: Wed Oct 25, 2006 1:58 pm

Post by techwriter » Wed Oct 25, 2006 6:49 pm

Thank you Very Much! The 'user simulation' workaround is working !!

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