Jump to content

Detect How much letters in Clipboard


Recommended Posts

Hi.

ClipPut("Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam viverra, nisi vitae hendrerit facilisis, nisl turpis fringilla lectus, a scelerisque nibh turpis vel libero.")
MsgBox(0,"","Clipboard contains : " & StringLen(Clipget()) & " characters")
The only issue w/ this code is that it will count punctuation, spaces, any special charters. The op only wanted to count letters, so all other formatting must be removed

This code:

$String = ClipGet()
$String = StringRegExpReplace($string, "[^a-z|A-Z]","", 0)
$string = StringReplace($string, "|", "", 0)
$LengthofLetters=StringLen($string)
ConsoleWrite("There are: "&$LengthofLetters&" letters in the clipboard"&@crlf&"And they are: "&$string&@CRLF)

Should get you a bit closer to what the op wants.

Edited by zackrspv

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

Or maybe...

ClipPut("Something simple like StringStripWS")
MsgBox(0, "", "Clipboard contains : " & StringLen(StringStripWS(ClipGet(), 8)) & " characters")
And that's a good method to remove any type of spacing, etc; but it still leaves special characters, numbers, puncuation, etc. Only letters need be returned, hence my use of regular expressions. Or didn't i understand properly? LOL Entirely possible, i'm taking Darvocet for a broken ankle here hahaha

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

from OP

...now clipboard = ajd3kk

if clipboard = 6 letters then...

Your code returns 5 letters... you might want to include numbers as letters like the OP did.

It looked like a password type of thing. I'm not sure what all the OP wants to count, but some special characters are allowed/encouraged in passwords.

You are correct, StringStripWS will not remove the items that you mentioned.

I'm too regular of a guy to understand regular expressions :-)

Edit: It could be interpreted that the MsgBox would not show in the OP's pseudo code

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I'm too regular of a guy to understand regular expressions :-)

hahahahahaha nice lol

-_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë.

Link to comment
Share on other sites

The only issue w/ this code is that it will count punctuation, spaces, any special charters. The op only wanted to count letters, so all other formatting must be removed

Oh, right.. I don't know why I had 'characters' in mind.. My msgbox even states it's counting characters :)

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
 Share

  • Recently Browsing   0 members

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