Tuesday, September 29, 2020

#26 2019-12-16 02:57:37 pm

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

Re: AppleScript stopped working after update to 10.13

May you try this version which is supposed to achieve the wanted task ?

Applescript:

tell application "VeraCrypt"
   activate
   tell application "System Events"
       tell process "VeraCrypt"
           set frontmost to true
           --repeat until exists window "VeraCrypt"
           --delay 0.1 # Don't forget that this loop fails
           --end repeat
           repeat 10 times
               if exists window "VeraCrypt" then exit repeat
               delay 0.1
           end repeat
           if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
           tell window "VeraCrypt"
               (*
               --class of UI elements --> {group, scroll bar, group, button, button, button, group, image, combo box, button, checkbox, button, button, group, button, group, button, group, button, group, button, button, button, button, static text}
               # The same list with the names of UI elements
               --> {group 1, scroll bar 1, group 2, button "Create Volume", button "Volume Properties...", button "Wipe Cache", group "Volume", image 1, combo box 1, button "Select File...", checkbox "Never save history", button "Volume Tools...", button "Select Device...", group 4, button "Mount", group 5, button "Mount All Devices", group 6, button "Dismount All", group 7, button "Close", button 11, button 12, button 13, static text "VeraCrypt"}
               tell scroll bar 1
                   --class of UI elements --> {value indicator, button, button, button, button}
                   name of buttons -->
               end tell # scroll bar 1
               *)

               tell combo box 1
                   set value of attribute "AXFocused" to true
                   -- delay 0.5 # may be useful here
                   set its value to "/Volumes/Data/VC/file"
               end tell # combo box 1
               click button "Mount"
           end tell # window "VeraCrypt"
       end tell # process Veracrypt
   end tell # Application System Events
end tell # Application Veracrypt

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) lundi 16 décembre 2019  21:54:18

Offline

 

#27 2019-12-17 12:44:37 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Yvan good morning!  It works!  What a nice thing to wake up to. Thanks.  And also thanks to KniazidisR.

Some fine tweeting if we can and if I am not over-stretching you willingness to help.  See pic

https://ibb.co/WgCgMZt

As you can see there are different slots.  The green one is the one selected by me.  The script however takes whatever slot was selected before.  That is why I scrolled up and than down in my original script.   I like to be able to define the slot.  Reason be is that if I load more than one encrypted volume each one needs to be in its own slot.

Your script is complex for me, and looking at it I do not know where to insert, and how, such a command.

If it is easy to do great, if not I need to live with it, I am already very happy with this result as it makes mounting a volume so much easier compared to doing it manually.

Offline

 

#28 2019-12-17 02:54:09 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

KniazidisR wrote:


Easy you can save it as application with its icon stayed on the Dock. Every time you will click application's icon, it will executed once. You can attach to application custom icon too.



That I know, I usually operate them from the bar. 

KniazidisR wrote:


Where you want insert the script?



Your answer does not answer my question though, I think you misunderstood.  I want to select, lets say, position 2 in VC to load the encrypted volume in that position.  Positioning is important in this as one volume can only occupy one position in VC.  See pic in last post of mine.

Offline

 

#29 2019-12-17 05:01:27 am

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

Re: AppleScript stopped working after update to 10.13

OK, glad to see that it works.

Here is a stripped version which will return the position and the size of every group in the window so I will be able to know which is the group containing the slots.
It will also return the name and the position of every buttons.

script #1

Applescript:

tell application "VeraCrypt"
   activate
   tell application "System Events"
       tell process "VeraCrypt"
           set frontmost to true
           --repeat until exists window "VeraCrypt"
           --delay 0.1 # Don't forget that this loop fails
           --end repeat
           repeat 10 times
               if exists window "VeraCrypt" then exit repeat
               delay 0.1
           end repeat
           if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
           tell window "VeraCrypt"
               
               --class of UI elements --> {group, scroll bar, group, button, button, button, group, image, combo box, button, checkbox, button, button, group, button, group, button, group, button, group, button, button, button, button, static text}
               # The same list with the names of UI elements
               --> {group 1, scroll bar 1, group 2, button "Create Volume", button "Volume Properties...", button "Wipe Cache", group "Volume", image 1, combo box 1, button "Select File...", checkbox "Never save history", button "Volume Tools...", button "Select Device...", group 4, button "Mount", group 5, button "Mount All Devices", group 6, button "Dismount All", group 7, button "Close", button 11, button 12, button 13, static text "VeraCrypt"}
               position of groups
               log result
               size of groups
               log result
               name of buttons
               log result
               position of buttons
               log result
               (*
               tell scroll bar 1
                   --class of UI elements --> {value indicator, button, button, button, button}
                   name of buttons -->
               end tell # scroll bar 1
               
               tell combo box 1
                   set value of attribute "AXFocused" to true
                   -- delay 0.5 # may be useful here
                   set its value to "/Volumes/Data/VC/file"
               end tell # combo box 1
               click button "Mount"
               *)

           end tell # window "VeraCrypt"
       end tell # process Veracrypt
   end tell # Application System Events
