Sunday, July 5, 2020

#26 2020-05-07 08:35:41 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

epaminos wrote:

After the selection from the list, the floating window "Report" is not active and the paste function does not paste any text in the text field of it.

Here is the full script until now:

Applescript:

on run
   
   
   set theNames to {"aa", "bb"}
   set theExtensions to {"1", "2"}
   
   set thePF to choose from list theNames with prompt "Choose a prefix:"
   if thePF is false then error number -128
   set theExtension to item (getPositionOfItemInList((thePF as string), theNames)) of theExtensions
   return theExtension -- IS IT REALLY HERE ?
   set the clipboard to theExtension
   
   tell application "System Events" to tell process "Salary"
       set frontmost to true
       tell (first window whose subrole is "AXFloatingWindow")
           tell application "System Events"
               keystroke "v" using command down
           end tell
       end tell
       
       --        
   end tell
   
end run

on getPositionOfItemInList(theItem, theList)
   repeat with a from 1 to count of theList
       if item a of theList is theItem then return a
   end repeat
   return 0
end getPositionOfItemInList




Is the instruction commented as  -- IS IT REALLY HERE ?  really available in the tested code ?
If it is I may guarantee that nothing will be pasted because the instruction supposed to achieve the task is never reached.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 7 mai 2020 16:35:34

Offline

 

#27 2020-05-07 08:55:04 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Unfortunately it is still not working! None of the above methods!

System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow". Invalid index.




Here is the window from my app though to get an idea:
https://imgur.com/a/zRFYCDg

And with Accessibility Inspector I found out that it is in an external HTML that loads in that window named "Report"!

Last edited by epaminos (2020-05-07 09:30:37 am)

Offline

 

#28 2020-05-07 09:03:49 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

return theExtension -- IS IT REALLY HERE ?



Sorry, it was there from previous trials, amended at later stage to comment.

Offline

 

#29 2020-05-07 10:24:27 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

epaminos wrote:

Unfortunately it is still not working! None of the above methods!

System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow". Invalid index.




Here is the window from my app though to get an idea:
https://imgur.com/a/zRFYCDg

And with Accessibility Inspector I found out that it is in an external HTML that loads in that window named "Report"!



In your message #23 you wrote:

I identified the text area of the floating window:

static text "Optional" of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary" of application "System Events"



So, if as you wrote, the window "Report" is a floating window,
group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary" of application "System Events" really exists.

I carefully wrote:

For instance
your firstValue may  have to target : static text 3 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary" of application "System Events"


It seems that you missed the important words : For instance
I wrote 3 as I would have written 987 because as I am not a sooth sayer I can't guess which is the real index of the static text to set.
Now, given your screenshot, I assume that the true index is 1, so, may you try to use this subset of the script

Applescript:

set theExtension to "applescript"
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell (first window whose subrole is "AXFloatingWindow")
       set itsName to its name
       log its properties -- ADDED to get infos upon the window
       if exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 then
           set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 to theExtension
       else
           error "there is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in the window “" & itsName & "”"
       end if
   end tell
end tell

and let me know if it correctly replace the word "Optional" by the word "applescript".
If it doesn't, let me know what is reported in the log history.

You may also try this alternate version in which I assume that you have a single window named "Report"

Applescript:

set theExtension to "applescript"
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell window "Report"
       log its properties -- ADDED to get infos upon the window
       if exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 then
           set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 to theExtension
       else
           error "there is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in this window “Report”"
       end if
   end tell
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 7 mai 2020 18:14:32

Last edited by Yvan Koenig (2020-05-07 10:31:24 am)

Offline

 

#30 2020-05-07 10:43:22 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Here are the results:

tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    (*properties of window 1 of process Salary whose subrole = AXFloatingWindow*)
    exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> true
    set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "applescript"
end tell



However the greyed out text "Optional" from the text box has not been replaced.

Last edited by epaminos (2020-05-07 10:49:08 am)

Offline

 

#31 2020-05-07 11:46:16 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Try to run:

Applescript:

set theExtension to "applescript"
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell window "Report"
       log its properties -- ADDED to get infos upon the window
       if exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 then
           tell text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1
               class of UI elements --> it's supposed to return at least {group, group}
               tell group 1
                   class of UI elements --> I have no idea of what it's supposed to return {???}
               end tell -- group 1
               tell group 2
                   class of UI elements --> it's supposed to return at least {static text}
                   properties of every static text
                   set value of static text 1 to theExtension
                   delay 0.2
                   properties of static text 1
               end tell -- group 2
           end tell -- text area 1…
       else
           error "there is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in this window “Report”"
       end if
   end tell -- window "Report"
end tell -- "System Events"…

and return the entire log history.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 7 mai 2020 19:45:40

Offline

 

#32 2020-05-07 01:04:39 pm

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

tell application "System Events"
    set frontmost of process "Salary" to true
    (*properties of window Report of process Salary*)
    exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> true
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {group, group}
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {}
    get class of every UI element of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {static text}
    get properties of every static text of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {{minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}}
    set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary" to "applescript"
    get properties of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}
end tell
Result:
{minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}

Offline

 

#33 2020-05-07 02:18:03 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Thank you.

The static text doesn't obey to the instruction "set value"
Must try to use paste or keystroke.

Download Cliclick from  www.bluem.net
and install it as : "/usr/local/bin/cliclick"
By default, the folder "Macintosh HD:usr:" is invisible.
but you may open it with :

Applescript:

set p2usr to POSIX file "/usr/"
tell application "Finder" to open p2usr

