• 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
[Newbie] Scripting IB
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Newbie] Scripting IB


  • Subject: [Newbie] Scripting IB
  • From: <email@hidden>
  • Date: Thu, 20 Apr 2006 17:23:25 +0200 (CEST)
  • Importance: Normal

Hi,

I have to perform a very repetitive task in IB and I thought AS could help
me. Problem: I am a complete newbie to AS and I'm blocked after having
written only 3 lines of code.

Basically, the thing I'd like to do is get all the widgets of a certain
NIB document and  perform a certain action on them. I first thought the
best way to do that was to open the document and then get back the opened
documents IB :

property mynib : "Macintosh
HD:Applications:TextEdit.app:Contents:Resources:English.lproj:DocumentProperties.nib"

tell application "Interface Builder"
	open mynib
	set ibApp to the application "Interface Builder"
	set docs to the documents of ibApp

I'm not sure if this is the best way to do it, but it does work, the
return value being : {document "DocumentProperties.nib" of application
"Interface Builder"}

The problem I'm facing is when I want to get something out of this
document instance :

	repeat with i from 1 to the count of docs
		set doc to the item i of docs
		set p to the properties of doc
	end repeat

Most of the time, trying to reach the properties (or a certain property
such as "path") of the object ends up in an error "Interface Builder got
an error: NSReceiverEvaluationScriptError: 4". I have absolutely no idea
what this means. The problem appears quite often, but not all the time,
which is strance. I have tried different NIB files, running the script
with IB already launched or not, with the document already opened or not.
I couldn't find what was the factor that made this happen.

The second part of the question would be : How can I get all the objects
stored in the NIB (like buttons, text fields, etc...), to eventually apply
to those a command from the IB Application Suite (such as "center") ?

Thanks for any help, and sorry if I'm doing things the wrong way here,
-j


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: problem writing out XML suite parsed file to disk
  • Next by Date: Re: logout hook and AppleScripts
  • Previous by thread: Re: problem writing out XML suite parsed file to disk
  • Next by thread: Getting latest ASStudio
  • Index(es):
    • Date
    • Thread