Jump to content

Recommended Posts

typewriter    1

Is it possible to use AppleScript to open the Script Workplace, select a particular script and even scroll to a particular line?

I looked through several AppleScript sources (there are not so many...) as well as the Dictionary of FIleMaker Pro Advanced 15, but all examples seem to deal with using the database (i.e. finding and manipulating records), not authoring.

Why would be handy? I have an authoring database where I can store the scripts and scriptsteps of a solution. These are converted from FIlemaker XML using the MBS plugin, not that complicated. Then it's possible to select the scriptsteps that need attention. But locating these scripts in the original solution is quite time consuming, so an AppleScript would save me tons of time.

 

 

Share this post


Link to post
Share on other sites
mz123    0

This would open up the Script Workspace, but that's as far as I got.

tell application "FileMaker Pro Advanced"

do menu menu item "Script Workspace..." of menu "Scripts"

end tell

Have you used QuicKeys before? That might be more suited to it. It can mimic both the keyboard and mouse.

You can:

  1. (Manually) copy the script name
  2. choose Scripts > Script Workspace...
  3. Then use the tab key to go to the Search field
  4. Then paste the script name from your clipboard

A Keyboard shortcut can perform the QuicKey shortcut, doing all the necessary steps.

Thoughts?

 

Share this post


Link to post
Share on other sites
Lee Smith    147

AppleScript is a Macintosh Operating System application. Why use it for something that is built in FileMaker. i.e. the script step "Open Script Workspace", which will do what you want.

There a bunch of key combinations available in FileMaker. It is also possible to add or change them by using the Accessibility in the System Preferences

On 7/30/2017 at 1:40 AM, typewriter said:

AppleScript to open the Script Workplace

AFAIK, this isn't possible.

On 7/30/2017 at 1:40 AM, typewriter said:

These are converted from FIlemaker XML using the MBS plugin, not that complicated. Then it's possible to select the scriptsteps that need attention. But locating these scripts in the original solution is quite time consuming, so an AppleScript would save me tons of time.

Take a look at the Clip Manager available https://www.myfmbutler.com/en/products/clip-manager-for-mac/6

I use it for my archive of fields, scripts and custom functions. 

Lee

Share this post


Link to post
Share on other sites
Lee Smith    147

I wished I had had your Profile Information before I answered your question. I probably would have not posted the AS part.

Share this post


Link to post
Share on other sites
Lee Smith    147

Are you aware that in Version 16 it handles AS different? You need to go in to into the Accounts and Privileges and check the box Allow Apple Events.

Accounts and Privilages.png

  • Like 1

Share this post


Link to post
Share on other sites
typewriter    1
9 hours ago, Lee Smith said:

I wished I had had your Profile Information before I answered you question. I probably would have not posted the AS part.

Oh well, that's my fault. I hadn't taken the time to update the profile. Thanks for the feedback.

I would be pleased to see additional authoring functions in FMPA17. Like the ability to open a particular script like I mentioned in my post. But displaying the ID's of layouts, scripts and fields in listings would also make life a little easier for people who need to take care of other developer's creations.

This consumes some screen real estate, but that that is no probem anymore.

By the way, the Open Script Workspace... command in combination with copy/paste works pretty well.

And for processing the FIleMaker XML, I'd recommend any developer to take a good look at the MBS plugin ...

Share this post


