Jump to content

If Pasting text not 12 digit then show error


naru
 Share

Recommended Posts

  • Developers
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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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,
 

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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