end tell # Application Veracrypt

May you download the trial version of UI Browser from : <https://pfiddlesoft.com/uibrowser/> ?
It's supposed to work from 10.10 thru 10.15.
Running it would give infos about the area displaying the slots.

As now we know that the app doesn't recognize the clause 'until', may you try the code below which just does what your old cod did but use an alternate scheme to check that the window Verascript is available.

script #2

Applescript:

tell application "VeraCrypt" to activate
tell application "System Events"
   tell application process "VeraCrypt"
       set frontmost to true
       (* now we know that VeraCrypt doesn't recognize the clause 'until'
       repeat until window "VeraCrypt" exists
           delay 0.1
       end repeat
       *)

       # Try this alternate one
       repeat 10 times
       if exists window "VeraCrypt" then exit repeat
       delay .1
       end repeat
       if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
   end tell # process "VeraCrypt"
   # Move to top of the list of slots # EDITED, was 'the very bottom'
   repeat 20 times
       key code 126 # press up arrow # EDITED, was 'down arrow'
   end repeat
   # Move to second slot # EDITED, was 'the next to last'
   key code 125 # press down arrow # EDITED, was 'up arrow'
   # Select the slot
   keystroke tab
   delay 1 # If all works, try to reduce it to delay 0.5
   keystroke "/Volumes/Data/VC/file"
   --key code 76 # issue a linefeed
   keystroke linefeed
end tell # System Events

or

script #3

Applescript:

tell application "VeraCrypt"
   activate
   tell application "System Events"
       tell process "VeraCrypt"
           set frontmost to true
           --repeat until exists window "VeraCrypt"
           --delay 0.1 # Don't forget that this loop fails
           --end repeat
           repeat 10 times
               if exists window "VeraCrypt" then exit repeat
               delay 0.1
           end repeat
           if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
           tell window "VeraCrypt"
               (*
               --class of UI elements --> {group, scroll bar, group, button, button, button, group, image, combo box, button, checkbox, button, button, group, button, group, button, group, button, group, button, button, button, button, static text}
               # The same list with the names of UI elements
               --> {group 1, scroll bar 1, group 2, button "Create Volume", button "Volume Properties...", button "Wipe Cache", group "Volume", image 1, combo box 1, button "Select File...", checkbox "Never save history", button "Volume Tools...", button "Select Device...", group 4, button "Mount", group 5, button "Mount All Devices", group 6, button "Dismount All", group 7, button "Close", button 11, button 12, button 13, static text "VeraCrypt"}
               tell scroll bar 1
                   --class of UI elements --> {value indicator, button, button, button, button}
                   name of buttons -->
               end tell # scroll bar 1
               *)

               # Move to top of the list of slots # EDITED, was 'the very bottom'
               repeat 20 times
                   key code 126 # press up arrow # EDITED, was 'down arrow'
               end repeat
               # Move to second slot # EDITED, was 'the next to last'
               key code 125 # press down arrow # EDITED, was 'up arrow'
               # Select the slot
               keystroke tab
               delay 1 # If all works, try to reduce it to delay 0.5
               tell combo box 1
                   set value of attribute "AXFocused" to true
                   -- delay 0.5 # may be useful here
                   set its value to "/Volumes/Data/VC/file"
               end tell # combo box 1
               click button "Mount"
           end tell # window "VeraCrypt"
       end tell # process Veracrypt
   end tell # Application System Events
end tell # Application Veracrypt

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  12:01:06

EDITED some erroneous comments and add scripts numbering.

Last edited by Yvan Koenig (2019-12-17 07:38:52 am)

Offline

 

#30 2019-12-17 05:07:26 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

your first script returns:

Applescript:

tell application "VeraCrypt"
   activate
