How to check whether there are cyrillic symbols, typed on a field

Get help with using AutoHotkey and its commands and hotkeys
lodiko
Posts: 3
Joined: 12 Aug 2018, 10:24

How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 10:35

The situation is this one:

I have a web page with some amount of fields. In some fields the typed text is English, in other - Cyrillic+English.
I need to jump with Tab button between all the fields and to check whether there are cyriliic symbols, typed on the field. If there are such symbols - to copy the field content to the cipboard and to jump to the next field.

Is this possible to be done with AHK?
garry
Posts: 1335
Joined: 22 Dec 2013, 12:50

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 12:07

just an idea
EDIT1 = added stringlen
EDIT2 = skip if only latin characters / save to notepad not latin characters / add numbers from edit
EDIT3 = check for cyrillic

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus




;- old part check with stringlen

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by garry on 13 Aug 2018, 04:18, edited 3 times in total.
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 13:48

Hi lodiko,

You can use regexmatch.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



- btw:
- Cyrillic (range: 0400 — 04FF)
- 0400/1024 04FF/1279 255 characters (1279-1024)

Code: [Select all] [Download] GeSHi © Codebox Plus

MsgBox % Chr(1024) ; Cyrillic Capital Letter Ie with Grave (https://unicode-table.com/fr/0400/)
MsgBox % Chr(1279) ; Cyrillic Small Letter Ha with Stroke (https://unicode-table.com/fr/04FF/)


Hope this helps.
lodiko
Posts: 3
Joined: 12 Aug 2018, 10:24

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 14:43

A_AhkUser,

This may help me. But how to proceed when every field in the web page has a different name?

Is it possible to do this thing - when the script detects Cyrillic symbol in the field to:
1. cut field's entire content into the clipboard
2. enter '1' in the beginning of the field
3. paste the clipboard right after the '1'

and after this the script jumps to the next field and makes the same check.
When the field is filled only with English symbols, to jump directly to the next field.
garry
Posts: 1335
Joined: 22 Dec 2013, 12:50

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 15:16

Is it possible to do this thing - when the script detects Cyrillic symbol in the field to:
1. cut field's entire content into the clipboard
2. enter '1' in the beginning of the field
3. paste the clipboard right after the '1'

and after this the script jumps to the next field and makes the same check.
When the field is filled only with English symbols, to jump directly to the next field.


I tried this / modified script above
------------------------------------------------
@A_AhkUser , thank you for cyrillic codes chr(1024)-- chr(1279)
( sometimes russian also only contents latin letters , example : Actaha, CCCP, Capaebo, Beha .... )
Last edited by garry on 12 Aug 2018, 16:53, edited 2 times in total.
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 15:39

lodiko wrote:This may help me. But how to proceed when every field in the web page has a different name?


What do you mean by 'name'?
. input elements' 'value' attribute values (i.e. the visible content of the fields)?
. input elements' 'name' attribute values?
. tag names?


The first two should not be an issue as demonstrated in the example above and, a fortiori in the following example. Based on your description I assume that the clipboard is at stake here only to manipulate a temporary value. Correct me if I'm wrong. If so,I suggest instead to simply update the value of the input element:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



If you want to operate on a specific subset of input element with a specific name attribute, use the getELementsByName method.
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 16:11

@ garry
garry wrote:thank you for cyrillic codes chr(1024)-- chr(1279)

Your welcome.
Btw, see also: Cyrillic — Unicode® character table

garry wrote:( sometimes russian also only contents latin letters , example : Actana, CCCP, Capaebo, Beha .... )

Yes but it is only true from a visual standpoint (furthermore, even that statement might be wrong when switching from a font to another one).

Code: [Select all] [Download] GeSHi © Codebox Plus

; CCCP = Союз Советских Социалистических Республик
; Chr(67) ; Latin Capital Letter C - https://unicode-table.com/en/0043/
; Chr(1057) ; Cyrillic Capital Letter Es - https://unicode-table.com/en/0421/
; btw Сараево != *Сараеbо; Астана

string1 := Chr(67) . "оюз " . Chr(67) . "оветских " . Chr(67) . "оциалистических Республик"
string2 := Chr(1057) . "оюз " . Chr(1057) . "оветских " . Chr(1057) . "оциалистических Республик"
MsgBox % string1 . "`r`n" . string2 " `r`n" ((string1 = string2) ? "are equal" : "are NOT equal, despite appearances!;)")

Cheers
garry
Posts: 1335
Joined: 22 Dec 2013, 12:50

Re: How to check whether there are cyrillic symbols, typed on a field

12 Aug 2018, 17:00

; btw Сараево != *Сараеbо; Астана

yes , sorry , I was wrong
thank you for the example
lodiko
Posts: 3
Joined: 12 Aug 2018, 10:24

Re: How to check whether there are cyrillic symbols, typed on a field

13 Aug 2018, 08:01

Excuse me for the stupid questions, but as you see, I'm completely new here.
@A_AhkUser, yes I thing in my case I need to check fields with a different tag names. But I don't know how to do this.
That's how the webform looks:
https://imgur.com/a/cGAOezr

Image
A_AhkUser
Posts: 840
Joined: 06 Mar 2017, 16:18
Location: France

Re: How to check whether there are cyrillic symbols, typed on a field

13 Aug 2018, 12:17

lodiko wrote:yes I thing in my case I need to check fields with a different tag names. [...] That's how the webform looks[...]


Yea you're right they looks like textarea elements; I would have though of that.. This does not fundamentally change the script - the same example using textarea elements instead:


Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus



[EDIT]
see also: Basic Webpage Controls with JavaScript / COM - Tutorial

Return to “Ask For Help”

Who is online

Users browsing this forum: Google [Bot] and 33 guests