Author Topic: Fill forms  (Read 3118 times)

Offline JoeDu

  • Poster
  • **
  • Posts: 57
    • View Profile
    • http://www.joedu.com
Fill forms
« on: June 21, 2010, 04:30:50 PM »
This is for you html experts out there.

I'd like to fill in web forms using something similar to Autofill. Here's what I mean...

I have to do a lot of online grading and there are a number of insanely repetitive tasks. I use FileMaker Pro to generate grades and comments. Those grades and comments must then be individually transferred (via copy-paste) to the fields on my school's Virtual Campus (in a web browser). This requires a constant switching back and forth between FMP and Safari.

What I'd like to do is gather the text from grades and comments, with appropriate coding, so that a single "copy, switch to Safari, and paste" will populate all the fields of the web form.

In my mind, it would be as simple as inserting a code that invokes the "tab" key to go from field to field. So the text copied from FMP would read Grade1<tab>Comments1<tab>Grade2<tab>Comments2 (etc), and paste the right info to the right field.

Does that make sense? Is such a thing possible?

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Fill forms
« Reply #1 on: June 21, 2010, 06:38:05 PM »
What version of FileMaker Pro do you have?

I only have version 9, but it would appear that its "Open URL" script step, combined with an AppleScript could be used to do what you want. Perhaps even an AppleScript or Automator action alone. Either should be able to pick a record at a time, copy the data from the appropriate fields and insert them into the uniquely-named fields in the browser. A look at the web-page source should show those names. If you don't have access to those names, a simple tab action could be used to step from one field to the next.

The most difficult task, of course, is the script and then the testing to verify that it works 110% correctly! eek2.gif

"Autofill" is a function of a browser to record what text you normally place in certain uniquely name fields. It doesn't use external info at all. But not all web-designers use the same name for the same info, and the label on the visible form may be completely different than the actual name/ID of the field. Autofill may work correctly for 99% of "Name" fields, but fail miserably for a "user ID/user name/user anything" field. That's why knowing the actual field names will be helpful and assure that the correct info gets into the correct text box.

It may simplify things to have FileMaker Pro export the required data as a plain text file with whatever field and record delimiter you find most useful. The script may more easily read and use that file than trying to extract it from FileMaker Pro directly.

HTHs! And I'm sure you'll learn much more about FM and AppleScript or Automator, in the experience! clap.gif These one of a kind needs are just made for AS or Automator. Here are some links that might be of help:
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline JoeDu

  • Poster
  • **
  • Posts: 57
    • View Profile
    • http://www.joedu.com
Fill forms
« Reply #2 on: June 21, 2010, 08:17:14 PM »
QUOTE(Xairbusdriver @ Jun 21 2010, 11:38 PM) <{POST_SNAPBACK}>
What version of FileMaker Pro do you have?
I have 9 as well. smile.gif

QUOTE(Xairbusdriver @ Jun 21 2010, 11:38 PM) <{POST_SNAPBACK}>
I only have version 9, but it would appear that its "Open URL" script step, combined with an AppleScript could be used to do what you want.
I've done ALOT of scripting, but I'm certainly not an expert scripter. I've not even tried to mix FMP scripts with AppleScripts.

QUOTE(Xairbusdriver @ Jun 21 2010, 11:38 PM) <{POST_SNAPBACK}>
If you don't have access to those names, a simple tab action could be used to step from one field to the next.
That's what I've been researching - how to invoke the "tab action".

QUOTE(Xairbusdriver @ Jun 21 2010, 11:38 PM) <{POST_SNAPBACK}>
The most difficult task, of course, is the script and then the testing to verify that it works 110% correctly! eek2.gif
Indeed!

QUOTE(Xairbusdriver @ Jun 21 2010, 11:38 PM) <{POST_SNAPBACK}>
It may simplify things to have FileMaker Pro export the required data as a plain text file with whatever field and record delimiter you find most useful. The script may more easily read and use that file than trying to extract it from FileMaker Pro directly.
That was my goal. It's very easy to create a text file with a script and have it contain whatever data you wish. It's getting the script (AppleScript or Automator?) to invoke the tab between each piece of data. That method, as you know, would not require knowledge of the field names.

I don't even need, or want, the script or scripts to run automatically, aside from creating the text file. I'd rather "copy and paste" the info, and allow whatever "tab" code to permit the movement from field to field. But if scripting is the way to go, I'll research those links.

Thanks a BAZILLION! smile.gif

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Fill forms
« Reply #3 on: June 22, 2010, 12:20:53 PM »
During my sleep last night I thought about the ability of just dumping the entire grade file, formatted as needed, to the school's computer. First, I assume that the web site is run by a school. Second, I assume that the web page was designed to allow teachers to enter their grades per student, per class/etc. who didn't have access to a personal database program. I'm assuming (that's three in a row! eek2.gif ) that it was/is an aid to teachers who at least have access to the interwebs.

