naru Posted August 13, 2017 Share Posted August 13, 2017 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 ? Link to comment Share on other sites More sharing options...
Developers Jos Posted August 13, 2017 Developers Share Posted August 13, 2017 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 More sharing options...
Trong Posted August 13, 2017 Share Posted August 13, 2017 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 More sharing options...
naru Posted August 14, 2017 Author Share Posted August 14, 2017 (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 August 14, 2017 by Jos Link to comment Share on other sites More sharing options...
junkew Posted August 14, 2017 Share Posted August 14, 2017 (edited) https://www.autoitscript.com/autoit3/docs/functions/ClipGet.htmhttps://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 August 14, 2017 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now