end tell
tell application "System Events"
   set frontmost of application process "VeraCrypt" to true
   exists window "VeraCrypt" of application process "VeraCrypt"
       --> true
   exists window "VeraCrypt" of application process "VeraCrypt"
       --> true
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 125
   keystroke "    "
   keystroke "/Volumes/Data/VC/file"
   keystroke "
"

end tell

the second one goes al the way to hitting the Mount button

Applescript:

tell application "VeraCrypt"
   activate
end tell
tell application "System Events"
   set frontmost of process "VeraCrypt" to true
   exists window "VeraCrypt" of process "VeraCrypt"
       --> true
   exists window "VeraCrypt" of process "VeraCrypt"
       --> true
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 126
   key code 125
   keystroke "    "
   set value of attribute "AXFocused" of combo box 1 of window "VeraCrypt" of process "VeraCrypt" to true
   set value of combo box 1 of window "VeraCrypt" of process "VeraCrypt" to "/Volumes/Data/VC/file"
   click button "Mount" of window "VeraCrypt" of process "VeraCrypt"
       --> button "Mount" of window "VeraCrypt" of application process "VeraCrypt"
end tell
Result:
button "Mount" of window "VeraCrypt" of application process "VeraCrypt" of application "System Events"

Offline

 

#31 2019-12-17 07:37:29 am

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

Re: AppleScript stopped working after update to 10.13

@ ChangeAgent

In fact you posted what is returned by my 2nd and 3rd scripts.
The 1st one was supposed to return infos about groups and buttons.

script #2
is supposed to move the cursor in the window to select the wanted slot,
then it's supposed to 'type' the POSIX path "/Volumes/Data/VC/file" in the dedicated combo box,
at last it is supposed to 'type' a linefeed to activate the default button "Mount".

script #3
is supposed to move the cursor in the window to select the wanted slot.
then it's supposed to fill the dedicated combo box with the POSIX path "/Volumes/Data/VC/file",
at last it is supposed to click the button "Mount".

What you posted show that all the instructions are executed.
What isn't clear is if they executed the wanted tasks.
Is the correct slot selected ?
Is the mount action executed ?

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  14:37:02

Offline

 

#32 2019-12-17 08:36:34 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Yvan Koenig wrote:

@ ChangeAgent
Is the correct slot selected ?
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  14:37:02



no

Yvan Koenig wrote:

@ ChangeAgent
Is the mount action executed ?
Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  14:37:02



yes

Offline

 

#33 2019-12-17 09:17:18 am

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

Re: AppleScript stopped working after update to 10.13

Thanks.
As the code supposed to select the correct slot failed try again with the scheme given by KniazidisR

Please, change nothing to the code below.
Grab it clicking upon the button [Open this Scriplet in your Editor:]

Applescript:


use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "ApplicationServices"
use framework "Quartz"
use framework "AppKit"
property updateMouseCursorPosition : true
property buttonCount : 1 -- left mouse button number
property mouseButtonDown : true -- mouse button pressed?
property slots : {60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300}

set aPoint to current application's CGPointZero

tell application "VeraCrypt" to activate
tell application "System Events"
   tell application process "VeraCrypt"
       set frontmost to true
       --repeat until exists window "VeraCrypt"
       --delay 0.1 # Don't forget that this loop fails
       --end repeat
       repeat 10 times
           if exists window "VeraCrypt" then exit repeat
           delay 0.1
       end repeat
       if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
       --set w to window "VeraCrypt"
       tell window "VeraCrypt"
           set {x, y} to its position
           log (get position of groups) # May be useful to check the values in the property slots
           log (get size of groups) # May be useful to check the values in the property slots
           tell scroll bar 1
               log {its position, linefeed, its size} # May be useful to check the values in the property slots
               repeat 20 times
                   click button 4
               end repeat
           end tell # scroll bar 1
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
   -- Choose 2nd slot
   set aPoint to {x + 100, y + (item 2 of slots)} -- set the point coordinates on the screen
   mouseLeftClick of me at aPoint -- perform left click and move the cursor to new position
   -- Choose text field to keystroke the path
   tell application process "VeraCrypt"
       tell window "VeraCrypt"
           tell combo box 1
               set value of attribute "AXFocused" to true
               -- delay 0.5 # may be useful here
               set its value to "/Volumes/Data/VC/file"
           end tell # combo box 1
           click button "Mount"
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
end tell # Application System Events
--tell application "VeraCrypt" to activate

on setPoint(xPos, yPos)
   set pt to current application's CGPointMake(0, 0)
   set pt to {xPos, yPos}
   return pt
end setPoint