If I remember well, a subfolder named "local" exists
but you will have to create its subfolder "bin" to get the hierarchy:
"Macintosh HR:usr:local:bin:" where you will store "cliclick".

Applescript:

-- version 1

property useClipboard : true -- try both settings
-- true --> use the clipboard
-- false --> doesn't use the clipboard

set theExtension to "applescript"
if useClipboard then set the clipboard to theExtension
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell window "Report"
       tell group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1
           -- class of UI elements --> {static text}
           set {x, y} to position of static text 1
           -- you may try to use : click at {x,y} -- but I doubt that it would work
           tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
           if useClipboard then
               keystroke "v" using {command down}
               keystroke return
           else
               keystroke theExtension & return
           end if
           delay 0.2
           class of UI elements --> {static element} + maybe a 2nd element
           properties of text items
       end tell
   end tell
end tell

Applescript:

-- version 2

property useClipboard : true -- try both settings
-- true --> use the clipboard
-- false --> doesn't use the clipboard

set theExtension to "applescript"
if useClipboard then set the clipboard to theExtension
set theExtension to "applescript"
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell window "Report"
       tell group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1
           -- class of UI elements --> {static text}
           set {x, y} to position of static text 1
       end tell
       tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
       if useClipboard then
           keystroke "v" using {command down}
           keystroke return
       else
           keystroke theExtension & return
       end if
       delay 0.2
       class of UI elements --> {static element} + maybe a 2nd element
       properties of text items
       
   end tell
end tell

I will be back tomorrow.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 7 mai 2020 22:07:37

Last edited by Yvan Koenig (2020-05-07 02:30:25 pm)

Offline

 

#34 2020-05-07 03:48:29 pm

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Thank you for your time today!

Unfortunately for both versions:

error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"




Full History Log:

tell application "System Events"
    set frontmost of process "Salary" to true
    get position of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
Result:
error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report k" of process "Salary"

Offline

 

#35 2020-05-07 09:39:06 pm

KniazidisR
Member
Registered: 2019-03-03
Posts: 1259

Re: Paste text to last active window

epaminos wrote:

So, by using this:
I identified the text area of the floating window:static text "Optional" of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary" of application "System Events"


Hi again. I was at work. So, you found static text in the entire contents of floating window. But as remember, one static text is like label, so its value doesn't change. Should be some text field or button, which corresponds to this static text.
2) you sad me that when you close other application's window, you see at the top of the screen the name of floating window. That is, this window is already focused (selected). You should try to select not the floating window, but text field or button corresponding to your static text. And, the click, showed by Yvan Koenig in his last script, maybe double-click depending on your application's realization.

NOTE: if selecting text field (or, button) works (select text field...blabla, or select button...blabla) or setting text field's or button's property focused to true, works, then you can click it without cliClick.

Last edited by KniazidisR (2020-05-07 09:45:32 pm)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#36 2020-05-07 09:43:46 pm

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Hello sir and thank you for your reply.

No worries, I was at work as well.

I will see that again later today, now it is too late and I will go to sleep.

Offline

 

#37 2020-05-08 02:32:01 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

epaminos wrote:

Thank you for your time today!

Unfortunately for both versions:

error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"




Full History Log:

tell application "System Events"
    set frontmost of process "Salary" to true
    get position of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
Result:
error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report k" of process "Salary"



It become odd.

In your message #32 we may read:

get class of every UI element of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {static text}
    get properties of every static text of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {{minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}}
    set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary" to "applescript"
    get properties of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}
end tell
Result:
{minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}


and in message #34 we read:

get position of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
Result:
error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report k" of process "Salary"



Of course, I guess that the name written at the very end : "Report k" is just a typo but it's puzzling to read that the object which existed (with an embedded text field) in first case doesn't exist in second case.

What changed between these two attempts ?

Is it a way to get a copy of the application ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 8 mai 2020 10:31:46

Offline

 

#38 2020-05-08 08:58:29 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Hey,

I do not know man! It drives me crazy!

I tried it again just now and both versions populate the same error:

error "System Events got an error: Can’t get group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window \"Report\" of process \"Salary\". Invalid index." number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"




(the extra k had been typed by accident when I pasted the log here and was editing it in quotes)

The Script Editor highlights though the word "position" of

Applescript:

set {x, y} to position of static text 1

I guess because the text area is not focused?

My apologies, unable to share as this is company's internal software with a lot of financial confidential data.

Offline

 

#39 2020-05-08 09:24:40 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Are you sure that the window has the same contents during every tests ?

My understanding is that in some conditions which I can't guess - but you are supposed to know them - the window contains the wanted UI element and that in other conditions it doesn't.

Your message #30 was clear enough:

Here are the results:

tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    (*properties of window 1 of process Salary whose subrole = AXFloatingWindow*)
    exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> true
    set value of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "applescript"
end tell



However the greyed out text "Optional" from the text box has not been replaced.



The “group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary"” was available and it contained a static text whose value was "Optional"
In other attempts such object wasn't available.
I wonder how you were able to ran the script without seeing such difference.

I apologize, it's your duty to take care of what is available in your window before trying to execute a given task.

So, please look carefully at what is available in your window before trying to run the script.
If the wanted text area it's useless to try to edit its contents.

Here is a slightly modified release of the script version 1.
If the window doesn't match the wanted item, it will not issue an error message to warn you, it will use a display dialog"

Applescript:

-- version 1

property useClipboard : true -- try both settings
-- true --> use the clipboard
-- false --> doesn't use the clipboard

