Source language: Translate to:

BrowserSetElement Question

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

BrowserSetElement Question

Postby datadon » Thu Jul 06, 2006 11:26 am

This question is to Dave, but maybe some others can shed some light on it.

Using the:

BrowserSetElement "WebBrowser1" "descr_0" "[dbf.descr1]"


I can fill in the form field on a webpage as shown in the below html code.


<input id="descr_0" type="text" name="descr_0" size="20" >


The type is shown as "text" and it work fine.

However, if I attempt to enter a path to a file in a from field that looks like this:

<input id="file_0" type="file" name="file_0" size="20" >


and use:


BrowserSetElement "WebBrowser1" "file_0" "c:/folder/filename.jpg"



It does not work. I think it is because the type="file" does not work the same.

This element shows up as a field with a browse button next to it for locating a file to upload.
What I want to do is fill in that image path using Neobook. It does not seem to work.

Any thoughts or hope for an enhancement?

Thanks
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby Neosoft Support » Thu Jul 06, 2006 11:50 am

Hi Don,

The BrowserSetElement may not understand how to work with a "file" element. Can you send me a sample HTML file or a link that I can use to test it?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby datadon » Thu Jul 06, 2006 1:07 pm

Will do via email.

Thanks
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby Gaev » Thu Jul 06, 2006 2:41 pm

Don:

a) For security reasons, I believe that this field can only be set by the user with the Browse Button ... otherwise, website owners could maliciously modify this value ... and cause files on your local disk to be uploaded without your knowledge

I tried doing this ...

<input type="file" value="abc.txt">

... and IE displayed a blank TextEntry Box before the Browse button.


b) Also, note that ...

i) Windows uses back-slashes in the full file specification ... the *nix based internet uses forward slashes

ii) when dealing with Javascript, each backward-slash must be replaced with two backward-slashes ... because the *nix guys treat backward-slash as a kind of escape character ... so \r is carriage-return, \n is new-line, \t is tab-character etc.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby datadon » Thu Jul 06, 2006 4:01 pm

Thanks Gaev,

My example:
c:/folder/filename.jpg

was put together in haste. Actual paths are selected via neobook actions and should have proper slash formats.

Yes I think the security issue is probably what that is about. The crooks did me in again.
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas

Postby Neosoft Support » Fri Jul 07, 2006 3:12 pm

Gaev is correct about security being the reason why IE won't allow the file type field to be modified programatically. However, I discovered that it's possible to modify file fields by sending characters through the keyboard buffer. This works sort of like NeoBook's SendKeys action, but targets a specific field in the browser. We can add this to the next update unless someone can think of a reason why we shouldn't.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby datadon » Sun Jul 09, 2006 9:00 pm

Well adding that would certainly make my day. Thanks for taking the time to check this out. I do appreciate it very much.
Don

'If you want to get a brontosaurus from 'a' to 'b' then you ride the dinosaur - you don't carry it!'
User avatar
datadon
 
Posts: 389
Joined: Sun Apr 03, 2005 7:55 pm
Location: Lorena Texas


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 2 guests