Waiting for User-Interaction

Hi there ! :slight_smile:

Let me first tell you the background:
I’m trying to automate some important repeating steps in an application called “Brainsight Frameless” trying to open automatically a file and then do some action with the data inside. I have got the path to the specific file I would like to open. Mostly this file contains data concerning the adjustment of an external camera. To control this camera, there is a special “Polaris Window” which has to be open.

My problem is as follows:
When I’m using :

tell application "Brainsight Frameless" to open file (path) as reference

there appears a small popup-window asking if I would like to open the mentioned “Polaris Window”. This is allways true and so I tried to use System Events to hit the “yes button”:

 tell application "Brainsight Frameless" to open file (path) as reference
tell application "System Events" ... end tell.

But it seemes as if this popup window is included into the opening process. So I have to click the button myself before the “System Events”-block starts to work - but thats to late :? . Bringing the open command into the “System Events”-tell block does the same.

Now I tried 2 new approaches and here are also my questions.
I’m trying to use “System Events” to use Brainsights Open-Menu-Item - trying to play the User.

Question1: Is it possible to use a standard-opening-file-dialog to enter somehow the path I allready have ?

If thats not possible the user has to do it by himself - not good but acceptable. But now I have to wait until the user has done his selection and presses the “OK”-Button - the popupwindow would appear and I’m able to hit the mentioned “Yes”-button.

Question2: Is it possible to wait for the users confirmation ? Something like this:

repeat until (button_status is “ok button pressd”) – or “cancel button pressed”
set button_status to ??? of window 1 of process “Brainsight”
end repeat

I’m doing this for some doctors who don’t have time so I’m trying to eliminate repeating steps. If you see another solution: I’m open to every hint.

Answers welcome :slight_smile:
Martin

This is rather old, but here’s your answer. You have told the app to open the file dialog instead of Sys Ev. That doesn’t work. I found that with printing AppleWorks. The script stalls waiting for user action and doesn’t even get to the System Events part.

You need to use Sys Ev to do the File Open… command. Then, it will have control. The 3rd/btm example here http://www.apple.com/applescript/uiscripting/03.html should give you ideas.