9 Replies Latest reply: Aug 30, 2010 12:08 PM by swanker
swanker Level 1 Level 1 (25 points)
here's my Applescript:

tell application "FileMaker Pro"
activate
do script "script name"
end tell

does not do script
get "Object not found"

??

Mac Mini, Mac OS X (10.6.4)
  • Camelot Level 8 Level 8 (46,450 points)
    Filemaker scripts are stored within databases. You need to tell Filemaker which database to run the script from:

    tell application "FileMaker Pro"
      tell database "database name"
        do script "script name"
      end tell
    end tell


    That's partly because you could have multiple databases open, each with theor own 'script name', so Filemaker needs to know which one to run.
  • swanker Level 1 Level 1 (25 points)
    still doesn't work

    tell application "FileMaker Pro"
    activate
    tell database "lists.fp7"
    do script "pub to web"
    end tell
    end tell

    gets "error "Object not found." number -1728"
  • Matt Broughton Level 5 Level 5 (4,980 points)
    I believe you need the full path to the database--

    tell application "FileMaker Pro"
    activate
    tell database "Macintosh HD:Users:swanker:Desktop:lists.fp7"
    do script "pub to web"
    end tell
    end tell
  • swanker Level 1 Level 1 (25 points)
    thanks, but still no go

    here's my script:


    tell application "FileMaker Pro"
    activate
    tell database "Mac Mini:Users:steve:Public:New DCA Database:lists.fp7"
    do script "pub to web"
    end tell
    end tell

    result: error "FileMaker Pro got an error: Object not found." number -1728 from "pub to web"

    ??
  • Matt Broughton Level 5 Level 5 (4,980 points)
    Perhaps the database needs to be open to run the script. Try
    tell application "FileMaker Pro"
    activate
    open file "Mac Mini:Users:steve:Public:New DCA Database:lists.fp7"
    do script "pub to web"
    end tell
    end tell
  • Camelot Level 8 Level 8 (46,450 points)
    Since it's highlighting 'pub to web' I have to infer that it can't find the script in question. Are you sure that's the right name, and that the script does, indeed, exist in this database?
  • swanker Level 1 Level 1 (25 points)
    thanks

    yes, I thought of that when this first occurred, and I double-checked: it's there

    would it be better to know the script id number and use that?
  • swanker Level 1 Level 1 (25 points)
    I created a test script and it does work IF the database which holds the script is the foremost window

    so, the question becomes--- what is the wording for AppleScript to open that database and bring it foremost?

    here's the script that wqorked:

    tell application "FileMaker Pro"
    activate
    do script "pub to web"
    end tell
  • swanker Level 1 Level 1 (25 points)
    Filemaker Support sent me the answer

    this works:

    tell application "FileMaker Pro"
    activate
    show window "lists"
    do script "pub to web"
    end tell

    Message was edited by: swanker