Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple (I hope) Cut and Paste from Text File to Excel.
#1
Greetings.  I'm having great difficulty doing something I think should be simple, so I must be missing something.

I'm using a program that produces text reports inside the app.  I am able to manually Ctl A / Ctl C the report and then Ctl V into a cell (H1) in Excel.  The report loads with each line in a new row, which is what I need to process the information.  I've tried many, many things but can't get it to work in QM.  I am trying to accomplish this without using mouse clicks in Excel since I won't be able to rely on the xy coordinates for the target cell remaining constant. Here is my code snippet, with comments:
Quote: opt slowkeys; spe 1000ExcelSheet esWorkTab.Init("WorkTab")
int w=wait(1 WV win("TestApp" "HwndWrapper[TestApp.exe;*"))
str views

 ;; Copy the Report
lef 658 166 w 1
'Ca
views.getsel

 ;; Paste clipboard to cell H1 of WorkTab. (Have tried the following):
;; esWorkTab.SetCell(views "H1") ;; Puts entire report in H1 (well, not even the entire report)
;; esWorkTab.SetCell(views "H") ;; Produces: Error (RT) in <open ":1546: /314">Test Cut Paste:  0x80020009, Exception occurred. 0x3EC,. <help #IDP_ERR>  (although Help shows this as a valid option??)
;; esWorkTab.SetCell(views 8) ;; Produces: Error (RT) in <open ":1546: /471">Test Cut Paste:  invalid index, must be >=1.
;; esWorkTab.SetCell(views "H:H") ;; Produces: Error (RT) in <open ":1546: /314">Test Cut Paste:  0x80020009, Exception occurred. 0x3EC,. <help #IDP_ERR>

 ;; Have also tried various combinations of getclip, setclip, getsel and setsel, but could not get output to H1.

 ;; Have also tried A{hvt}, but that seems to require a mouse click in cell H1, which I don't really want to do, as I can't rely on its xy location over time.   esWorkTab.Activate and esWorkTab.SetCell("H1") wasn't enough to allow the A{hvt} to work.


Can you please let me know how to accomplish this?

EDIT:  1. Please see better pasted code below.
          2. Above, I said "The report loads with each line in a new row …".  Actually, it loads each Paragraph in a new row, or perhaps, paragraphs and/or sentences separated by CR/LF?  That's in manual operation, which I'd like to duplicate in QM without requiring xy clicks in Excel.


Messages In This Thread
Simple (I hope) Cut and Paste from Text File to Excel. - by wisemaj - 10-03-2019, 12:25 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)