Parsing #s within Excel and then pasting into 3rd party application

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
bballjoe12
Posts: 114
Joined: 20 Aug 2017, 09:11

Parsing #s within Excel and then pasting into 3rd party application

30 Oct 2018, 11:26

Is there a way I can copy about 5 cells in a row (the numbers will be changing and not be static as shown in the picture) and then paste the numbers in another applications fields (not using COM)?

Below is a screenshot of what the data looks like.
https://imgur.com/a/rIED3iV

When I copied the data to the clipboard on my computer and pasted it into Notepad or into this field, the data shows as below:

15672 2891 2891 4992 6024 15672 11040

I am needing the data parsed in some way to be formatted as such (the other application has fields that are similar to Excel...to go to another box within the 3rd party application, I can hit tab or enter to move fields, just like Excel)

Row 1=15672
Row 2=2891
Row 3=2891
Row 4=**Blank**
Row 5=** Blank**
Row 6 = 4992
Row 7=6024
Row 8=15672
Row 9=***Blank***
Row 10= 11040

I don't mind using, Send {Down} to get to the next row (actually preferred. I just don't know to parse the #s as the numbers will change whenever I have to copy the cells)

Hopefully I explained it well!
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Parsing #s within Excel and then pasting into 3rd party application

30 Oct 2018, 12:48

have only one instance of Excel running and try this:
Hotkey is F1
xl := ComObjActive("Excel.Application")
return

F1::
res := ""
for cell in xl.Range("C2:L2").cells
{
res .= "Row " A_Index " = " cell.text "`r`n"
if (a_index = 4)
res .= "`r`n"
}
MsgBox % res
return
Last edited by AlphaBravo on 30 Oct 2018, 13:12, edited 1 time in total.
bballjoe12
Posts: 114
Joined: 20 Aug 2017, 09:11

Re: Parsing #s within Excel and then pasting into 3rd party application

30 Oct 2018, 13:04

That's awesome man! Is there a way to put an extra blank line between row 4 and row 5 and also have the #s not have any decimal points after?
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Parsing #s within Excel and then pasting into 3rd party application

30 Oct 2018, 13:13

bballjoe12 wrote:
30 Oct 2018, 13:04
That's awesome man! Is there a way to put an extra blank line between row 4 and row 5 and also have the #s not have any decimal points after?
Updated above
bballjoe12
Posts: 114
Joined: 20 Aug 2017, 09:11

Re: Parsing #s within Excel and then pasting into 3rd party application

31 Oct 2018, 07:52

If I had a list of numbers that I pasted from the clipboard (numbers will be different when I paste from the clipboard each time) in this format:

1848 395 269 416 628 1848 1076

Is there a way to get each # on it's own line?
User avatar
AlphaBravo
Posts: 586
Joined: 29 Sep 2013, 22:59

Re: Parsing #s within Excel and then pasting into 3rd party application

31 Oct 2018, 13:54

Clipboard := "1848 395 269 416 628 1848 1076"
MsgBox % RegExReplace(Clipboard, "\h+", "`r`n")
bballjoe12
Posts: 114
Joined: 20 Aug 2017, 09:11

Re: Parsing #s within Excel and then pasting into 3rd party application

01 Nov 2018, 08:11

So I took the 1st line out of that and it edits the clipboard contents perfectly!

Last question!

The following #s show up as such in the message box:

3687
680
680
830
1001
3687
2147

Is there a way to send the following keys as such:

3687
680
680
Send {Down}
Send {Down}
830
1001
3687
Send {Down}
2147

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 339 guests