• 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
RE: Xcode and text field
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Xcode and text field


  • Subject: RE: Xcode and text field
  • From: Scott Babcock <email@hidden>
  • Date: Sat, 6 Jun 2009 12:35:50 -0700
  • Acceptlanguage: en-US
  • Thread-topic: Xcode and text field

Instead of sending a keystroke, you might try the "AXConfirm" action:

    set value of path_field to "//src/CVS/devel"
    perform action "AXConfirm" of path_field

You shouldn't need to set the focus since you're not sending keystrokes.
The "AXConfirm" action should inform the code behind the field of the new value.

Of course, if this doesn't work as it should, it appears you've found the workaround...
________________________________________
Date: Sat, 06 Jun 2009 01:21:28 -0400
From: Dmitry Markman <email@hidden>
Subject: Re: Xcode and text field
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset="windows-1252"

finally the following works

the following lines fixed the problem:

                                set focused to true --setting focus
                                set value to cvs_path
                                keystroke linefeed --workaround

--------------------------------------------------------------------------

set cvs_path to "//src/CVS/devel"
set repository_name to "MyRepository"
tell application "Xcode"
        activate
end tell
tell application "System Events"
        tell process "Xcode"
                tell menu bar 1
                        tell menu bar item "Xcode"
                                tell menu 1
                                        click menu item "Preferences?"
                                end tell
                        end tell
                end tell
                delay 2
                click button 12 of radio group 1 of scroll area 1 of window "Xcode
Preferences" --SCM
                delay 2
                set repositories to table 1 of scroll area 1 of tab group 1 of group
1 of group 1 of window "Xcode Preferences"
                set my_rows to get every row of repositories
                set row_mathworks to {}
                delay 2
                repeat with r in my_rows
                        set tf to text field 1 of r
                        if value of tf is repository_name then
                                set row_mathworks to r
                                exit repeat
                        end if
                end repeat
                if row_mathworks is {} then
                        set add_button to (button 1 of tab group 1 of group 1 of group 1 of
window "Xcode Preferences")
                        tell add_button
                                click
                        end tell
                        set value of text field 1 of sheet 1 of window "Xcode Preferences"
to repository_name
                        click button "OK" of sheet 1 of window "Xcode Preferences"
                        set path_field to text field 6 of group 1 of tab group 1 of group 1
of group 1 of window "Xcode Preferences"
                        tell path_field
                                set focused to true --setting focus
                                set value to cvs_path
                                keystroke linefeed --workaround
                        end tell
                        click button "Apply" of list 1 of window "Xcode Preferences"
                end if
        end tell
end tell



On Jun 6, 2009, at 1:10 AM, Dmitry Markman wrote:

> the following fix the problem
>
>
>                       tell path_field
>                               set focused to true
>                               set value to "//src/CVS/devel"
>                               keystroke " "
>                       end tell
>
>
> or
>
>
>                       tell path_field
>                               set focused to true
>                               set value to "//src/CVS/deve"
>                               keystroke "l"
>                       end tell
>
> I should set focused to true, set value and send some keystroke, odd
>
> I probably create a bug report
>
>
>
> On Jun 6, 2009, at 12:37 AM, Dmitry Markman wrote:
>
>> I think problem is that text field doesn't have focus
>> and I have no idea how to set focus to that text field (select
>> doesn't work)
>>
>> On Jun 6, 2009, at 12:09 AM, Dmitry Markman wrote:
>>
>>> Hi, I'm trying to setup CVS repository with AppleScript
>>>
>>> tell application "Xcode"
>>>     activate
>>> end tell
>>> tell application "System Events"
>>>     tell process "Xcode"
>>>             tell menu bar 1
>>>                     tell menu bar item "Xcode"
>>>                             tell menu 1
>>>                                     click menu item "Preferences?"
>>>                             end tell
>>>                     end tell
>>>             end tell
>>>             delay 2
>>>             click button 12 of radio group 1 of scroll area 1 of window
>>> "Xcode Preferences" --SCM
>>>             delay 2
>>>             set repositories to table 1 of scroll area 1 of tab group 1 of
>>> group 1 of group 1 of window "Xcode Preferences"
>>>             set my_rows to get every row of repositories
>>>             set  row_repository to {}
>>>             repeat with r in my_rows
>>>                     set tf to text field 1 of r
>>>                     if value of tf is "MyRepository" then
>>>                             set  row_repository to r
>>>                             exit repeat
>>>                     end if
>>>             end repeat
>>>             if row_repository is {} then
>>>                     set add_button to (button 1 of tab group 1 of group 1 of group
>>> 1 of window "Xcode Preferences")
>>>                     tell add_button
>>>                             click
>>>                     end tell
>>>                     delay 2
>>>                     set value of text field 1 of sheet 1 of window "Xcode
>>> Preferences" to "MyRepository"
>>>                     delay 2
>>>                     click button "OK" of sheet 1 of window "Xcode Preferences"
>>>                     delay 2
>>>                 --path field
>>>                     set path_field to text field 6 of group 1 of tab group 1 of
>>> group 1 of group 1 of window "Xcode Preferences"
>>>                     tell path_field
>>>                             delay 2
>>>                             select
>>>                             set value to "//src/CVS/devel"
>>>                             delay 2
>>>                     end tell
>>>                     delay 2
>>>                     delay 2
>>>                     click button "Apply" of list 1 of window "Xcode Preferences"
>>>             end if
>>>     end tell
>>> end tell
>>>
>>> Everything almost works, I can see value //src/CVS/devel in the
>>> Path field
>>> but clicking on the button Apply has no effect and if I quit and
>>> restart Xcode Path field is empty
>>> it looks like setting value isn't really working: Xcode didn't get
>>> that value - it's only visual
>>> I tried to use select, but it didn't help
>>> is it known problem?
>>>
>>> if I manually type "//src/CVS/devel" in the Path text field and
>>> click on the "Apply" button everything does work
>>>
>>> it is similar to the setting values for the field in the Xcode
>>> target properties dialogs
>>>
>>>
>>> thanks
>>>
>>>
>>>
>>>
>>>
>>> Dmitry Markman
>>>
>>> _______________________________________________
>>> 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
>>
>> Dmitry Markman
>>
>> _______________________________________________
>> 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
>
> Dmitry Markman
>

Dmitry Markman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.apple.com/mailman/private/applescript-users/attachments/20090606/5aacefe1/attachment.html

------------------------------

_______________________________________________
AppleScript-Users mailing list
email@hidden
http://lists.apple.com/mailman/listinfo/applescript-users

End of AppleScript-Users Digest, Vol 6, Issue 259
*************************************************

 _______________________________________________
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

  • Follow-Ups:
    • Re: Xcode and text field
      • From: Dmitry Markman <email@hidden>
  • Prev by Date: Re: Operator vs. Command precedence
  • Next by Date: Re: Operator vs. Command precedence
  • Previous by thread: Re: Xcode and text field
  • Next by thread: Re: Xcode and text field
  • Index(es):
    • Date
    • Thread