on mouseLeftClick at aPoint
   current application's CGPostMouseEvent(aPoint, updateMouseCursorPosition, buttonCount, mouseButtonDown)
   current application's CGPostMouseEvent(aPoint, updateMouseCursorPosition, buttonCount, not mouseButtonDown)
end mouseLeftClick

I guess that it will change the selected slot but I'm not sure that it selects the good one.
This is why I urged the script to log some informations about size and locations of some UI elements.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  16:14:25

Offline

 

#34 2019-12-17 10:28:09 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

get the following error Yvan:

Result:
error "Can’t get CGPointZero." number -1728 from CGPointZero

Offline

 

#35 2019-12-17 11:14:07 am

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

Re: AppleScript stopped working after update to 10.13

KniazidisR wrote:

Read the following carefully, ChangeAgent, so that I can understand why the code works for me, but not for you.

1) Copy the code that you run and paste into this topic, as is.
2) Check if the frameworks, used in the script, exists on location /System/Library/Frameworks

I will not look for the final solution for you. I just don’t have time for this and I also uninstalled the application too. My code can choose any slot. You just need to learn the AppleScript language carefully or ask a friend to help in the final implementation.



I tested the bare:

Applescript:

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "ApplicationServices"
use framework "Quartz"
use framework "AppKit"
property updateMouseCursorPosition : true
property buttonCount : 1 -- left mouse button number
property mouseButtonDown : true -- mouse button pressed?
property slots : {60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300}

set aPoint to current application's CGPointZero

and got exactly what ChangeAgent reported.

I replaced 'use AppleScript version "2.4"' by 'use AppleScript version "2.5"'
and  got {x:0.0, y:0.0}
As I am pig headed, I reverted to  'use AppleScript version "2.4"'  and this time I got:
{x:0.0, y:0.0}
So, I apologize.
There is a problem with your instruction.
As I don't want to waste time, as long as I don't have an explanation of this odd behavior, I will drop this scheme and will try to do the job with the good old cliclick.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  18:14:01

Offline

 

#36 2019-12-17 11:51:39 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

all the frameworks exist.

use framework "Foundation"
use framework "ApplicationServices"
use framework "Quartz"
use framework "AppKit"

your basic version gives the same error as before:

Result:
error "Can’t get CGPointZero." number -1728 from CGPointZero

the code I use is a straight past job form yours:

Applescript:

use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "ApplicationServices"
use framework "Quartz"
use framework "AppKit"
property updateMouseCursorPosition : true
property buttonCount : 1 -- left mouse button number
property mouseButtonDown : true -- mouse button pressed?
property slots : {60, 80, 100, 120, 140, 160, 180, 200, 220, 240, 260, 280, 300}

set aPoint to current application's CGPointZero

tell application "VeraCrypt" to activate
tell application "System Events"
   tell application process "VeraCrypt"
       set frontmost to true
       --repeat until exists window "VeraCrypt"
       --delay 0.1 # Don't forget that this loop fails
       --end repeat
       repeat 10 times
           if exists window "VeraCrypt" then exit repeat
           delay 0.1
       end repeat
       if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
       --set w to window "VeraCrypt"
       tell window "VeraCrypt"
           set {x, y} to its position
           log (get position of groups) # May be useful to check the values in the property slots
           log (get size of groups) # May be useful to check the values in the property slots
           tell scroll bar 1
               log {its position, linefeed, its size} # May be useful to check the values in the property slots
               repeat 20 times
                   click button 4
               end repeat
           end tell # scroll bar 1
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
   -- Choose 2nd slot
   set aPoint to {x + 100, y + (item 2 of slots)} -- set the point coordinates on the screen
   mouseLeftClick of me at aPoint -- perform left click and move the cursor to new position
   -- Choose text field to keystroke the path
   tell application process "VeraCrypt"
       tell window "VeraCrypt"
           tell combo box 1
               set value of attribute "AXFocused" to true
               -- delay 0.5 # may be useful here
               set its value to "/Volumes/Data/VC/file"
           end tell # combo box 1
           click button "Mount"
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
end tell # Application System Events
--tell application "VeraCrypt" to activate

on setPoint(xPos, yPos)
   set pt to current application's CGPointMake(0, 0)
   set pt to {xPos, yPos}
   return pt
end setPoint

on mouseLeftClick at aPoint
   current application's CGPostMouseEvent(aPoint, updateMouseCursorPosition, buttonCount, mouseButtonDown)
   current application's CGPostMouseEvent(aPoint, updateMouseCursorPosition, buttonCount, not mouseButtonDown)
end mouseLeftClick

Result:
error "Can’t get CGPointZero." number -1728 from CGPointZero

Offline

 

#37 2019-12-17 11:54:29 am

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

Re: AppleScript stopped working after update to 10.13

@ChangeAgent

May you run this script ?

You may send a mail to <koenigyvanATmac.com> with a screenshot of the entire screen (cmd + shift + 3) and the the events history.

Applescript:

# for VeraCrypt 2019/12/20 09:35

use AppleScript version "2.4"
use scripting additions

tell application "VeraCrypt" to activate
set theApp to name of current application
tell application "System Events"
   tell application process "VeraCrypt"
       set frontmost to true
       --repeat until exists window "VeraCrypt"
       --delay 0.1 # Don't forget that this loop fails
       --end repeat
       repeat 10 times
           if exists window "VeraCrypt" then exit repeat
           delay 0.1
       end repeat
       if not (exists window "VeraCrypt") then error "The window VeraCrypt is not available"
       tell window "VeraCrypt"
           if name of window 1 is "VeraCrypt" then # Of course, here it's always true!
               set {wLeft, wTop} to its position #
               set {x, y} to {wLeft + 33, wTop + 46}
           else
               # useful for the test running Numbers
               set {wLeft, wTop} to position of scroll area 1
               set {x, y} to {wLeft + 33, wTop + 9}
           end if
           # Edit this instruction to change the slot to select
           set slotNum to 2 # slotNum may be in the range : 1 thru 64
           
           -- get its position # May be useful to check the values in the property slots
           -- get position of groups # May be useful to check the values in the property slots
           -- get size of groups # May be useful to check the values in the property slots
           tell scroll bar 1
               if class of UI elements contains value indicator then --> {value indicator, button, button, button, button}
                   set oldPos to item 2 of (get position of value indicator 1) --> 963
                   -- get subrole of buttons --> {"AXIncrementArrow", "AXDecrementArrow", "AXIncrementPage", "AXDecrementPage"}
                   repeat
                       click button 4 --> the "AXDecrementPage" one
                       set newPos to item 2 of (get position of value indicator 1)
                       if newPos = oldPos then exit repeat
                       set oldPos to newPos
                   end repeat
               end if
               -- (get position of value indicator 1)
               
               # Test after setting slotNum above to 13
               set lim1 to 13 # This value is OK
               # If testing with 13 gives correct result
               # Test after setting slotNum above to 28
               set lim2 to 28
               # If testing with 28 gives correct result
               # Test after setting slotNum above to 42
               set lim3 to 42
               # If testing with 42 gives correct result
               # Test after setting slotNum above to 55
               set lim4 to 55
               # If testing with 55 gives correct result
               # Test after setting slotNum above to 64
               set lim5 to 64
               if (slotNum ≤ lim1) then
                   # do nothing
                   # slotNum = 1 -> select slot 1
                   # slotNum = 2 -> select slot 2
                   # slotNum = 3 -> select slot 3
                   # slotNum = 4 -> select slot 4
                   # slotNum = 5 -> select slot 5
                   # slotNum = 6 -> select slot 6
                   # slotNum = 7 -> select slot 7
                   # slotNum = 8 -> select slot 8
                   # slotNum = 9 -> select slot 9
                   # slotNum = 10 -> select slot 10
                   # slotNum = 11 -> select slot 11
                   # slotNum = 12 -> select slot 12
               else if (slotNum ≤ lim2) then
                   click button 3 # moves a page down to display slots 8 thru 20
                   # slotNum = 14 -> supposed to select slot 14 but select slot ?
                   # slotNum = 15 -> supposed to select slot 15 but select slot ?
                   # slotNum = 16 -> supposed to select slot 16 but select slot ?
                   # slotNum = 17 -> supposed to select slot 17 but select slot ?
                   # slotNum = 18 -> supposed to select slot 18 but select slot ?
                   # slotNum = 19 -> supposed to select slot 19 but select slot ?
                   # slotNum = 20 -> supposed to select slot 20 but select slot ?
                   set slotNum to slotNum - (lim1 + 1) # DON'T EDIT THIS INSTRUCTION !!
               else if (slotNum ≤ lim3) then
                   repeat 2 times
                       click button 3 # moves a page down twice
                   end repeat
                   set slotNum to slotNum - (lim2 + 0) # DON'T EDIT THIS INSTRUCTION !!
               else if (slotNum ≤ lim4) then
                   repeat 3 times
                       click button 3 # moves a page down 3 times
                   end repeat
                   set slotNum to slotNum - (lim3 + 0) # DON'T EDIT THIS INSTRUCTION !!
               else if (slotNum ≤ lim5) then
                   repeat 4 times
                       click button 3 # moves a page down 4 times
                   end repeat
                   set slotNum to slotNum - (lim4 + 0) # DON'T EDIT THIS INSTRUCTION !!
               else
                   error "Can't treat more than 64 slots"
               end if
           end tell # scroll bar 1
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
   
   set h to 18 # EDITED not sure that it's the correct value, may be 19 or 20
   
   tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & (y + slotNum * h)
   
   -- Choose text field to keystroke the path
   tell application process "VeraCrypt"
       tell window "VeraCrypt"
           tell combo box 1
               set value of attribute "AXFocused" to true
               -- delay 0.5 # may be useful here
               set its value to "/Volumes/Data/VC/file"
           end tell # combo box 1
           click button "Mount"
       end tell # window "VeraCrypt"
   end tell # process Veracrypt
end tell # Application System Events
--tell application "VeraCrypt" to activate

The screenshot and the events history would be useful to find what must be changed if the script doesn't select correctly the wanted slot.

Cliclick is available for free from : https://www.bluem.net/en/projects/cliclick/

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  18:52:39

Edited. Now it's supposed to work well with slotNum in the range 1 thru 13
Edited again after numerous tests with the Numbers version.

Last edited by Yvan Koenig (2019-12-20 02:36:46 am)

Offline

 

#38 2019-12-17 12:23:15 pm

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

here is the history:

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:0,0"
        --> ""
end tell

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:0,0"
        --> ""
end tell

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:0,0"
        --> ""
end tell

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/local/bin/cliclick c:0,0"
        --> ""
end tell

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/bin/cliclick c:0,0"
        --> error "sh: /usr/bin/cliclick: No such file or directory" number 127
Result:
error "sh: /usr/bin/cliclick: No such file or directory" number 127

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> false
Result:
error "The window VeraCrypt is not available" number -2700 from «script» to item

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/bin/cliclick c:0,0"
        --> error "sh: /usr/bin/cliclick: No such file or directory" number 127
Result:
error "sh: /usr/bin/cliclick: No such file or directory" number 127

tell application "VeraCrypt"
    activate
end tell
tell application "System Events"
    set frontmost of application process "VeraCrypt" to true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    exists window "VeraCrypt" of application process "VeraCrypt"
        --> true
    get position of window "VeraCrypt" of application process "VeraCrypt"
        --> {402, 183}
    (*402, 183*)
    get position of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
    (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
    get size of every group of window "VeraCrypt" of application process "VeraCrypt"
        --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
    (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
    (*position of scroll bar 1 of window VeraCrypt of application process VeraCrypt,
, size of scroll bar 1 of window VeraCrypt of application process VeraCrypt*)
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
    click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
        --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
    do shell script "/usr/bin/cliclick c:0,0"
        --> error "sh: /usr/bin/cliclick: No such file or directory" number 127
Result:
error "sh: /usr/bin/cliclick: No such file or directory" number 127



It selects the Apple logo top Left side of the bar and stops there. 

I had to put cliclick here:  /usr/local/bin/cliclick
I had no permission to the folder you suggested.  I adjusted the script.

Not sure if you need a screen shot at this point.

Offline

 

#39 2019-12-17 01:49:23 pm

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

Re: AppleScript stopped working after update to 10.13

Oops, I'm an ass.
I made typos now corrected in message #48.
I also use your location for the CLI.
If the slot 2 is not selected by the edited version, the report and the screenshot would be useful.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mardi 17 décembre 2019  20:48:54

Taking care of the values reported in your message, I re-edited message #48 at 21:08:07

Edited again after testing the set of instructions upon a Numbers window. 21:18:29 in France

Last edited by Yvan Koenig (2019-12-17 02:18:40 pm)

Offline

 

#40 2019-12-18 12:54:20 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Morning Yvan, not sure if you are an as, I think more of an hero.

anyway works mostly.  here is the report:

Applescript:

[quote]tell application "VeraCrypt"
   activate
end tell
tell application "System Events"
   set frontmost of application process "VeraCrypt" to true
   exists window "VeraCrypt" of application process "VeraCrypt"
       --> true
   exists window "VeraCrypt" of application process "VeraCrypt"
       --> true
   get position of window "VeraCrypt" of application process "VeraCrypt"
       --> {402, 183}
   get position of window "VeraCrypt" of application process "VeraCrypt"
       --> {402, 183}
   (*402, 183*)
   get position of every group of window "VeraCrypt" of application process "VeraCrypt"
       --> {{402, 205}, {402, 502}, {418, 552}, {418, 665}, {569, 665}, {720, 665}, {871, 665}}
   (*402, 205, 402, 502, 418, 552, 418, 665, 569, 665, 720, 665, 871, 665*)
   get size of every group of window "VeraCrypt" of application process "VeraCrypt"
       --> {{636, 297}, {636, 237}, {604, 103}, {151, 58}, {151, 58}, {151, 58}, {151, 58}}
   (*636, 297, 636, 237, 604, 103, 151, 58, 151, 58, 151, 58, 151, 58*)
   get position of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> {1005, 223}
   get size of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> {15, 261}
   (*1005, 223,
, 15, 261*)

   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
   click button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
       --> button 4 of scroll bar 1 of window "VeraCrypt" of application process "VeraCrypt"
end tell
tell current application
   do shell script "/usr/local/bin/cliclick c:435,247"
       --> ""
end tell
[/quote]

what happens is it takes slot 1.

Applescript:

set slots to {h, 2 * h, 3 * h, 4 * h, 5 * h, 6 * h, 7 * h, 8 * h, 9 * h, 10 * h, 11 * h, 12 * h, 13 * h, 14 * h, 15 * h, 16 * h, 17 * h, 18 * h, 19 * h, 20 * h}

if I take away h, 2 * it takes slot 2. 

however it now does not put in the location and hits the 'Mount' button.  I tried to fix this as it worked in an earlier script, but do not get it to work.

Offline

 

#41 2019-12-18 03:10:29 am

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

Re: AppleScript stopped working after update to 10.13

Good news.

I edited message #37 accordingly.
I changed the offset added to wTop.
I disabled the return which urged the script to exit after trying to select the slot.
If everything works, it would be a goo idea to test again after setting slotNum to 19.
Maybe it would not select slot19 but slot18.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 18 décembre 2019  10:10:04

Offline

 

#42 2019-12-18 04:48:31 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Hi Yvan,

succes!

Thanks a milion! 

Applescript:

set slotNum to 2 # ADDED to select slot 2, may be 1 thru 20

Changing the number here allows me to use different slots so that is brilliant as we sometimes have 3 or 4 VC disks loaded.

Brilliant and thanks again for helping me out here.  I am trying to understand all you do/did and will take some quiet time in the weekend to see if I can follow what you did.  Learning all the time.  And I must say this was definitely beyond my skill level.

For now I am extremely happy and grateful.

@ KniazidisR
I see your posts disappeared, pity as I would have liked to reread for my education, but also thanks for chipping in it was helpful too.

Offline

 

#43 2019-12-18 05:17:56 am

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

Re: AppleScript stopped working after update to 10.13

Have you tried to run it after setting slotNum to 19?
It would be useful to check that the value 18 given to h is the correct one.

When I will be sure of the required value, I will edit message #37 with a code which click button 4 only the needed number of times.

Just for info, below is the script which I used to test the scheme with Numbers.

Applescript:

(*
test with Numbers
*)

use AppleScript version "2.4"
use scripting additions

tell application "Numbers" to activate
tell application "System Events"
   tell application process "Numbers"
       set frontmost to true
       tell window 1
           set {wLeft, wTop} to its position
           -- get class of UI elements --> {scroll area, button, scroll area, button, button, scroll area, button, button, radio group, UI element, button, button, static text, scroll area, button, button, button, menu button, toolbar, tab, static text, static text}
           -- get position of scroll areas --> {{1065, 142}, {1112, 114}, {1065, 1081}, {1897, 323}}
           -- get class of UI elements of scroll area 1 --> {scroll bar, scroll bar}
           tell scroll bar 2 of scroll area 1
               if class of UI elements contains value indicator then --> {value indicator, button, button, button, button}
                   set oldPos to item 2 of (get position of value indicator 1) --> 963
                   -- get subrole of buttons --> {"AXIncrementArrow", "AXDecrementArrow", "AXIncrementPage", "AXDecrementPage"}
                   repeat
                       click button 4 --> the "AXDecrementPage" one
                       set newPos to item 2 of (get position of value indicator 1)
                       if newPos = oldPos then exit repeat
                       set oldPos to newPos
                   end repeat
               end if
           end tell # scroll bar 1
       end tell # window 1
   end tell # process Numbers
   --set {x, y} to {wLeft + 33, wTop + 46} # used for "VeraCrypt"
   set {x, y} to {wLeft + 190, wTop + 176}
   set h to 20 # was 18 for "VeraCrypt"
   set slotNum to 15 # may be 1 thru 20
   tell me to do shell script "/usr/local/bin/cliclick c:" & x & "," & (y + slotNum * h)
end tell # Application System Events
--tell application "Numbers" to activate

Here I disabled the instructions which I used to get useful infos.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 18 décembre 2019  12:12:51

Edited to take care of table small enough so that there is no value indicator in the scroll bar.

Last edited by Yvan Koenig (2019-12-18 07:59:45 am)

Offline

 

#44 2019-12-18 06:38:16 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

It runs with 17-18-19-20-21 that is all the testing I did.  it does not run with 16.

The numbers script does not run for me, but not important I think.

Offline

 

#45 2019-12-18 07:55:51 am

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

Re: AppleScript stopped working after update to 10.13

ChangeAgent wrote:

It runs with 17-18-19-20-21 that is all the testing I did.  it does not run with 16.


Which value were you changing, slotNum or h ?
At first thought, I guess that you changed h but I am not sure.

I borrowed h = 18 from your screenshot so, it's not guaranteed to be the good value.
I wish to know what you get with : slotNum = 19   and   h = 18.
Maybe it select Slot18 or Slot19 or Slot20.

The numbers script does not run for me, but not important I think.



OK, I tested with a large table so there was a value indicator in the scroll bar.
I will edit my original message to get rid of that.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 18 décembre 2019  14:55:37

Offline

 

#46 2019-12-18 08:08:58 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Applescript:

set h to 18 # EDITED not sure that it's the correct value, may be 19 or 20
set slotNum to 19 -- change as needed # ADDED to select slot 2, may be 1 thru 20

--this does not work. it takes no further than slot 12 and 13. these are the ones (1-13) that are visable in the window when VC opens.

set h to 20 # EDITED not sure that it's the correct value, may be 19 or 20
set slotNum to 12 -- change as needed # ADDED to select slot 2, may be 1 thru 20

-- this works too but again not more than 13.

set h to 21 # EDITED not sure that it's the correct value, may be 19 or 20
set slotNum to 12 -- change as needed # ADDED to select slot 2, may be 1 thru 20

-- with this it selects slot 13. if I do 13 instead of 12 it does not work.

Offline

 

#47 2019-12-18 09:49:01 am

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

Re: AppleScript stopped working after update to 10.13

OK.
I added some instructions in message #37.
Now, if I understand well it's supposed to work quite well with slotNum in the range 1 thru 20.
I'm not sure that setting slotNum to 15 would really select slot15.
It may be ruled by editing the instruction : set slotNum to slotNum - 9 # MAYBE must be slotNum -8 or -10
If it selects slot14  try with : set slotNum to slotNum - 8
If it selects slot16  try with : set slotNum to slotNum - 10

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 18 décembre 2019  16:47:40

Offline

 

#48 2019-12-19 01:34:51 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

Morning Yvan,

all in all it works like I would like it to work.

I ran some experiments this AM and up to

Applescript:

set slotNum to 8

it ran as expected.

9 did not do anything.  10 gives 9.  11 gives 14.  12 gives 15.  after that it changes more and some numbers do not work.  but with a bit of trial and error you can fined the number that selects the slot.

However with it working up to slot 8 I am more than happy with it.

Offline

 

#49 2019-12-19 03:37:44 am

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

Re: AppleScript stopped working after update to 10.13

Thank you.

I edited again message #37.
Now it's supposed to work well with slotNum in the range 1 thru 13.
For greater values, make tests.

As  I am really curious, I wish to get a screenshot of the window when the script is triggered with the variable slotNum set to 18.

Applescript:

set {x, y} to {wLeft + 33, wTop + 46} # MOVED
set slotNum to 18 # MOVED. as is select slot ??, allowed range : 1 thru 20

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 19 décembre 2019  10:37:37

Offline

 

#50 2019-12-19 05:59:25 am

ChangeAgent
Member
From:: Scotland
Registered: 2008-03-07
Posts: 345

Re: AppleScript stopped working after update to 10.13

works a dream

pic here https://ibb.co/JdgQhxw

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)