Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > I need assistance with a small bit of AppleScript...

I need assistance with a small bit of AppleScript...
Thread Tools
Forum Regular
Join Date: Jul 2002
Location: Ireland
Status: Offline
Reply With Quote
Dec 27, 2002, 03:58 PM
 
I have a few questions about AppleScript and AppleScript Studio...
I want a text field that will allow a user to enter some text then on return display the text in a popup dialog, here is my code:
Code:
on action theObject set returned_text to contents of text field "textField" of window "main" as string display dialog returned_text buttons {"OK"} default button 1 end action
All that happens is an empty dialog pops up with an OK button and it has no text from the textfield....
any ideas?


also is there a better way to check if an app is running than this:
Code:
property running : false tell application "Finder" if (get name of every process) contains "Internet Explorer" then set running to true end tell if running then --do some stuff end if
     
Mac Elite
Join Date: May 1999
Location: San Jose, CA
Status: Offline
Reply With Quote
Jan 9, 2003, 10:37 PM
 
On your first question, I can't see anything off hand that might cause a problem. Check field and window names to make sure they exist.

On the second question, there is a better way.

Primarily, under Mac OS X, you shouldn't do this via the Finder. There's no guarantee the Finder is running, especially in a multi-user environment or if you're running in the background. You should 'tell application "System Events"' instead.

Other than that, your code is fine.
Gods don't kill people - people with Gods kill people.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 01:59 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2