Page 1 of 1

Trying to read a file and output text

Posted: 13 Jul 2019, 20:20
by Sashabot
Hello, I am trying to send keyboard outputs depending on the information in a text file, I am very new to AutoHotkey and I am unsure where this information would be I read FileAppend & file-reading loop and am unsure of how to go about this.
I am pretty new to AHK but this is what I have and it just flat out looks wrong to me.

My example of what I have:

Code: Select all

ESC::ExitApp

#SingleInstance, Force

    F7::
    Loop, read, C:\Users\M\Desktop\logger.txt
    If line, $Test {
        Send, Hello!
    }
    else line, $Hello
        Send, How are you!
    }
    else line, $how are you
        Send, Fine!
}

Re: Trying to read a file and output text

Posted: 13 Jul 2019, 22:21
by Portwolf
Hello,

Yeah, that is a mess indeed :)
But it's doable.

Where do you want to send the commands to?
What are the commands? Text? Keypresses?

FileAppend is meant as file appending, not reading.
It outputs the data (variable) to a file.

Do you want to build a chat-bot, is that it?

Re: Trying to read a file and output text

Posted: 13 Jul 2019, 22:25
by Sashabot
Yes, sir/ma'am! it's sort of a chat-bot!
I just want some replies, I already have a way of outputting text from the program,
I just need to have a script that finds certain keywords and reply to the messages!

Re: Trying to read a file and output text

Posted: 13 Jul 2019, 22:57
by Portwolf
Well, that's kind of a BIG way to get started in AHK..
You will want to take a look at AHKLiza by derRaphael.

Little warning, you have a LOT of work in front of you :HeHe:

Re: Trying to read a file and output text

Posted: 13 Jul 2019, 23:11
by Sashabot
I can use this to read a file and output keyboard inputs?

Re: Trying to read a file and output text  Topic is solved

Posted: 14 Jul 2019, 00:20
by Sashabot
I found the commands I was looking for

Code: Select all

Loop, Read, C:\Users\M\Desktop\logger.txt  ; reads through the file
{
    if InStr(A_LoopReadLine, "$Test") ; "" anything in the quotaions will be checked
        send,O ; sends o