Jump to content

Another question


Recommended Posts

Hi. I'm wondering if there is a way to count the number of letters (signs?) in the clipboard.

To get:

While [number of signs in clipboard] >10

[some lines]


[if less than 10 symbols, it should go here]

Should be easy, but I dont know how. Please help...

Link to comment
Share on other sites


that's not I want

I want just it counts the number of characters no matter if number, space or letter. I don't want to use array, I know that one could count but I just dont want to use that function. If the clipboard has less than 10 characters, it should go further.

Link to comment
Share on other sites

Like this:

; Set some variables
Global $Numbers, $Symbols, $Characters
; We set $Clip to what is in the clipboard
$Clip = ClipGet()
; Output what is in the clipboard
ConsoleWrite("Clipboard: " & $Clip & @CRLF)
; The length of the data
$Len = StringLen($Clip)
; We split up the string
$ClipSplit = StringSplit($Clip, "")
; Lets count the number of characters
For $i = 1 To $ClipSplit[0]
    If StringRegExp($ClipSplit[$i], "\d") Then $Numbers += 1
    If StringRegExp($ClipSplit[$i], "\D") Then $Characters += 1
; Output final values
ConsoleWrite("Numbers: " & $Numbers & @CRLF)
ConsoleWrite("Characters: " & $Characters & @CRLF)
ConsoleWrite("Length: " & $Len & @CRLF)

First time I have ever used StringRegExp() :D

Now counts the numbers, letters and string length.

Edited by JamesB
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...