set theExtension to "applescript"
if useClipboard then set the clipboard to theExtension
tell application "System Events" to tell process "Salary"
   set frontmost to true
   tell window "Report"
       if exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 then
           tell group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1
               class of UI elements --> {static text}
               value of static text 1
               set {x, y} to position of static text 1
               -- you may try to use : click static text 1 -- but I doubt that it would work
               tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
               if useClipboard then
                   keystroke "v" using {command down}
                   keystroke return
               else
                   keystroke theExtension & return
               end if
               delay 0.2
               class of UI elements --> {static element} + maybe a 2nd element
               properties of text items
           end tell
       else
           display dialog "No need to continue, the window “Report” doesn't contain the wanted text area" buttons {"Oops"}
       end if
   end tell
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 8 mai 2020 17:22:41

Offline

 

#40 2020-05-08 09:54:20 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Here is an expanded version which is supposed to return in the log history complementary informations which, I hope, will tell me what you failed to see.

Applescript:


set theExtension to "applescript"
tell application "System Events" to tell process "Salary"
   set frontmost to true
   
   name of every window
   subrole of every window
   
   tell (first window whose subrole is "AXFloatingWindow")
       get its properties
   end tell
   
   tell window "Report"
       set itsName to its name
       get its properties -- ADDED to get infos upon the window
       class of UI elements --> {group, ???, ???}
       tell group 1
           class of UI elements --> {group, ???, ???}
           tell group 1
               class of UI elements --> {scroll area, ???, ???}
               tell scroll area 1
                   class of UI elements --> {UI element, ???, ???}
                   tell UI element 1
                       class of UI elements --> {group, group, group, group, group, ???, ???}
                       try
                           log "group 1"
                           tell group 1
                               class of UI elements --> {group, ???, ???}
                               tell group 1
                                   class of UI elements --> {text area, ???, ???}
                                   tell text area 1
                                       class of UI elements --> {group, group, ???, ???}
                                       tell group 1
                                           class of UI elements --> {???, ???}
                                       end tell -- group 1
                                       tell group 2
                                           class of UI elements --> {static text, ???, ???}
                                           tell static text 1
                                               its properties -->
                                           end tell -- static text 1
                                       end tell -- group 2
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 1
                       end try
                       try
                           log "group 2"
                           tell group 2
                               class of UI elements --> {group, ???, ???}
                               tell group 1
                                   class of UI elements --> {text area, ???, ???}
                                   tell text area 1
                                       class of UI elements --> {group, group, ???, ???}
                                       tell group 1
                                           class of UI elements --> {???, ???}
                                       end tell -- group 1
                                       tell group 2
                                           class of UI elements --> {static text, ???, ???}
                                           tell static text 1
                                               its properties -->
                                           end tell -- static text 1
                                       end tell -- group 2
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 2
                       end try
                       try
                           log "group 3"
                           tell group 3
                               class of UI elements --> {group, ???, ???}
                               tell group 1
                                   class of UI elements --> {text area, ???, ???}
                                   tell text area 1
                                       class of UI elements --> {group, group, ???, ???}
                                       tell group 1
                                           class of UI elements --> {???, ???}
                                       end tell -- group 1
                                       tell group 2
                                           class of UI elements --> {static text, ???, ???}
                                           tell static text 1
                                               its properties -->
                                           end tell -- static text 1
                                       end tell -- group 2
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 3
                       end try
                       try
                           log "group 4"
                           tell group 4
                               class of UI elements --> {group, ???, ???}
                               tell group 1
                                   class of UI elements --> {text area, ???, ???}
                                   tell text area 1
                                       class of UI elements --> {group, group, ???, ???}
                                       tell group 1
                                           class of UI elements --> {???, ???}
                                       end tell -- group 1
                                       tell group 2
                                           class of UI elements --> {static text, ???, ???}
                                           tell static text 1
                                               its properties -->
                                           end tell -- static text 1
                                       end tell -- group 2
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 4
                       end try
                       try
                           log "group 5"
                           tell group 5
                               class of UI elements --> {group, ???, ???}
                               tell group 1
                                   class of UI elements --> {text area, ???, ???}
                                   tell text area 1
                                       class of UI elements --> {group, group, ???, ???}
                                       tell group 1
                                           class of UI elements --> {???, ???}
                                       end tell -- group 1
                                       tell group 2
                                           class of UI elements --> {static text, ???, ???}
                                           tell static text 1
                                               its properties -->
                                           end tell -- static text 1
                                       end tell -- group 2
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 5
                       end try
                   end tell -- UI element 1
               end tell -- scroll area 1
           end tell -- group 1
       end tell -- group 1
       
       if exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 then
           tell group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1
               class of UI elements
               set oldValue to value of static text 1
           end tell --
       else
           display dialog "There is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in the window “" & itsName & "”" buttons {"Oops"}
       end if
   end tell -- window 1
end tell -- System Events"

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) vendredi 8 mai 2020 17:54:00

Offline

 

#41 2020-05-09 03:33:38 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Good morning and thank you for your dedication!

So here is the full history log:

tell application "System Events"
    set frontmost of process "Salary" to true
    get name of every window of process "Salary"
        --> {"Report", "Salary"}
    get subrole of every window of process "Salary"
        --> {"AXFloatingWindow", "AXStandardWindow"}
    get properties of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3150, 624}, class:window, accessibility description:missing value, role description:"floating window", focused:false, title:"Report", size:{560, 636}, help:missing value, entire contents:{}, enabled:missing value, maximum value:missing value, role:"AXWindow", value:missing value, subrole:"AXFloatingWindow", selected:missing value, name:"Report", description:"floating window"}
    get name of window "Report" of process "Salary"
        --> "Report"
    get properties of window "Report" of process "Salary"
        --> {minimum value:missing value, orientation:missing value, position:{3150, 624}, class:window, accessibility description:missing value, role description:"floating window", focused:false, title:"Report", size:{560, 636}, help:missing value, entire contents:{}, enabled:missing value, maximum value:missing value, role:"AXWindow", value:missing value, subrole:"AXFloatingWindow", selected:missing value, name:"Report", description:"floating window"}
    get class of every UI element of window "Report" of process "Salary"
        --> {group, button, button, button, static text}
    get class of every UI element of group 1 of window "Report" of process "Salary"
        --> {group}
    get class of every UI element of group 1 of group 1 of window "Report" of process "Salary"
        --> {scroll area}
    get class of every UI element of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {UI element}
    get class of every UI element of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
    (*group 1*)
    get class of every UI element of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {pop up button}
    get class of every UI element of group 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
    (*group 2*)
    get class of every UI element of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {pop up button}
    get class of every UI element of group 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
    (*group 3*)
    get class of every UI element of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {pop up button}
    get class of every UI element of group 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
    (*group 4*)
    get class of every UI element of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {radio button, radio button, radio button}
    get class of every UI element of group 1 of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 1 of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
    (*group 5*)
    get class of every UI element of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {group}
    get class of every UI element of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {text area, group}
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {group}
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {static text}
    get class of every UI element of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> error number -1719 from group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
    exists group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> false
    display dialog "There is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in the window “Report”" buttons {"Oops"}
        --> error number -1708
    «event ascrgdut»
        --> error number -1708
    display dialog "There is no group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 in the window “Report”" buttons {"Oops"}
        --> {button returned:"Oops"}
end tell
Result:
{button returned:"Oops"}

Offline

 

#42 2020-05-09 06:42:58 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Thank you.

The window active in your late test is definitely not the same than the one reported in your message #32 in which we read:

