• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Still a problem with addressing apps from within Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Still a problem with addressing apps from within Xcode


  • Subject: Still a problem with addressing apps from within Xcode
  • From: Brian Christmas <email@hidden>
  • Date: Mon, 14 Sep 2015 11:03:33 +1000

G’day Scripters.

I thought yesterday I’d cracked the problem of how to call other applications from Xcode, but I’ve tried to position two printer Queue windows, and failed.

The first part of the code, opening the apps, and using their processes to open the windows, works, but the second part fails, and does not generate an error.

The code works fine in vanillaApplescript.

Any thoughts please?

Regards

Santa

property theCoverPagePrinter : "A4 Printer"

property theLargePagePrinter : "Large Page Printer"
my resumeprinters:me

on resumeprinters:sender
set tempPath to path to library folder from user domain
try
set PrinterOne to application (tempPath & "Printers:" & (my theCoverPagePrinter) & ".app" as text)
tell PrinterOne to activate
end try
try
tell application "System Events" to tell process theCoverPagePrinter
click button "Resume" of toolbar 1 of window theCoverPagePrinter
end tell
end try
try
set PrinterTwo to application (tempPath & "Printers:" & (my theLargePagePrinter) & ".app" as text)
tell PrinterTwo to activate
end try
try
tell application "System Events" to tell process theLargePagePrinter
click button "Resume" of toolbar 1 of window theLargePagePrinter
end tell
end try
# Second part, not working, not erroring
try
tell PrinterOne to set theBoundsOne to the bounds of window (my theCoverPagePrinter)
tell PrinterTwo to set theBoundsTwo to the bounds of window (my theLargePagePrinter)
set theWidthOne to (item 3 of theBoundsOne) - (item 1 of theBoundsOne)
set theWidthTwo to (item 3 of theBoundsTwo) - (item 1 of theBoundsTwo)
if the theWidthTwo > theWidthOne then
set theWidthOne to theWidthTwo
end if
set theHeightOne to (item 4 of theBoundsOne) - (item 2 of theBoundsOne)
set theHeightTwo to (item 4 of theBoundsTwo) - (item 2 of theBoundsTwo)
if theHeightTwo > theHeightOne then
set theHeightOne to theHeightTwo
end if
tell PrinterOne to set bounds of window (my theCoverPagePrinter) to {10, 32, 10 + theWidthOne, 32 + theHeightOne}
tell PrinterTwo to set bounds of window (my theLargePagePrinter) to {11 + theWidthOne, 32, 11 + (theWidthOne * 2), 32 + theHeightOne}
on error errmsg number errnum
my displayError("resumeprinters " & errmsg & " number " & errnum & " p = " & p as text)
end try
end resumeprinters:

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Re: This works in Applescript, but not ASObjC
  • Next by Date: Re: Getting the Input Language with System Events
  • Previous by thread: Re: This works in Applescript, but not ASObjC
  • Next by thread: 3 questions
  • Index(es):
    • Date
    • Thread