AppleScript stopped working after update to 10.13

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

runs without errors, but selects nothing in the window.

Log window shows:

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
	get class of every UI element of window "VeraCrypt" of process "VeraCrypt"
		--> {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}
	get class of every UI element of scroll bar 1 of window "VeraCrypt" of process "VeraCrypt"
		--> {value indicator, button, button, button, button}
	(*value indicator, button, button, button, button*)
end tell

Now we grab the names of the buttons.
Tell me which is the one to click.

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
			end tell #window
		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 12:09:35

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

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

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.

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

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.

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

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

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

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.

your first script returns:

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

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"

@ 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

no

yes

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:]


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

get the following error Yvan:

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

I tested the bare:

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

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:

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

@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.

# 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.

here is the history:

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.

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

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

anyway works mostly. here is the report:


[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.

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.

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

Hi Yvan,

succes!

Thanks a milion!

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.