get properties of static text 1 of group 2 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of process "Salary"
        --> {minimum value:missing value, orientation:missing value, position:{3510, 1069}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{55, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Optional", subrole:missing value, selected:false, name:"Optional", description:""}



How may you miss the fact that you aren't applying the script upon the same window ?

Maybe the developer changed the structure of its window but I hope that he is polite enough to inform you of such meaningful changes.
If he didn't, urge him to inform you of what he does with the structure of the window.
What is sure is that, as I already wrote, the current window is not structured as it was before.

Given the posted log history, I edited my script which, now, try to grab infos about items which were unknown before and I try to edit the content of the new structure.

Applescript:

#===== ===== ===== ===== ===== =====
-- Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 14:27:54
#===== ===== ===== ===== ===== =====

#===== ===== ===== ===== ===== =====
property useClipboard : true -- try with both settings <<<<<<<<<<<<<<<<<<<<<<<
-- true --> use the clipboard
-- false --> doesn't use the clipboard
#===== ===== ===== ===== ===== =====


set theExtension to "applescript"
if useClipboard then set the clipboard to theExtension

tell application "System Events" to tell process "Salary"
   set frontmost to true
   -- name of every window --> {"Report", "Salary"}
   -- subrole of every window --> {"AXFloatingWindow", "AXStandardWindow"}
   -- Now we know that the floating window is named "Report"
   tell (first window whose subrole is "AXFloatingWindow")
       -- for safe, check that the floating window is really named "Report"
       set itsName to its name --> "Report"
       -- its properties --> {minimum value:missing value, orientation:missing value, position:{3150, 624}, class:window, accessibility description:missing value, role description:"floating window", focused:false, title:"Report", size:{560, 636}, help:missing value, entire contents:{}, enabled:missing value, maximum value:missing value, role:"AXWindow", value:missing value, subrole:"AXFloatingWindow", selected:missing value, name:"Report", description:"floating window"}
       class of UI elements --> {group, button, button, button, static text}
       properties of buttons -->
       properties of static text 1 -->
       tell group 1
           class of UI elements --> {group}
           tell group 1 -- there is only one
               class of UI elements --> {scroll area}
               tell scroll area 1 -- there is only one
                   class of UI elements --> {UI element}
                   tell UI element 1 -- there is only one
                       class of UI elements --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
                       tell UI element 1
                           class of UI elements -->
                       end tell
                       properties of every static text -->
                       try
                           log ">>> group 1"
                           tell group 1
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   click it
                                   tell menu 1
                                       name of menu items -->
                                   end tell
                               end tell -- pop up button 1
                           end tell -- group 1
                       end try
                       try
                           log ">>> group 2"
                           tell group 2
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   click it
                                   tell menu 1
                                       name of menu items -->
                                   end tell
                               end tell -- pop up button 1
                           end tell -- group 2
                       end try
                       try
                           log ">>> group 3"
                           tell group 3
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   click it
                                   tell menu 1
                                       name of menu items -->
                                   end tell
                               end tell -- pop up button 1
                           end tell -- group 3
                       end try
                       try
                           log ">>> group 4"
                           tell group 4
                               class of UI elements --> {radio button, radio button, radio button}
                               properties of radio buttons -->
                           end tell -- group 4
                       end try
                       try
                           log ">>> group 5"
                           tell group 5
                               class of UI elements --> {group}
                               tell group 1 -- there is only one
                                   class of UI elements --> {text area, group}
                                   tell group 1
                                       class of UI elements -->
                                   end tell
                                   tell text area 1
                                       class of UI elements --> {group} as reported in messages #34 and #38, was {group, group} as reported in messages #32
                                       if (count every group) = 1 then
                                           -- It was reported in messages #34 and #38
                                           tell group 1
                                               class of UI elements --> {static text}
                                               set oldValue1 to value of static text 1 --> "Optional" ???
                                               -- try to change the value the classic way
                                               set value of static text 1 to "John Doe"
                                               delay 0.2
                                               set newValue1 to value of static text 1 --> "John Doe" if it's that, it's that the classic way works well
                                               -- you may try to use : click static text 1 -- but I doubt that it would work
                                               tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
                                               if useClipboard then
                                                   keystroke "v" using {command down}
                                                   keystroke return
                                               else
                                                   keystroke theExtension & return
                                               end if
                                               set altValue1 to value of static text 1 --> "applescript" if it's that, it's that the alternate way works well
                                               display dialog "oldValue1 = " & oldValue1 & ", newValue1 : " & newValue1 & ", altValue1 : " & altValue1
                                           end tell -- group 1
                                       else
                                           -- It was reported in message #32
                                           -- I keep it in case of possible return of this structure
                                           tell group 2
                                               class of UI elements --> {static text}
                                               set oldValue2 to value of static text 1 --> "Optional" ???
                                               -- try to change the value the classic way
                                               set value of static text 1 to "John Doe"
                                               delay 0.2
                                               set newValue2 to value of static text 1 --> "John Doe" if it's that, it's that the classic way works well
                                               -- you may try to use : click static text 1 -- but I doubt that it would work
                                               tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
                                               if useClipboard then
                                                   keystroke "v" using {command down}
                                                   keystroke return
                                               else
                                                   keystroke theExtension & return
                                               end if
                                               set altValue2 to value of static text 1 --> "applescript" if it's that, it's that the alternate way works well
                                           end tell -- group 2
                                           display dialog "oldValue2 = " & oldValue2 & ", newValue2 : " & newValue2 & ", altValue2 : " & altValue2
                                       end if
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 5
                       end try
                       
                   end tell -- UI element 1
               end tell -- scroll area 1
           end tell -- group 1
       end tell -- group 1
   end tell -- window 1
end tell -- System Events"

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 14:05:13

Offline

 

#43 2020-05-09 07:05:18 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Omg! You are right!

There was probably a silent update!

Now the default text for the third button is empty instead of "Select" and underneath there are 3 radio buttons.

So here we are:

tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group, button, button, button, static text}
    get properties of every button of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {{minimum value:missing value, orientation:missing value, position:{3155, 625}, class:button, accessibility description:missing value, role description:"close button", focused:false, title:missing value, size:{13, 14}, help:missing value, entire contents:{}, enabled:true, maximum value:missing value, role:"AXButton", value:missing value, subrole:"AXCloseButton", selected:missing value, name:missing value, description:"close button"}, {minimum value:missing value, orientation:missing value, position:{3191, 625}, class:button, accessibility description:missing value, role description:"zoom button", focused:false, title:missing value, size:{13, 14}, help:missing value, entire contents:{}, enabled:true, maximum value:missing value, role:"AXButton", value:missing value, subrole:"AXZoomButton", selected:missing value, name:missing value, description:"zoom button"}, {minimum value:missing value, orientation:missing value, position:{3173, 625}, class:button, accessibility description:missing value, role description:"minimize button", focused:false, title:missing value, size:{13, 14}, help:missing value, entire contents:{}, enabled:false, maximum value:missing value, role:"AXButton", value:missing value, subrole:"AXMinimizeButton", selected:missing value, name:missing value, description:"minimize button"}}
    get properties of static text 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3389, 625}, class:static text, accessibility description:missing value, role description:"text", focused:false, title:missing value, size:{83, 14}, help:missing value, entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Report", subrole:missing value, selected:missing value, name:"Report", description:"text"}
    get class of every UI element of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {scroll area}
    get class of every UI element of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element}
    get class of every UI element of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
    get class of every UI element of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get properties of every static text of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {{minimum value:missing value, orientation:missing value, position:{3182, 728}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{248, 16}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Advisor", subrole:missing value, selected:false, name:"Advisor", description:""}, {minimum value:missing value, orientation:missing value, position:{3182, 778}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{248, 16}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Category", subrole:missing value, selected:false, name:"Category", description:""}, {minimum value:missing value, orientation:missing value, position:{3182, 829}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{248, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Reason", subrole:missing value, selected:false, name:"Reason", description:""}, {minimum value:missing value, orientation:missing value, position:{3182, 884}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{248, 16}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Rating", subrole:missing value, selected:false, name:"Rating", description:""}, {minimum value:missing value, orientation:missing value, position:{3182, 937}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{40, 16}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"Notes", subrole:missing value, selected:false, name:"Notes", description:""}}
    (*>>> group 1*)
    get class of every UI element of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    click pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get name of every menu item of menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    (*>>> group 2*)
    get class of every UI element of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    click pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get name of every menu item of menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    (*>>> group 3*)
    get class of every UI element of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    click pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get name of every menu item of menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    (*>>> group 4*)
    get class of every UI element of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {radio button, radio button, radio button}
    get properties of every radio button of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {{minimum value:missing value, orientation:missing value, position:{3435, 879}, class:radio button, accessibility description:"Rating 1 out of 3", role description:"radio button", focused:false, title:"", size:{29, 33}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXRadioButton", value:0, subrole:missing value, selected:false, name:missing value, description:"Rating 1 out of 3"}, {minimum value:missing value, orientation:missing value, position:{3483, 879}, class:radio button, accessibility description:"Rating 2 out of 3", role description:"radio button", focused:false, title:"", size:{30, 33}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXRadioButton", value:0, subrole:missing value, selected:false, name:missing value, description:"Rating 2 out of 3 (FYI)"}, {minimum value:missing value, orientation:missing value, position:{3532, 879}, class:radio button, accessibility description:"Rating 3 out of 3", role description:"radio button", focused:false, title:"", size:{30, 33}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXRadioButton", value:0, subrole:missing value, selected:false, name:missing value, description:"Rating 3 out of 3"}}
    (*>>> group 5*)
    get class of every UI element of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {text area, group}
    get class of every UI element of group 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    count every group of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> 1
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    set value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "John Doe"
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
end tell

Offline

 

#44 2020-05-09 07:34:45 am

KniazidisR
Member
Registered: 2019-03-03
Posts: 1259

Re: Paste text to last active window

@epaminos,

finding a reference for your text field can take a long time. See the method for finding a reference to a specific UI element using the user actions Record function of Automator.app. I showed this method to @daBee in the topic "Scripting qBittorent". Everything is in the drawings there.

Last edited by KniazidisR (2020-05-09 07:55:41 am)


Model: MacBook Pro
OS X: Catalina 10.15.4
Web Browser: Safari 13.1
Ram: 4 GB

Offline

 

#45 2020-05-09 07:49:57 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Hooray!!!

I recorded the following actions in Automator as advised and finally it works!

Events:
-Mouse Clicked
-Click the text area.
-Click the text area.
-Press ⌘V

I have no words!

Thank you all guys for your dedication!

Your commitment is unparalleled!

Offline

 

#46 2020-05-09 08:25:55 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

Thank you.

Here is an enhanced version supposed to grab more infos.

I'm a bit bored to see that you disabled the instructions which were inserted to try to change the text value.
How are you hoping that I will learn the way they behave if you disable them.

In message #33 I gave you the related instructions:

Download Cliclick from  www.bluem.net
and install it as : "/usr/local/bin/cliclick"
By default, the folder "Macintosh HD:usr:" is invisible.
but you may open it with :

Applescript:


set p2usr to POSIX file "/usr/"
tell application "Finder" to open p2usr

If I remember well, a subfolder named "local" exists
but you will have to create its subfolder "bin" to get the hierarchy:
"Macintosh HR:usr:local:bin:" where you will store "cliclick".



I do my best but I am unable to install Cliclick for you.

Applescript:

#===== ===== ===== ===== ===== =====
-- Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 18:12:54
#===== ===== ===== ===== ===== =====

#===== ===== ===== ===== ===== =====
property useClipboard : false -- Use this one because pasting didn't change the text
-- true --> use the clipboard
-- false --> doesn't use the clipboard, use keystroke theExtension & return
#===== ===== ===== ===== ===== =====


set theExtension to "applescript"
if useClipboard then set the clipboard to theExtension

tell application "System Events" to tell process "Salary"
   set frontmost to true
   -- name of every window --> {"Report", "Salary"}
   -- subrole of every window --> {"AXFloatingWindow", "AXStandardWindow"}
   -- Now we know that the floating window is named "Report"
   tell (first window whose subrole is "AXFloatingWindow")
       -- for safe, check that the floating window is really named "Report"
       set itsName to its name --> "Report"
       -- its properties --> {minimum value:missing value, orientation:missing value, position:{3150, 624}, class:window, accessibility description:missing value, role description:"floating window", focused:false, title:"Report", size:{560, 636}, help:missing value, entire contents:{}, enabled:missing value, maximum value:missing value, role:"AXWindow", value:missing value, subrole:"AXFloatingWindow", selected:missing value, name:"Report", description:"floating window"}
       class of UI elements --> {group, button, button, button, static text}
       subrole of buttons --> {"AXCloseButton", "AXZoomButton", "AXMinimizeButton"}
       value of static text 1 --> "Report"
       tell group 1
           class of UI elements --> {group}
           tell group 1 -- there is only one
               class of UI elements --> {scroll area}
               tell scroll area 1 -- there is only one
                   class of UI elements --> {UI element}
                   tell UI element 1 -- there is only one
                       class of UI elements --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
                       tell UI element 1
                           class of UI elements --> {static text}
                           properties of static text 1
                       end tell
                       value of every static text --> {"Advisor", "Category", "Reason", "Rating", "Notes"}
                       try
                           log ">>> group 1"
                           tell group 1
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   its properties
                                   click it
                                   try -- it seems that there is no such classic level
                                       tell menu 1
                                           class of UI elements
                                       end tell
                                   end try
                                   try
                                       name of menu items -->
                                   end try
                               end tell -- pop up button 1
                           end tell -- group 1
                       end try
                       try
                           log ">>> group 2"
                           tell group 2
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   its properties
                                   click it
                                   try -- it seems that there is no such classic level
                                       tell menu 1
                                           class of UI elements
                                       end tell
                                   end try
                                   try
                                       name of menu items -->
                                   end try
                               end tell -- pop up button 1
                           end tell -- group 2
                       end try
                       try
                           log ">>> group 3"
                           tell group 3
                               class of UI elements --> {pop up button}
                               tell pop up button 1
                                   its properties
                                   click it
                                   try -- it seems that there is no such classic level
                                       tell menu 1
                                           class of UI elements
                                       end tell
                                   end try
                                   try
                                       name of menu items -->
                                   end try
                               end tell -- pop up button 1
                           end tell -- group 3
                       end try
                       try
                           log ">>> group 4"
                           tell group 4
                               class of UI elements --> {radio button, radio button, radio button}
                               description of radio buttons --> {"Rating 1 out of 3", "Rating 2 out of 3", "Rating 3 out of 3"}
                           end tell -- group 4
                       end try
                       try
                           log ">>> group 5"
                           tell group 5
                               class of UI elements --> {group}
                               tell group 1 -- there is only one
                                   class of UI elements --> {text area, group}
                                   tell group 1
                                       class of UI elements -->
                                   end tell
                                   tell text area 1
                                       class of UI elements --> {group} as reported in messages #34 and #38, was {group, group} as reported in messages #32
                                       if (count every group) = 1 then
                                           -- It was reported in messages #34 and #38
                                           tell group 1
                                               class of UI elements --> {static text}
                                               set oldValue1 to value of static text 1 --> "Optional" ???
                                               -- try to change the value the classic way
                                               set value of static text 1 to "John Doe"
                                               set {x, y} to position of static text 1 -- I forgot it so an error was silently issued below !
                                               delay 0.2
                                               set newValue1 to value of static text 1 --> "Optional"
                                               -- The classic way to set the value doesn't work
                                               -- I'm not surprised, it didn't with the old structure!
                                               #===== ===== ===== ===== ===== =====
                                               -- This group of instructions was not executed !!!!!!!!!
                                               -- How may I know which scheme is working correctly ?
                                               -- I can't install Cliclick for you !!!!!!
                                               -- you may try to use : click static text 1 -- but I doubt that it would work
                                               -- as {x, y} was not defined an error was silently issued. What an ass !
                                               tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
                                               if useClipboard then
                                                   keystroke "v" using {command down}
                                                   keystroke return
                                               else
                                                   keystroke theExtension & return
                                               end if
                                               set altValue1 to value of static text 1 --> "applescript" if it's that, it's that the alternate way works well
                                               display dialog "oldValue1 = " & oldValue1 & ", newValue1 : " & newValue1 & ", altValue1 : " & altValue1
                                               #===== ===== ===== ===== ===== =====
                                               
                                           end tell -- group 1
                                       else
                                           -- It was reported in message #32
                                           -- I keep it in case of possible return of this structure
                                           tell group 2
                                               class of UI elements --> {static text}
                                               set oldValue2 to value of static text 1 --> "Optional" ???
                                               -- try to change the value the classic way
                                               set value of static text 1 to "John Doe"
                                               set {x, y} to position of static text 1 -- I forgot it !
                                               delay 0.2
                                               set newValue2 to value of static text 1 --> "John Doe" if it's that, it's that the classic way works well
                                               -- you may try to use : click static text 1 -- but I doubt that it would work
                                               tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & y -- third party CLI to click upon the static text
                                               if useClipboard then
                                                   keystroke "v" using {command down}
                                                   keystroke return
                                               else
                                                   keystroke theExtension & return
                                               end if
                                               set altValue2 to value of static text 1 --> "applescript" if it's that, it's that the alternate way works well
                                           end tell -- group 2
                                           display dialog "oldValue2 = " & oldValue2 & ", newValue2 : " & newValue2 & ", altValue2 : " & altValue2
                                       end if
                                   end tell -- text area 1
                               end tell -- group 1
                           end tell -- group 5
                       end try
                       try
                           tell group 6
                               class of UI elements --> {button, group}
                               properties of button 1
                               tell group 1
                                   class of UI elements
                               end tell
                           end tell -- group 6
                       end try
                   end tell -- UI element 1
               end tell -- scroll area 1
           end tell -- group 1
       end tell -- group 1
   end tell -- window 1
end tell -- System Events"

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 16:25:49

Added two forgotten instructions.

Last edited by Yvan Koenig (2020-05-10 02:30:18 am)

Offline

 

#47 2020-05-09 08:52:00 am

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

Yes, I followed your steps and had cliclick already installed as advised.

tell application "Script Editor"
    set the clipboard to "applescript"
end tell
tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group, button, button, button, static text}
    get subrole of every button of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"AXCloseButton", "AXZoomButton", "AXMinimizeButton"}
    get value of static text 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {scroll area}
    get class of every UI element of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element}
    get class of every UI element of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
    get class of every UI element of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get properties of static text 1 of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3359, 656}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{142, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"", subrole:missing value, selected:false, name:"", description:""}
    get value of every static text of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Add”, "Category", "Reason", "Rating", "Notes"}
    (*>>> group 1*)
    get class of every UI element of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 721}, class:pop up button, accessibility description:"Add", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Add"}
    click pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 2*)
    get class of every UI element of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 771}, class:pop up button, accessibility description:"Category", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Category"}
    click pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 3*)
    get class of every UI element of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 821}, class:pop up button, accessibility description:"Reason", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"
