Trying to read a file and output text Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
Sashabot
Posts: 6
Joined: 06 Jul 2019, 14:36

Trying to read a file and output text

13 Jul 2019, 20:20

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!
}
Portwolf
Posts: 161
Joined: 08 Oct 2018, 12:57

Re: Trying to read a file and output text

13 Jul 2019, 22:21

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?
User avatar
Sashabot
Posts: 6
Joined: 06 Jul 2019, 14:36

Re: Trying to read a file and output text

13 Jul 2019, 22:25

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!
Portwolf
Posts: 161
Joined: 08 Oct 2018, 12:57

Re: Trying to read a file and output text

13 Jul 2019, 22:57

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:
User avatar
Sashabot
Posts: 6
Joined: 06 Jul 2019, 14:36

Re: Trying to read a file and output text

13 Jul 2019, 23:11

I can use this to read a file and output keyboard inputs?
User avatar
Sashabot
Posts: 6
Joined: 06 Jul 2019, 14:36

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

14 Jul 2019, 00:20

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

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Gio, Joerbeth, Peaceful, RamonArgentina, Sweetins, TXShooter, vanil and 57 guests