Sign in to follow this  
Followers 0
232showtime

detect how many characters I paste to clipboard

6 posts in this topic

is there a function or command in autoit that can detect how many characters I paste to clipboard?

because I have 31 characters to getdata in clipboard and sometimes I have 30 characters to getdata in clipboard.

Func Copy()
    If WinActivate("[CLASS:XLMAIN]") Then ;copy from excel
        Send("^c")
        Sleep("100")
        Send("{DOWN}")
        If WinActivate("[CLASS:CabinetWClass]") Then
            ControlClick("[CLASS:CabinetWClass]", "", "[CLASS:DirectUIHWND;INSTANCE:1]")
            Sleep("100")
            If ControlSend("[CLASS:CabinetWClass]", "", "[CLASS:DirectUIHWND;INSTANCE:1]", "^v") Then;paste to active cabinetclass
                Local $iResult = _ClipBoard_GetData($CF_TEXT)
                $fResult = StringLeft($iResult, 31)
                ControlSetText("[CLASS:TFrmMain]", "", "[CLASS:TEdit; INSTANCE:1]", $fResult)
            EndIf
        EndIf
    EndIf
EndFunc   ;==>Copy

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites



Bit less (I mean more, much more less) elegant solution can be that you simply write the clipboard to a MsgBox, read and check the string there and then kill the MsgBox :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

 

Something like this :

StringLen (ClipGet() )

yes but, excluding the whitespaces, without whitespace..

Edited by 232showtime

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

StringStripWS

Feed the result into StringLen

Edited by TheSaint
1 person likes this

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

thanks..

#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

Local $sString = StringStripWS("1 2 3 4 5.", 8)
$iLength = StringLen($sString)
MsgBox($MB_SYSTEMMODAL, "", "The length of this string is " & $iLength & " characters.")
Edited by 232showtime
1 person likes this

ill get to that... i still need to learn and understand a lot of codes graduated.gif

Correct answer, learn to walk before you take on that marathon.

Share this post


Link to post
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
Sign in to follow this  
Followers 0