I cannot seem to get SendKeys to paste into a vbs input box. It copies just fine and can paste into notepad, word and other programs, just not the place I need it to. I can use the keyboard itself and I can paste all day long in the box I am trying to get data entered, but this is supposed to be an automated task. Currently working on trying to set this up to open as html to input and display data but I need to learn alittle more about that first. Can sendkeys paste into vbs? Because it is looking like no. Any advise to get this script working is appreciated.
on error resume nextdim dbconnection, sqlrs, itemno,sqlrs2, ITEM, objData
Const CONNECT_STRING = "provider=SQLOLEDB.1;Presist Security info=True;User ID=sa;Initial Catalog=DEMOGOLF;Data Source=SERVER;password=PASSWORD"
Set WshShell = WScript.CreateObject("WScript.Shell")
set objFSO = CreateObject("Scripting.FileSystemObject")
Set dbconnection = createobject("ADODB.connection")
Set sqlrs = createobject("ADODB.Recordset")
Set sqlrs2 = createobject("ADODB.Recordset")
dbconnection.open CONNECT_STRING
WshShell.AppActivate "Touchscreen Ticket Entry"
WshShell.SendKeys ("%a")
WshShell.SendKeys ("^C")
wsh.sleep 1000
Itemno = InputBox("Enter Item Number:", "Item Number")
WshShell.AppActivate "Item Number"
wsh.sleep 2000
WshShell.SendKeys ("^V")
'-------------------------------------------------------------------------
'-----------Different ways I found and tried-------------------
'-------------------------------------------------------------------------
SendKeys.Send("^{v}")
'WshShell.SendKeys ("+{Ins}")
'WshShell.SendKeys ("^{vk56}")
'SendKeys.KeyDown(Keys.ControlKey)
'SendKeys.PressKey(Keys.V)
'SendKeys.KeyUp(Keys.ControlKey)
'Itemno = WshShell.SendKeys ("^V")
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
'-------------------------------------------------------------------------
msgbox ("Item Description "&sqlrs2("DESCR")& vbCrLf & "Current Average Cost: $"& ROUND(sqlrs("AVG_COST"),4)& vbCrLf & "Current Margin: "&ROUND(sqlrs2("MARGIN"),4)&"%"&""),0,"Item Number: "&sqlrs("ITEM_NO")
'WshShell.SendKeys "{ENTER}"
sqlrs.open "SELECT * FROM [IM_INV] where ITEM_NO = '"&Itemno&"' AND LOC_ID='MAIN'", CONNECT_STRING
sqlrs2.open "SELECT * FROM [VI_USR_MARGIN] where ITEM_NO = '"&Itemno&"'", CONNECT_STRING
If sqlrs.EOF Then
Wscript.Echo "Invalid Item. Please Re-Enter."
Else
msgbox ("Item Description "&sqlrs2("DESCR")& vbCrLf & "Current Average Cost: $"& ROUND(sqlrs("AVG_COST"),4)& vbCrLf & "Current Margin: "&ROUND(sqlrs2("MARGIN"),4)&"%"&""),0,"Item Number: "&sqlrs("ITEM_NO")
END IF
sqlrs.close
dbconnection.close