Sunday, December 17, 2017

#1 2014-12-25 04:48:58 pm

Rwells
Member
Registered: 2012-06-15
Posts: 22

launch program and resize the window

I have written the following automator script which will be saved as a service.

I am trying to launch a program which is a windows program running under crossover.

The launch application works find. I then pause 10 seconds to wait for the program to be fully loaded then I try to run the following applescript.

on run {input, parameters}
   
    set the_application to {path to frontmost application as Unicode text}
    tell the_application
        set bounds of window 1 to {1, 1, 1281, 721}
    end tell
   
    return input
end run

I get the following error messages in the log:

Launch Application completed
Pause completed
Run AppleScript failed - 1 error
Can't get window 1 of ("Macintosh HD:Applications:RootsMagic.app")

First I need to get the service running then is there a way to pause until the application is loaded rather than waiting for a time period?


Thanks for any help or suggestions.
Roger

Offline

 

#2 2014-12-27 01:59:21 pm

axel99092
Member
From:: Erfurt / Germany
Registered: 2014-02-12
Posts: 20
Website

Re: launch program and resize the window

this is what I use with TextEdit

Applescript:


tell application "TextEdit"
   activate
   make new document
   set bounds of first window to {10, 100, 666, 444}
end tell

Offline

 

#3 2014-12-28 09:26:25 am

Rwells
Member
Registered: 2012-06-15
Posts: 22

Re: launch program and resize the window

Thanks for the help.

It works find for TextEdit but will not work with RootsMagic.

It opened the program but then got an error message "RootsMagic got an error: Can’t set bounds of window 1 to {10, 100, 666, 444}." at the set bounds statement.

I suspect it has something to do with the fact that RootsMagic is running under crossover but I am not sure at this point.

Roger

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)