Newbies ccmango Posted February 4, 2010 Newbies Posted February 4, 2010 I'm trying to do something apparently simple that I'm finding oddly difficult. I would like to use a script to tab through text entry boxes in a web viewer into which I would cut and paste field data. Is there a way to issue tab characters to the browse layer from a script, and more generally, can text entry (i.e., typing) be done from a script?
Tpaairman Posted February 5, 2010 Posted February 5, 2010 I'm not sure about issuing the tab character, but as far as typing form a script - I'm not sure I understand exactly what you are asking, but if you are referring to having the script go to a field and then let you type in that field, then yes. All you have to do is have it go to the field you want to type into, then tell the scrip to Pause Script. After you type, you just hit enter or return and the script continues.
Newbies ccmango Posted February 5, 2010 Author Newbies Posted February 5, 2010 Thanks for the reply. But I have to get into the web viewer--not a field--from the browse layer under script control and then move from one text entry box--again not fields--to another on the web page for cut and paste text entry. I can do this from the keyboard using the tab key but I can't figure how to do it from a script. Any ideas would be really appreciated.
Lee Smith Posted February 6, 2010 Posted February 6, 2010 Hi ccmango, and welcome to the Forum, This questions comes up from time to time. To do what you are asking, if I'm understanding you correctly, is known as Scraping or Extracting a web site. It is not easy, but it can be done. There are a few example files available, also check out the Custom Functions at braindunning.com in fact, just do a search for web there and you will see many of the ones that can be used. If you do a search of the Forum, try [color:blue]+webviewer in the [color:red]Keywords, and limit the search to [color:red]Subjects, or use a combination of words such as [color:blue]+Webviewer +Scraping, (or +Extracting) [color:blue]+data.. One of the files that I found helpful is called HTMLtoText, so do a search for [color:blue]+HTMLtoText and download the file attachment. BTW, use the pluses, and it will help limit the find. also, click on the [color:blue] "?" besides [color:blue]Mode in the Advance Search window for more hints on searches. HTH Lee
Newbies ccmango Posted February 6, 2010 Author Newbies Posted February 6, 2010 Thanks for the welcome and the info. Actually, I'm trying to do the opposite of extracting a web site -- I just want to enter data from my FMP fields into a website through a web viewer under script control. I can tab into the web viewer from the keyboard and copy data into the web site's text entry boxes as well, but I can't figure out how to make a script do it. I could navigate into the web viewer and go from one text entry box to another to paste in my data if I could only "type" from a script--that is, send keyboard characters like tabs to the browse layer from an executing script. Any ideas? I'm puzzled that it isn't obvious how to do such a simple thing.
Lee Smith Posted February 6, 2010 Posted February 6, 2010 There are examples of that too. One file that came with FileMaker 9 called "Web View Example.fp7" has a couple of examples of this. If you don't have this file, let me know and I'll send it to you or post it here. Lee
Newbies ccmango Posted February 6, 2010 Author Newbies Posted February 6, 2010 Lee - thanks again for the help. Yes, I will have to spend some time studying the example. It seems to involve parsing and setting the html for the page. I was hoping that wasn't necessary, but so be it. More generally, in FMP there doesn't seem to be any means of sending text or keystrokes to the browse layer, but maybe there just isn't much call for that sort of thing. I appreciate the support for my post!
fseipel Posted February 6, 2010 Posted February 6, 2010 You should be able to directly send keys to the WebViewer by using AppleScript, including tabs, but this may exhibit reliability problems on slower computers. This works on a PC as well, using VBScript. i.e. Filemaker script runs an AppleScript which sends the keys to WebViewer. It may be worth considering Monkeybread Software's plugin for this application, in that it allows you to easily set text input fields on the webviewer layout directly, click links, etc. The use of the free ScriptMaster plugin is also an option; when coupled with the free WebDriver package, it permits Filemaker to control an external browser completely. This also permits automated HTTP uploads. If you are interacting with a commercial site on which forms change frequently, such as eBay, then it is advantageous to set only the fields you need to change using a real browser; this makes the code less likely to break when pages change. If the form submit is fixed and unlikely to change, these methods may be overkill. I prefer WebViewer because I can see the page's response as though I were browsing, making debugging easier.
Lee Smith Posted February 6, 2010 Posted February 6, 2010 It would appear that WebDriver is a Windows application?
Newbies ccmango Posted February 6, 2010 Author Newbies Posted February 6, 2010 Thanks all for the help. Lee Smith pointed out to me that there are "native" FMP constructs that may work (example file in FMP 8.5). The FMP documentation specifies the "data url scheme" to send html data to a web viewer by including the data in a url: data:[][;base64], Where the following syntax applies: dataurl = "data:" [ mediatype ] [ ";base64" ] "," data mediatype = [ type "/" subtype ] *( ";" parameter ) data = *urlchar parameter = attribute "=" value More information about the “data URL scheme” can be found on the web. I'm lazy so the MBS solution sounds most attractive to me. Guess I'll have a look.
fseipel Posted February 7, 2010 Posted February 7, 2010 Hi Lee, WebDriver is platform independent. I use it on Windoze personally. I call it using the ScriptMaster plugin, which is free. This is a good tutorial for getting started with it: http://code.google.com/p/selenium/wiki/GettingStarted?redir=1 -- you could probably also call it without ScriptMaster, but getting data back, is greatly simplified by using ScriptMaster. The main downside of this approach is, it controls an external browser (I have it control FireFox, but it can also control IE and I believe Chrome), rather than the WebViewer within FM. I'm not sure if this is overkill for the original poster's project or not. The main advantage is, because the browser is controlled, all cookies/tokens are automatically handled, so, say, for an eBay login, you need only pass those parameters that change. You can clear the cookies, and perform some other functions. It also does a great job of finding form input fields. I've also used Troi URL. The MBS plugin does a great job of form posting, within WebViewer, but is unable to URL upload files on web forms (e.g. eBay inventory), because the security limits within IE, prevent this plugin, from programatically setting the upload filename. That may not be a problem for most applications. There is also a good form posting example in the ScriptMaster examples (HTTP Post). It does not use webdriver or webviewer.
Recommended Posts
This topic is 5403 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now