Nareshm

If Pasting text not 12 digit then show error

5 posts in this topic

I am Copy some text from excel and past into other software.
I need script for : If copied text 12 digit then continue if not then stop my script and show error msgbox
its possible ?

Share this post


Link to post
Share on other sites



56 minutes ago, Nareshm said:

I need script for

So .. what do you have?  
Seriously, you only seem capable to post "write me a script" threads in our forums, so what about you show some initiative yourself for a change?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

 

3 hours ago, Nareshm said:

its possible ?

possible !  

Use :

- IsNumber () to check: variable is number or not
- StringLen() to check: length of the string

=>>1 line for u: If Not (IsNumber($copiedNum) And StringLen($copiedNum) = 12) Then MsgBox()

Have you tried out and read the help file before asking someone else to write a script for you?
 

 


Regards,
 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

17 hours ago, VIP said:

 

possible !  

Use :

- IsNumber () to check: variable is number or not
- StringLen() to check: length of the string

=>>1 line for u: If Not (IsNumber($copiedNum) And StringLen($copiedNum) = 12) Then MsgBox()

Have you tried out and read the help file before asking someone else to write a script for you?
 

 

@VIP
How to insert it to my script ?
My script is :

WinWait ("BillReceipt", "", 70)
ControlClick ("BillReceipt", "", "[NAME:toolStrip1]")
ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]")
Winwait ("Save As")
WinActivate ("Save As")
Send ("{TAB 5} {Backspace} ^v {Enter}") ; Pasting script


;then If pasted text 12 digit then Save if not then Don't save and show error msgbox

Edited by Jos

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

https://www.autoitscript.com/autoit3/docs/functions/ClipGet.htm
https://www.autoitscript.com/autoit3/docs/functions/StringLen.htm

high level you get this

WinWait ("BillReceipt", "", 70)
ControlClick ("BillReceipt", "", "[NAME:toolStrip1]")
ControlClick ("Print", "", "[CLASS:Button; INSTANCE:13]")
Winwait ("Save As")
WinActivate ("Save As")
Send ("{TAB 5} {Backspace}"
// NEW part
; Retrieve the data stored in the clipboard.
    Local $sData = ClipGet()

if stringlen($sData) = 12 then
send ("^v {Enter}") ; Pasting script
;then If pasted text 12 digit then Save if not then Don't save and show error msgbox
else
//msgbox?
endif

you also could do send($sData) instead of pasting it with ctrl v

Edited by junkew

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