Automatic Translations (Powered by Powered by Google):
Afrikaans Albanian Arabic Belarusian Bulgarian Catalan Chinese Croatian Czech Danish Dutch English Estonian Filipino Finnish French Galician German Greek Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Taiwanese Thai Turkish Ukrainian Vietnamese Welsh Yiddish
+ Reply to Thread
Results 1 to 6 of 6
  1. #1
    Guest Member JoeDu is on a distinguished road
    Join Date
    Oct 2006
    Posts
    43
    Location:
    Tampa, FL


    FM Version
    FMP 9 Pro
    Skill Level
    Intermediate
    OS
    Mac
    Rep Power
    0

    Working with Applescript

    I would like to use Applescript within a FMP script that creates a folder on my HD using a variable or calculated result from FMP for the name of the folder.

    Additionally, the location of the folder to be created is not always the same.

    For example, when I use FMP and generate a new record, I want the script to create a folder in a location for that client. The client's folders are all unique.

    I know that variables from FMP mean nothing to an Applescript (and vice-versa). So, is this even possible?

  2. #2
    FileMaker Forum Subscriber dreygo is on a distinguished road
    Join Date
    Aug 2007
    Posts
    31
    Location:
    United States


    FM Version
    Filemaker 3, 4, 6, 8.5, 10, 11 & Go
    Skill Level
    Intermediate
    OS
    Mac
    Rep Power
    0

    Re: Working with Applescript

    You can use a global field to draw out information. There are quite a few examples on the internet for this task. I know very little about applescript, but was able to do similar tasks in pretty short order after a minimal amount of research time.

  3. #3
    FileMaker Tutor kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe's Avatar
    Join Date
    Mar 2004
    Posts
    5,018
    Location:
    NL


    FM Version
    9 adv
    Skill Level
    Pro
    OS
    Mac
    Rep Power
    104

    Re: Working with Applescript

    A handler for setting a field in Filemaker could be this (assuming the field is in a utility table with one record; your filemaker record is committed; the current table / layout is the utility table)
    Code:
    ------dec
    property thefolderpath:string
    --more properties
    ------main
    
    ----- more code
    ----- blah blah
    my UserPickFolder ()
    -----more code
    
    
    
    -------handlers
    
    on UserPickFolder()
        tell application "Finder"
            set thefolderpath to choose folder with prompt "choose folder"
        end tell
        tell application "FileMaker Pro Advanced" to tell current table
            set cell 1 of field "folderpath" to (thefolderpath as Unicode text)
        end tell
    end UserPickFolder
    the other way round works as well
    Code:
    tell application "filemaker pro advanced" to tell current table
    set thefilepath to the cellValue of cell 1 of field "ASFilepath" as Unicode text
    end tell
    actually when you embed applescript ("native") in a filemaker script, it's better to use

    Code:
    tell me to tell current table
    ....
    end tell
    that way you avoid version confusion (pro and advanced users) (thanks Alan ;-) )
    Stick to what you don't know.
    -------

  4. #4
    FileMaker Tutor kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe has a reputation beyond repute kjoe's Avatar
    Join Date
    Mar 2004
    Posts
    5,018
    Location:
    NL


    FM Version
    9 adv
    Skill Level
    Pro
    OS
    Mac
    Rep Power
    104

    Re: Working with Applescript

    and to answer your question... creating a folder on a predefined location...
    Code:
    tell me to tell current table -- me is application "filemaker pro" or "filemaker pro advanced"
     set thefolderpath to the cellValue of cell 1 of field "folderpath" as Unicode text --this is the path to the locatioen where the folder must be created
     set thefoldername to the cellValue of cell 1 of field "foldername" as Unicode text --this is the name of the folder to be created
    end tell
    tell application "Finder"
        if not (exists (thefolderpath & ":" & thefoldername)) then
            try
                make new folder at thefolderpath as alias with properties {name:thefoldername}
            on error
                display dialog "failed creating folder"
                return
            end try
        end if
    end tell
    Stick to what you don't know.
    -------

  5. #5
    Guest Member JoeDu is on a distinguished road
    Join Date
    Oct 2006
    Posts
    43
    Location:
    Tampa, FL


    FM Version
    FMP 9 Pro
    Skill Level
    Intermediate
    OS
    Mac
    Rep Power
    0

    Re: Working with Applescript

    Thanks guys!!!

  6. #6
    FileMaker Mentor AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of AHunter3 has much to be proud of
    Join Date
    Aug 2006
    Posts
    8,128
    Location:
    New York (Manhattan) USA


    FM Version
    10, 9, 8.5, 8, 7, 6, 5.5., 5, 4.1, 4, 3, 2.1, 1, II; & Nashoba 4, Plus, and the Original
    Skill Level
    Developer
    OS
    Windows & Mac
    Rep Power
    158

    Re: Working with Applescript

    You can also use AppleScript to perform a shell script, by the way. ("Shell script" = "what you would type on the Terminal's command line").


    do shell script "mkdir "& YourTable::FolderPath

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads - The answer to your question may be in one of these posts!

  1. Running AppleScript from FMS 9
    By preet in forum FileMaker Pro Server and Networking
    Replies: 7
    Last Post: 03-24-2009, 01:41 PM
  2. AppleScript Question
    By Mr. Bungle in forum ScriptMaker and Scripting
    Replies: 0
    Last Post: 09-10-2007, 10:21 AM
  3. FMP AppleScript Question
    By jsosa73 in forum FileMaker Pro 8.0
    Replies: 1
    Last Post: 09-19-2006, 08:38 PM
  4. AppleScript
    By cp in forum FileMaker Pro Versions 5 & 6
    Replies: 2
    Last Post: 03-25-2002, 04:53 PM
  5. AppleScript
    By cp in forum FileMaker Pro Server and Networking
    Replies: 0
    Last Post: 03-21-2002, 11:27 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts