Re: How to select Text Field for Barcode Reader input
Re: How to select Text Field for Barcode Reader input
- Subject: Re: How to select Text Field for Barcode Reader input
- From: Brian Christmas <email@hidden>
- Date: Thu, 17 Aug 2017 15:03:04 +1000
G’day again.
I thought I’d darnwell fixed this, but the problems reared it’s head again.
I simply cannot move the focus away from one Text Field, to the Text Field
I’m trying to enter a scanned barcode into. Everything works fine if I
physically move the cursor into the Text Field, except the code below still
does nothing, when the focus is with any other Text Entry, selected, or
inserted. As I’ve moved the Field to the top of the list, it’s become Field 1,
and is setected on a fresh boot, which is why I thought I’d fixed it.
Using vanilla applescript, I can reset the focus easily and reliably, but the
latest ASObjC does not seem to be able to ‘see’ the Text Field in question.
I’ve tried using the EXACT Applescript, and the modifications as below. The
code counts 1, 2, 3, 4, 5. When I used the name of the window, the error is….
System Events got an error: Can’t set window "Mail Manager Production Reporter"
of process "Mail Manager Production Reporter" to true.
With the current code, no error is generated. BUT, it does NOTHING! It’s as
though the Field exists, but the system ignores it.
Is there ANY way of FORCING the Text Field to activate, and become the focus.
UI Broswer is VERY limited in what it suggests as options, and none work.
Regards, and thanks
Santa
The Applescript is…
tell application "Mail Manager Production Reporter"
activate
tell application "System Events" to tell process "Mail Manager
Production Reporter"
try
set enabled of text field 1 of window 1 to true
end try
try
set focused of text field 1 of window 1 to true
end try
end tell
activate
end tell
My ASObjC code is…
on runningLoop:{}
tell me to activate
if (my ScanExit) or (my stopCycling) then
set (my stopCycling) to true
my standardCycle:{}
return
end if
tell application "Mail Manager Production Reporter"
activate
tell application "System Events" to tell process "Mail
Manager Production Reporter" to tell theWindow
try
say 1
set enabled of scanEntryField to true
say 2
end try
try
say 3
set focused of scanEntryField to true
say 4
on error errmsg
tell application "System Events" to
display dialog errmsg
end try
try
say 5
scanEntryField's currentEditor's
moveToEndOfLine:(missing value)
say 6
end try
end tell
activate
end tell
set (my barCodeEntryValue) to ""
my performSelector:"runningLoop2:" withObject:(missing value)
afterDelay:1
if (my ScanExit) or (my stopCycling) then
set (my stopCycling) to true
my standardCycle:{}
return
end if
my performSelector:"runningLoop:" withObject:(missing value)
afterDelay:1.2
end runningLoop:
on runningLoop2:{}
if (my ScanExit) or (my stopCycling) then
set (my stopCycling) to true
my standardCycle:{}
return
end if
try
my fordEvent()
set (my barCodeEntryValue) to scanEntryField's
stringValue() as text
end try
if (count of (my barCodeEntryValue)) > 17 and ((my
barCodeEntryValue) as text) contains "Z" then
scanEntryField's setPlaceholderString:(my
barCodeEntryValue)
scanEntryField's setString:(my barCodeEntryValue)
my fordEvent()
my makeTable1FirstResponder:me
end if
end runningLoop2:
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden