Jump to content

PASTE DATA IN INPUT BOX or GETTING DATA FROM CLIPBOARD AND CONDITIONING VALUE


 Share

Recommended Posts

Hi , 

Need help on AUTO IT :

no 1 : how to send a Value to Input box from the Clipboard...

example : 

WinActivate("data.xls") ;Select excel

Sleep(800)

Send("^c") ; copy data from excel sheet

$V = InputBox("DATA","Value") ; OPEN input box

Send("^V") ; paste the value of Excel sheet

Send("{ENTER}") ; gives OK..

MsgBox(0,"",$V) ; display assigned variable value.

 

No 2 : Defining Values to Variables and conditioning with the Copied Clipboard Value....

Global $V ,$BB , $A
Global $V1 = "AP"
Global $V2 = "RTN"

WinActivate("data.xls");Select excel
Sleep(800)
Send("^c");copied for the excel sheet.
Sleep(800)

Local $V = ClipGet() ; assigning copied value to variable $V
    if $V = "$V1" Then ;  Here i need help , condition is IF the $V variable = AP (nothing but the copied Value) if its true then 
       MsgBox (0,"AP","AP")
       elseif $V = "$V2" then
        MsgBox (0,"RTN","RTN"); Here same but IF condition is with RTN value.
       EndIf

 its not working for me , Please help me out.....Million of Thanks in advance.....

Regards

Ranjith 

Link to comment
Share on other sites

No , its not working even the " was  removed...

 

Global $V ,$BB , $A
Global $V1 = "AP"
Global $V2 = "RTN"

WinActivate("data.xls");Select excel
Sleep(800)
Send("^c");copied for the excel sheet.
Sleep(800)

Local $V = ClipGet() ; assigning copied value to variable $V
    if $V = $V1 Then ;  Here i need help , condition is IF the $V variable = AP (nothing but the copied Value) if its true then
       MsgBox (0,"AP","AP")
       elseif $V = $V2 then
        MsgBox (0,"RTN","RTN"); Here same but IF condition is with RTN value.
       EndIf

 

i can get the value of V if i add Msgbox of $V , but unable to do condition , with the Variables.. :(

Link to comment
Share on other sites

You know what...I suspect there may be some clipboard magic going on there.  When you copy a "cell" in Excel I don't think you are truly copying the text of the cell, but some kind of object/reference (just a guess).  

Ok, I think I found your issue.  It looks like a good ol @CRLF is appended to the cell value in the clipboard.  I'd still recommend using the UDF I mention below though.

;.....
Global $V1 = "AP" & @CRLF
;.....

You should look into the Excel UDF.  I'm sure there are functions there to read the cell values you need and it is most certainly a more reliable automation method versus sequencing keystrokes.

edit: link to example
https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_RangeRead.htm

 

Edited by spudw2k
Link to comment
Share on other sites

12 hours ago, spudw2k said:

You know what...I suspect there may be some clipboard magic going on there.  When you copy a "cell" in Excel I don't think you are truly copying the text of the cell, but some kind of object/reference (just a guess).  

Ok, I think I found your issue.  It looks like a good ol @CRLF is appended to the cell value in the clipboard.  I'd still recommend using the UDF I mention below though.

;.....
Global $V1 = "AP" & @CRLF
;.....

You should look into the Excel UDF.  I'm sure there are functions there to read the cell values you need and it is most certainly a more reliable automation method versus sequencing keystrokes.

edit: link to example
https://www.autoitscript.com/autoit3/docs/libfunctions/_Excel_RangeRead.htm

 

man , You are Really Great, it works like charm...... 

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