Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: set font syze of text field



On 11 Mar 2005, at 15:46, Bernardo Hoehl wrote:

Hi List!


Simple question:

Is there a line of applescript I can use to set the font syze of my text field?

Thank you,

Bernardo Höhl

As far as I know, you can't simply set it as an AppleScript property of a text field. Please, if anyone knows differently, speak up!


So the question is "Do you REALLY want to do that?" (I can hear Matt's voice in my head saying "Don't do it! Don't try and make AppleScript Studio do what it's not built to do! Rethink your ideas!" ;-))

If you do REALLY want to do it, then this, ugly as it is, does it ...

tell text field 1 of window 1
set theDesiredFontSize to 8 -- here is where you set the size you want
set theFont to call method "font" of object it
tell theFont to set theFontName to call method "fontName" of object it
set theFontResized to call method "fontWithName:size:" of class "NSFont" with parameters {theFontName, theDesiredFontSize}
call method "setFont:" of object it with parameter theFontResized
end tell


I take no responsibility for the use of the above code! ;-)

Philip



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden
References: 
 >set font syze of text field (From: Bernardo Hoehl <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.