Jump to content

First FM script going poorly... Help!


This topic is 6937 days old. Please don't post here. Open a new topic instead.

Recommended Posts

  • Newbies

My script is pretty simple, just inputing data from variables into newly created cells. (Can't find any info on how to do even this.) Using FM to track time spent working on a project, so there's date, time, and client code fields. I can gather all my variables, but have no idea on how to put them into FM.

I've had experience scripting DTP applications, but this is my first foray into scripting FileMaker and I'm having difficulty finding any information on the subject. Does anyone know of a book or website where I could pick up some rudimentary knowledge?

Link to comment
Share on other sites

AppleScript, The Missing Manual, by Adam Goldstein, is a great intro to AppleScript and has a chapter on AS Filemaker. I just bought it three months ago and found it very helpful, even though I have been AS for about 10 years.

Link to comment
Share on other sites

  • Newbies

The three variables to gather:

Date - Pulled from system

Job Number - Pulled from file name of project file (InDesign)

Time - Project would be checked-in and out, the result would be entered (and rounded) as Time spent.

So at this point I've got three variables and I need to create a new record in an open FM database and enter the information into the correct cells. It's really straight-forward, but I have no idea how to script FileMaker and I'm having difficulty finding sample code as a foot hold to learn. Any help is greatly appreciated. In the meantime I'll have to pick up The Missing Manual.

-WJW

Link to comment
Share on other sites

  • Newbies

Here's where I'm at so far...

Never having worked with FileMaker before, I've managed to find that I need to adjust "layout 7" of my database. Or so this script leads me to believe:

tell application "FileMaker Pro"

set myDbNum to "TimeSheet.fp5"

set myLayoutNum to 7

set myFieldList to ""

set myFieldIdList to the ID of every record of layout myLayoutNum of document myDbNum

set myFieldCount to the count of every record of layout myLayoutNum of document myDbNum

if myFieldCount > 1 then

set i to 1

repeat with i from 1 to the count of myFieldIdList

set myFieldItem to the record ID (item i of myFieldIdList) of layout myLayoutNum of document myDbNum

set myFieldList to myFieldList & myFieldItem & tab

set i to i + 1

end repeat

myFieldList

else

set myFieldList to the record 1 of layout myLayoutNum of document myDbNum

myFieldList

end if

end tell

Leaves me with a handful of returns that look like this:

get record ID 1.2685802E+7 of layout 7 of document "TimeSheet.fp5"

{"Doe, John", "5/22/05", "**5/17/05**", "**2.50**", "**PABC051234**", "", "New Product Postcard", "123 1234 1234 123 ABC 12345", "Dept"}

Most of this stuff is hidden or generated after the main three variables have been added. (The 3 parts of this list I'm trying to enter dynamically are marked with **asterisks**.) When I say "create new record," a new and empty (but hidden) record is created. If I try to add "with data" and use the above list, it gives me a R/W error. I don't know if I'm on the right track or even looking at the problem correctly, but there's gotta be a way.

Attached you'll find a snapshot of the database I'm working in, though I have no idea if it helps or matters at all.

I appreciate any help you can offer. InDesign scripting is my strength, so I'd certainly be happy to assist there if I ever can.

-WJW

TimeEntry.jpg

Link to comment
Share on other sites

I think you need to better explain exactly what you want to do - step by step - it isn't very clear at the moment.

What data you want to enter manually into the database and what data do you want to be automatially entered for you, from what you are saying it doesn't seem that applescript is necessary at all? Try and write down a proper timeline/chain of events of what you are trying to do. eg:

1) open filemaker database

2) create a new record - have current date automatically entered

3) type in name in user name field

4) click a button which uses an applescript to get the job name by asking the user to select an indesign file

5) etc etc

This should make it a bit easier for us to help you!

good luck

Link to comment
Share on other sites

This topic is 6937 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.