", subrole:missing value, selected:false, name:missing value, description:"Reason"}
    click pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 4*)
    get class of every UI element of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {radio button, radio button, radio button}
    get description of every radio button of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Rating 1 out of 3", "Rating 2 out of 3", "Rating 3 out of 3"}
    (*>>> group 5*)
    get class of every UI element of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {text area, group}
    get class of every UI element of group 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    count every group of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> 1
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    set value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "John Doe"
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    get class of every UI element of group 6 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {button, group}
end tell
Result:
{button, group}

Offline

 

#48 2020-05-09 09:21:16 am

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

So once again the value of the static text is not set.
Alas your history doesn't tell me if the property useClipboard was set to true or if it was set to false.
I carefully wrote instructions about that at the beginning of the script:

Applescript:


#===== ===== ===== ===== ===== =====
property useClipboard : true -- try with both settings <<<<<<<<<<<<<<<<<<<<<<<
-- true --> use the clipboard
-- false --> doesn't use the clipboard
#===== ===== ===== ===== ===== =====

and I don't understand why there is no report about the clicclick action in your  history.

I will post a log of what I get when I use it.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 17:21:09

OOPS, it's my fault, I forgot two instructions.

Wait a minute I, will add them in the script above.

Last edited by Yvan Koenig (2020-05-09 09:46:27 am)