One more assumption and I promise to stop! Most teachers have been entering their grades on the web site as they are determined. You, on the other hand, being much more talented and efficient, have been learning and using FileMaker Pro (and probably other apps) for recording and even calculating the average, mean and individual semester grades. Now, the school has provided a basic grade entry form and expects everyone to be excited about the ease of use! wink.gif Unfortunately, those who took the initiative to do the work now face the task of mating that work with a non-interactive, single student-at-a-time form?

I am hoping that you can contact the "IT" people and tell them that you have all the work already and can provide them with all the data they need (and more, which they probably will not want) if they will simply provide you with an access point to their computer. That may be totally unacceptable to them, "IT" 'professionals' don't like to see others doing 'their work.' How else can they justify their salaries? smile.gif But they do have security issues and they just may not have time to make this happen. And your problem remains, of course.

One more tack would be to upload your file(s) to a trusted site/space and let the "IT" people download them from there. That may still be too much of a burden for them. rolleyes.gif

It would appear that the easiest 'solution' is to use the system they've designed for the lowest common denominator...using your own as a back up and doing whatever extra work you have designed into it. In a perfect world, of course, you could get them to allow FileMaker Pro to use its ability to access the secure server and upload the files as I suggested, I just wouldn't hold my breath for that to happen...

So...

Back to the AS/Automator thing...

I believe I saw a script/method for sending a "tab" command in AS. I will search for that specific need today. Even if that is available, however, it would seem, from my understanding of the web form, that the data must be entered for only one "event" at a time. One student data for one test/semester/term? Still, if you can create a script to read, copy and paste the multiple entries into the form fields, it would mean only one mouse click for each student. Thinking.gif

I gotta' go take my wife to lunch...I know, you have a problem hat needs solving...hopefully others can also pitch in here. Don't give up...yet! salute.gif
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Fill forms
« Reply #4 on: June 22, 2010, 02:47:44 PM »
Here's a snippet for issuing the down arrow (I think), but "tab" could be inserted between the braces instead to get that tab function? OTOH, even the down arrow keystroke might work on the form. Thinking.gif
QUOTE
tell application "System Events" to tell process "TextEdit" to keystroke "v" using {command down}
Another method would be to try the 'key code' command in the script:
QUOTE
tell application "System Events" to tell process "TextEdit" to key code 125 --down to new line
"Tab" is 9 in the ASCII list, BTW.
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes:

Offline JoeDu

  • Poster
  • **
  • Posts: 57
    • View Profile
    • http://www.joedu.com
Fill forms
« Reply #5 on: July 05, 2010, 09:03:58 AM »
QUOTE
tell application "System Events" to tell process "TextEdit" to keystroke "v" using {command down} Another method would be to try the 'key code' command in the script: tell application "System Events" to tell process "TextEdit" to key code 125 --down to new line "Tab" is 9 in the ASCII list, BTW.

IT WORKS!!!!!!!!!!

Often when I'm trying to understand how a script should work I need to step away for a time and let it gel in my head. It struck me this morning, and I was surprised at how easy it was!!!

No need to jump to a plain text editor. I made a VERY simple Applescript that looks like this:

QUOTE
tell application "Safari"
   activate
end tell
tell application "System Events"
   key code 9 using command down (this invokes "paste")
   keystroke tab
end tell


This script will paste the copied info into the currently selected field in the browser. Then it tabs to the next field.

Then....

A FMP Script sets up a loop to copy the contents of the appropriate field (the grade).
Then the Applescript activates Safari and pasts the grade into the first student's grade field.
FMP then copies the next field (the comments), and the SAME Applescript pastes it, and then tabs to the next field, which is the NEXT student's grade.
The FMP Script then goes to the next record and loops the process, exiting after last.

Thanks for the think tank!!!!

Offline Xairbusdriver

  • Administrator
  • TS Addict
  • *****
  • Posts: 26388
  • 27" iMac (mid-17), Big Sur, Mac mini, Catalina
    • View Profile
    • Mid-South Weather
Fill forms
« Reply #6 on: July 05, 2010, 01:41:19 PM »
Great! I knew you could do it! clap.gif So many people never know the joy of making something like this and seeing it work! wink.gif The only problem is that no one in the Department of Education will ever know of your intelligence, perseverance and capabilities... rant.gif OTOH, maybe they'll be able to recognize your extraordinary work ethic in other ways. yes.gif smile.gif

And, thanks for the update, also!
THERE ARE TWO TYPES OF COUNTRIES
Those that use metric = #1 Measurement system
And the United States = The Banana system
CAUTION! Childhood vaccinations cause adults! :yes: