AutoHotKey + RegExMatch help

Discussion in 'Programming' started by Divvy, Jul 21, 2018.

  1. #1
    Hello,

    Would someone be kind enough to help me with a script? :)

    Let's say I have a notepad file with the following list format:

    #
    
    21domain.com http://21domain.com
    
    A
    
    artdomain.com https://artdomain
    animaldomain.com http://animaldomain.com
    
    B
    
    (...)
    Code (markup):
    I want to put domain.com in field1 and url in field2.
    Please check this screenshot for better understanding.

    Is it possible to just copy (Ctrl+C) the full line, example:

    animaldomain.com http://animaldomain.com
    Code (markup):

    And when I paste (Ctrl+V) in field1, the script put the domain in field1, give TAB and put the url in field2?

    I have found this code:

    ; full path to file here:
    filepath = C:\Users\User\Desktop\testlist.txt
    ; reading the file into vars
    Loop, read, %filepath%
    {
    StringSplit, TempArray, A_LoopReadLine , %A_Tab%
    Domain_%A_Index% := TempArray1
    Url_%A_Index% := TempArray2
    MaxIndex := A_Index
    }
    CurrIndex := 1
    
    ;hotkey to input the data, change to whatever you want
    F9::
    SendRaw, % Domain_%CurrIndex%
    sleep, 10
    Send, {Tab}
    sleep, 10
    SendRaw, % Url_%CurrIndex%
    return
    
    ; hotkey to get next set, change to whatever you want
    F10::
    CurrIndex += 1
    if (CurrIndex > MaxIndex)
    {
    CurrIndex := 1
    MsgBox, End of List!
    }
    Code (markup):
    Maybe someone can help me in adjust the code to my needs...

    Or if you think in a better/faster solution for my case, I really appreciate it :)

    Thank you in advance!!
     
    Divvy, Jul 21, 2018 IP