Offline

 

#49 2020-05-09 01:53:59 pm

Yvan Koenig
Member
Registered: 2006-09-14
Posts: 4534

Re: Paste text to last active window

What is returned by the edited version in message #46 ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 9 mai 2020 21:53:53

Offline

 

#50 2020-05-09 06:30:53 pm

epaminos
Member
Registered: 2019-10-18
Posts: 57

Re: Paste text to last active window

So here are the new History Logs:

property useClipboard : true

tell application "Script Editor"
    set the clipboard to "applescript"
end tell
tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group, button, button, button, static text}
    get subrole of every button of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"AXCloseButton", "AXZoomButton", "AXMinimizeButton"}
    get value of static text 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {scroll area}
    get class of every UI element of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element}
    get class of every UI element of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
    get class of every UI element of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get properties of static text 1 of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3359, 656}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{142, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"", subrole:missing value, selected:false, name:"", description:""}
    get value of every static text of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Add", "Category", "Reason", "Rating", "Notes"}
    (*>>> group 1*)
    get class of every UI element of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 721}, class:pop up button, accessibility description:"Add", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Add"}
    click pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 2*)
    get class of every UI element of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 771}, class:pop up button, accessibility description:"Category", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Category"}
    click pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 3*)
    get class of every UI element of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 821}, class:pop up button, accessibility description:"Reason", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"
