10-03-2019, 12:25 AM
(This post was last modified: 10-03-2019, 01:06 PM by wisemaj.
Edit Reason: Clarification and point to better formatted pasted code.
)
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:
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.
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.