Jump to content
Sign in to follow this  
mikedr

Freeze window command via AppleScript?

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

Recommended Posts

Is there a way in AppleScript, when communicating with FM (i.e., an AS triggered from outside of FM) to tell FM to freeze the window?

Share this post


Link to post
Share on other sites

You could make a script that does freeze window, then use "do script", but the script would need to not exit for a while.  In any case, I doubt it would "hide" your AppleScript actions, assuming that's your intent, AppleScript is much more like manipulating the UI elements themselves.

Share this post


Link to post
Share on other sites

Why would you want to do this? Assuming FMP is open of course.

Share this post


Link to post
Share on other sites

You could make a script that does freeze window, then use "do script", but the script would need to not exit for a while.  In any case, I doubt it would "hide" your AppleScript actions, assuming that's your intent, AppleScript is much more like manipulating the UI elements themselves.

 

Why would you want to do this? Assuming FMP is open of course.

 

Here's the long story on the motivation.  A patent application can be referenced by patent application number, law firm docket number, or client docket number.  A patent application number can be of the form XXYYYZZZ, XX/YYY,ZZZ, or XX/YYYZZZ.  Before we migrated to FM from an Excel spreadsheet, I wrote an AppleScript that is accessible as a service.  So, a user can select any of the aforementioned numbers, where a patent app number can be in any form, in an email, right-click, and select "show patent application," which would show the relevant application in the Excel spreadsheet. 

 

When we first migrated to FM, I just rewrote the AppleScript so it searched FM instead (I was proficient at AppleScript but not at FM scripting at the time).  The way AppleScript interacts with FM for searching is a bit odd, which meant that any time I modified the main layout in FM, I had to modify the AppleScript (from what I can tell, when executing searches of FM from AS, you have to order the fields in the order they're shown in the layout, from left to right and from top to bottom, so if you add a new field somewhere, you have to allow for that in the AS).  The way I fixed having to re-modify the script all the time was to add a layout that just lists the fields that will be searched -- the AS jumps to that layout, does the search, and then jumps back to the main layout. 

 

What I don't like is that you when you do a search, you can see momentarily the search layout.  Looks amateur-ish.  Hence my desire to do a freezewindow.

 

I think what I'm going to do is rewrite the search script in FM, and then have the AS simply call the FM script, passing the selected text as a parameter.  I know FM scripting well enough now that this won't be difficult, just a bit of work.

 

BTW, the ability to interact with FM "both ways" (FM calling AS's, and AS's calling FM) is a great boon.  I have FM doing neat things with Microsoft Word, Adobe Acrobat, and Cultured Code's Things.  And being able to select text in an email and then automatically showing the record in FM is a great timesaver.  AS is archaic, though. 

Share this post


Link to post
Share on other sites

AS is archaic, though. 

 

Yosemite now supports JavaScript as an alternative to AS, which may be more to your taste; so either wait for FM14 (?) to implement “Perform JavaScript”, or from FM launch an AppleScript to issue a shell command to perform a JavaScript …  :laugh:

 

What I don't like is that you when you do a search, you can see momentarily the search layout.  Looks amateur-ish.  Hence my desire to do a freezewindow.

 

Since you're performing an automated search, there should be no need to display any of the things a human operator would need (visible field objects, for instance); you could as well use an empty layout that just displays a “Search in Progress …" message.

Share this post


Link to post
Share on other sites

Mavericks now offers support for JavaScript, which may be more to your taste; so either wait for FM14 (?) to implement “Perform Javascript”, or call an AppleScript to issue a shell command to perform a JavaScript …  :laugh:

 

 

Since you're performing an automated search, there should be no need to display any of the things a human operator would need (visible field objects, for instance); you could as well use an empty layout that just displays a “Search in Progress …" message.

 

I know!  Now I have to learn JavaScript tho.  :

 

The empty layout doesn't work with the way AS interacts with FM -- the fields in question have to be on the layout for AS to be able to search them, because AS seems to interact with FM as if the user was entering in the search fields itself.  Now, an open question is whether I could hide the fields from view, or make them the same color as the background screen (the latter would definitely work).

 

The thing I don't like about this approach, either, is that it's still messy -- the search in progress window would only show up for a half second.  Sometimes not at all.  My paralegal doesn't mind (and didn't even "see" it until I brought it to her attention), but it bothers me in its lack of elegance.  Rewriting the script in FM won't be hard, just gotta find the time!

Share this post


Link to post
Share on other sites

Could you just put a panel in front of them with "Search in progress" text on it?

Share this post


Link to post
Share on other sites

oops, wrong programme :-/

Could you cover your fields with the rectangle tool & stick some text on it?

  • Like 1

Share this post


Link to post
Share on other sites

Perfect!  That worked like a dream.  I made the text box cover the entire layout, with a solid background to cover the fields.  Beautiful!  Thanks so much!  :laugh2:

Share this post


Link to post
Share on other sites

Yay; I helped someone! :-)

  • Like 1

Share this post


Link to post
Share on other sites

Note that there is an approach in AppleScript that eliminates the screen flash you are complaining about, by using the equivalent of Filemaker's set field. Set data cell "cellname" of table "tablename" is the general approach. This works especially well with global fields. Like an SQL query you must specify additional criteria if you need to target a specific record.

  • Like 1

Share this post


Link to post
Share on other sites

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Similar Content

    • By Asu
      Hello, the following is the essence of a problem I need to resolve. The code is AppleScript 
      display dialog "Hello \"world\" "  This code needs to run in FMP18 as a calculated applescript.

      I tried:
      Perform AppleScript [display dialog \"Hello "world" \"] 
      Perform AppleScript [display dialog \"Hello \""world"\" \"]
      Perform AppleScript [display dialog \"Hello "\"world"\" \"]
      Perform AppleScript [display dialog \"Hello \""world\"" \"]
      and other permutations of 1 backslash and 2 quotation marks cause the calculation to be unsavable b/o error.
      Perform AppleScript [display dialog \"Hello \"world\" \"] results in "A identifier can’t go after this “"”." -- after the calculation is saved. (Yes, "A identifier")
      Perform AppleScript [display dialog \"Hello \"\"world\"\" \"] results in A “"” can’t go after this “"”. -- after the calculation is saved
      and an error message of -2740.
      Can anyone help me please?
       

    • By wedgeman
      We are working on a process for passing certain info nuggets out of a solution (FMP 13) in an encrypted method.
      For various reasons a version upgrade isn't feasible. So the plan is to encrypt the nuggets, then pass them into a format for transport.
      Currently, we're using Applescript to pass the particular fields into an AES-256-CBC encryption process in a calculated Applescript step, as follows :
       
       
      The problems which concern me here:
      1. The password is "traveling" into Terminal in plaintext.   Is there a way this can be viewed during the process (a 'ps' or some other method)??
      2. Is there a better method to accomplish this without running as an echo?
       
      I've tried various flavors of this process (successful encryption & transport, etc), but am most concerned about the potential vulnerability from within OSX.. I've run various flavors, then attempted to grep for any of the password strings in log files and Library/Application Support/ folders, but haven't found anything...
      Is this an unfounded issue, or should I be going a different direction?
    • By fed
      I just upgraded to FMP16 from FMP13.  My applescripts no longer work.  I get an error of -10004, for which I cannot find an explanation.
      Any idea what I must change to make Applescripts work in FMP16?
    • By typewriter
      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.
       
       
    • 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  
×
×
  • Create New...

Important Information

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