", subrole:missing value, selected:false, name:missing value, description:"Reason"}
    click pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 4*)
    get class of every UI element of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {radio button, radio button, radio button}
    get description of every radio button of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Rating 1 out of 3", "Rating 2 out of 3", "Rating 3 out of 3"}
    (*>>> group 5*)
    get class of every UI element of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {text area, group}
    get class of every UI element of group 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    count every group of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> 1
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    set value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "John Doe"
    get position of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {3189, 971}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:3189,971"
        --> ""
end tell
tell application "System Events"
    keystroke "v" using {command down}
    keystroke "
"
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    display dialog "oldValue1 = Optional, newValue1 : Optional, altValue1 : Optional"
        --> error number -1708
    «event ascrgdut»
        --> error number -1708
    display dialog "oldValue1 = Optional, newValue1 : Optional, altValue1 : Optional"
        --> {button returned:"OK"}
    get class of every UI element of group 6 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from window 1 of process "Salary" whose subrole = "AXFloatingWindow"
end tell







property useClipboard : false

tell application "System Events"
    set frontmost of process "Salary" to true
    get name of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group, button, button, button, static text}
    get subrole of every button of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"AXCloseButton", "AXZoomButton", "AXMinimizeButton"}
    get value of static text 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Report"
    get class of every UI element of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {scroll area}
    get class of every UI element of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element}
    get class of every UI element of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {UI element, static text, group, static text, group, static text, group, static text, group, static text, group, group}
    get class of every UI element of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get properties of static text 1 of UI element 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3359, 656}, class:static text, accessibility description:"", role description:"text", focused:false, title:"", size:{142, 17}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXStaticText", value:"", subrole:missing value, selected:false, name:"", description:""}
    get value of every static text of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Add", "Category", "Reason", "Rating", "Notes"}
    (*>>> group 1*)
    get class of every UI element of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 721}, class:pop up button, accessibility description:"Add", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Add"}
    click pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 1 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 2*)
    get class of every UI element of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 771}, class:pop up button, accessibility description:"Category", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"Select", subrole:missing value, selected:false, name:missing value, description:"Category"}
    click pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 2 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 3*)
    get class of every UI element of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {pop up button}
    get properties of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {minimum value:missing value, orientation:missing value, position:{3430, 821}, class:pop up button, accessibility description:"Reason", role description:"pop up button", focused:false, title:"", size:{248, 30}, help:"", entire contents:{}, enabled:true, maximum value:missing value, role:"AXPopUpButton", value:"
", subrole:missing value, selected:false, name:missing value, description:"Reason"}
    click pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window "Report" of application process "Salary"
    get class of every UI element of menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from menu 1 of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
    get name of every menu item of pop up button 1 of group 3 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {}
    (*>>> group 4*)
    get class of every UI element of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {radio button, radio button, radio button}
    get description of every radio button of group 4 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {"Rating 1 out of 3", "Rating 2 out of 3", "Rating 3 out of 3"}
    (*>>> group 5*)
    get class of every UI element of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    get class of every UI element of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {text area, group}
    get class of every UI element of group 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get class of every UI element of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {group}
    count every group of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> 1
    get class of every UI element of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {static text}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
    set value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow" to "John Doe"
    get position of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> {3189, 971}
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "Optional"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:3189,971"
        --> ""
end tell
tell application "System Events"
    keystroke "applescript
"
    get value of static text 1 of group 1 of text area 1 of group 1 of group 5 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> "AppleScript"
    display dialog "oldValue1 = Optional, newValue1 : Optional, altValue1 : AppleScript"
        --> {button returned:"OK"}
    get class of every UI element of group 6 of UI element 1 of scroll area 1 of group 1 of group 1 of window 1 of process "Salary" whose subrole = "AXFloatingWindow"
        --> error number -1719 from window 1 of process "Salary" whose subrole = "AXFloatingWindow"
end tell

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)