Results 1 to 4 of 4
  1. #1
    AppleScript for checking value

    Member Since
    Nov 06, 2013
    Posts
    2
    AppleScript for checking value
    Hi, I'am new with scripting and don't have lots of experience. Need script for checking two words. Don't have idea how to do this. One text should be in textedit for example text 'Hi' and script should check is this text is "Hi". How to take text for checking from external application is the main question?

  2. #2
    AppleScript for checking value
    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    Location
    West Sussex, UK
    Posts
    180
    I dont fully understand your question, but I think your asking how to find a specific word in the frontmost active TextEdit document, if this is correct, then the simple Applescript below shows a very basic way to do this.

    Code:
    tell application "System Events"
    	set openApps to name of every application process whose visible is equal to true
    	if openApps contains "TextEdit" then
    		tell application "TextEdit"
    			set the wordList to every word of document 1
    			if the wordList contains "Hi" then
    				return true
    			else
    				return false
    			end if
    		end tell
    	else
    		display alert "The TextEdit application is not running." giving up after 30
    	end if
    end tell
    If this is not what your after, then you had better rephrase your question, and be more clear about what your trying to achieve.

    Regards Mark

  3. #3
    AppleScript for checking value

    Member Since
    Nov 06, 2013
    Posts
    2
    thank you for reply it's helpful

    I have additional question. Is there possibility to find text field using AXValue and then set it for use this example.
    For instance there is text field with identifier "size.popup" in untitled window. I need to do:

    set the worldList to "size.popup" (instead of "set the wordList to every word of document 1")

    if the wordList contains "2" then
    return true
    else
    return false
    end if

    how to do this?

  4. #4
    AppleScript for checking value
    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    Location
    West Sussex, UK
    Posts
    180
    Sorry I don't understand your question.

    AXValue ?

    what text fielld are you reffering to ?

    Are you working in Xcode, with a custom textfield on a window in Interface Builder ?

    You'll have to explain what your working with, in order for us to be able to help you.

    Regards Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PC Convert Checking In
    By IanRobinett in forum Switcher Hangout
    Replies: 2
    Last Post: 09-25-2006, 11:33 PM
  2. Checking temps
    By digitalfish in forum Apple Notebooks
    Replies: 13
    Last Post: 09-05-2006, 10:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •