AppleScript user interaction under OS X 10.11

05/17/2016

 

RagTime supports extensive possibilities that can be controlled remotely, via AppleScript. These scripts also allow notifications to or requests from the user.


Up to OS X 10.10 a script like this can easily be used:

 

tell application "RagTime 6.6"
 activate
 set dlgResult to button returned of (display dialog "Run script?" buttons {"Yes", "No"} default button 2)
 set cell "A1" of table 1 of document 1 to dlgResult
end tell

 

As from OS X 10.11 this does not work anymore because RagTime performs calculations in the background, even when scripts are running.

In this case a syslog is written:

 

2016-05-03 16:16:51 asl fungus RagTime[31784]: This application is modifying the autolayout engine from a background thread, which can lead to engine corruption and weird crashes.  This will cause an exception in a future release. …

 

which leads, in the following, to a “hanging” RagTime process.

 

The solution for this problem is using the “system events” for all user interactions:

 

 


Here are two examples that simply modify the cell A1 in the first spreadsheet of the document:

 

display dialog

tell application "RagTime 6.6"
    activate
    set dlgResult to "foo"
    tell application "System Events"
        activate
        set dlgResult to button returned of (display dialog "
Run script?" buttons {"Yes", "No"} default button 2)
    end tell

    activate
    set cell "A1" of table 1 of document 1 to dlgResult
end tell

choose from list
tell application "RagTime 6.6"
    activate
    set dlgResult to "foo"
    tell application "System Events"
        activate
        set dlgResult to (choose from list {"Banana", "Pear", "Quince"} with title "a List" with prompt "Select an item" default items {"Quince"})
    end tell
    activate
    if dlgResult = false then
        set dlgResult to "" -- canceled    
    else
        set dlgResult to item 1 of dlgResult
    end if
    set cell "A1" of table 1 of document 1 to dlgResult
end tell

 

These examples show how the “System Events” can be used to successfully communicate with the user via AppleScript.

 

Back to the overview

 

 

Headlines

Sales News

Contact


Legal Information  |  GTC  |  Sitemap
 

Simply productive

RagTime 6

 

Inventory and Foyer

Individual content, formats, fonts, and colors are listed well arranged in the Inventory. Frequently used documents and form can be accessed easily from within the Foyer.


New Features
Try before you buy
General Sales Information

Deutsch
English