Jump to content

detect how many characters I paste to clipboard


Go to solution Solved by TheSaint,

Recommended Posts

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.

Link to comment
Share on other sites

 

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.

Link to comment
Share on other sites

  • Solution

StringStripWS

Feed the result into StringLen

Edited by TheSaint

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

Link to comment
Share on other sites

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

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.

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...