Link to post
Share on other sites

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


  • Similar Content

    • By Quito
      Hi,
      I'm writing a find-replace script to change special characters to Unicode code and another script to change them back to special characters (see screenshot). It seems I should be able to assign the "Go to Field" once and run ~1000 Find/Replace(ments) in one go.  I'm not going to switch to another Field during this process.  Is the Script Workspace the right way to do this or would it make sense to have the Find/Replace units in another .fmp12 file?
      Best,
      Daniel

    • By ggt667
      Is there a way in AppleScript to trap if the connection is lost and have an AppleScript act on this?
      At the risk of asking and answering myself( AppleScript below )
      repeat tell application "FileMaker Pro" try database "db" on error do shell script "sudo shutdown -r now" with administrator privileges end try end tell delay 59 -- 59 secs end repeat  
    • By imdarek
      Hi, I am using filemaker 11 to copy customer info from excel into the database and then it would generate special keys in pdf allowing us to send the file to the customer.
      My access to the filemaker is non-admin, and the import function of customer info has been blocked.
      We are keying in the record one at a time, so we are looking at ways to automate this process.
      When I try to create a new record using applescript with just 
      it was not allowed. There are data that require validation like date and auto-indexed record number.
      So, is there a way we could create new record and then using the set function to copy data into the report?
    • By Franco Pagano
      When i use a local robot to create pdf files or other, i have a problem when the connection go down, filemaker loose every reference to the remote file.
      The only way is to close the file and open again, i solved this problem on Mac using this apple script.
      1)  The AS check the connection if ok open the file.
      2)  If the connection go down then the AS close the file and wait until the connection is up, at that time it reopen the file.
      3) if you close the file then the applescript quit it self. 
      I am not a Apple script developer, i assembled it using few examples, then probably  isn't well done but it work.
      -------------------------------------------------
      tell application "Finder" to set ThePath to POSIX path of ((container of (path to me)) as alias)
      set VarRepeat to "Yes"
      tell application id "com.filemaker.client.advanced12"
          activate
          try
              set window_name to the name of every window whose visible is true
          on error
              set window_name to "Error"
          end try
      end tell
       
      ---------------------------------------------------
      repeat
          set testIP to chkUP("http://www.apple.com") or chkUP("http://www.google.com")
          ---------------------------------------------------
          if testIP as text = "False" and window_name contains "Robot" then
              tell application "System Events"
                  activate
                  set {procesList, pidList} to the {name, unix id} of (every process whose name contains "Filemaker Pro")
              end tell
              delay 5
              set VarLoop to "OK"
              try
                  --tell application "FileMaker Pro Advanced" to close every window
                  --on error
                  do shell script "kill -KILL " & pidList as text
                  set window_name to "Error"
                  set VarRepeat to "Yes"
              end try
              
              
          end if
          
          
          ---------------------------------------------------
          if testIP as text = "True" then
              try
                  tell application id "com.filemaker.client.advanced12"
                      activate
                      delay 5
                      set window_name to the name of every window whose visible is true
                  end tell
              on error
                  set window_name to "Error"
              end try
              --display dialog testIP as text
              --------------------------    
              if testIP as text = "True" and window_name contains "Error" and VarRepeat = "Yes" then
                  
                  tell application id "com.filemaker.client.advanced12"
                      activate
                      try
                          open ThePath & "Robot.fmp12"
                          set window_name to "Robot"
                          set VarRepeat to "No"
                      on error
                          quit
                      end try
                  end tell
                  
              end if
          end if
          ---------------------------------------------------    
          --with timeout of 60 * 60 * 24 seconds
          delay 5
          if VarRepeat = "No" and window_name contains "Error" then quit
      end repeat
      to chkUP(theURL)
          return (count (get ((theURL as URL)'s host & {dotted decimal form:""})'s dotted decimal form)) > 0
      end chkUP
    • By fm8443
      I have a simple Applescript that works in Script Editor
      tell application "Keyboard Maestro Engine" 
      do script "Search the Web" 
      end tell
      I add this same script (with escape chars) to my RESOURCES::A_SCRIPT field inside FM.
      The RESOURCES table is not connected to the other tables in the graph.
      "tell application \"Keyboard Maestro Engine\" 
      do script \"Search the Web\" 
      end tell"
      I've tried this with this field being defined as a Global Storage Field or not.  Similar problems with both.
      I have an FM Script called EXECUTE:
      Perform Applescript (RESOURCES::A_SCRIPT)
      When I run this FM Script I get an error message:
      "Error: -2741" / "Expected EOL but found Command Name"
      I've have tried rebooting my Mac.
      Any ideas?
       
       
×

Important Information

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