Sign in to follow this  
Followers 0

how to send text?

6 posts in this topic

#1 ·  Posted (edited)

hello im trying to automate random greetings word from .txt file  and write/send some strings but it gives me error

please be gentle to me im kinda newbie thank you

$File = FileReadToArray("words.txt")
$RandomWords = $File[Random(0, UBound($File) - 1, 1)]

send ("$RandomWords")
sleep (1000)
send ("{enter}")


Edited by darkangel37

Share this post

Link to post
Share on other sites

where is your desired target for the text to be sent to?

Share this post

Link to post
Share on other sites
15 hours ago, genius257 said:

where is your desired target for the text to be sent to?

for emails word.txt file contain some hello,hi, dear. and bunch of shortcut greetings

Share this post

Link to post
Share on other sites
15 hours ago, JLogan3o13 said:

@darkangel37, remove the quotes in your send line. When referencing a variable, do not put quotes around it.

what should i put? sorry im kinda newbie here

Share this post

Link to post
Share on other sites

Okay so here's an idea, because currently as soon as you launch the application, the text will be sent.

Press the + key (not numpad) to send to current active window

HotKeySet("{+}", "_Send")

$File = FileReadToArray("words.txt")

While 1

Func _Send()
    $RandomWords = $File[Random(0, UBound($File) - 1, 1)]

Just close the application by clicking the tray icon and choosing exit

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • OrangeCoder
      Send vs ControlSend
      By OrangeCoder
      Hey Guys - I am trying to write a very simple script that just types a value into ONE field and presses and next
      That's it!
      Here is what I am trying to do:
      I have a software product that used Installshield to package it - I wrote a response file per installshield directions /  for the software and it automated almost everything except one window... sadly the company that makes the software doesn't want to help, installshield won't help since I don't have a license . So I am trying to write and autoit script to fill in the one window that doesn't get recorded in the response file to finish the installation
      My write activated the window but when I follow it with a send() it doesn't work
      here is what I have
      WinActivate("Server Information") Send("xx-xxx-xx") Send("!n") Send("{SPACE}") any ideas ?
    • NiceBoy1234
      Run Command in Shell Execute
      By NiceBoy1234
      How can I run this command:
           Send( 'C:\xampp\htdocs\myApp\BuildDVD.exe ..\..\projects\dvdrom\' & $sFileName & '\project.xml ..\..\projects\' & $sFileName & '\video')

      in a Shell Execute?

      I can run

      but how to I add the rest of the command?
    • WoodGrain
      Send Raw is driving me INSANE - What am I doing wrong or is this a bug?
      By WoodGrain
      Hi All,
      Could someone please PLEASE tell me what I'm doing wrong here?
      I feel like I'm close to figuring this out, I think I've identified what is causing the issue.
      Whenever I try to use the hotkey CTRL+SHIFT+T (or any other letter other than T for that matter) to paste the text to notepad, my CTRL and SHIFT keys are held down *IF* I release them *WHILE* the raw text is being written.
      It seems to be that if I release the CTRL+SHIFT keys:
      Before the Send Raw text starts to write to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good During the Send Raw text being written to the screen: the CTRL and SHIFT keys ARE held down perpetually until I physically press them on the keyboard, this is bad After the Send Raw text has written all text to the screen: the CTRL and SHIFT keys ARE NOT held down, this is good This is also the case if I were to use the Windows Key as the hot key instead of the CTRL+SHIFT, I would need to tap the WIN key physically on my keyboard if I released it while the raw tet was being sent to the screen (eg, WIN+T).
      This issue also happens no matter which program I try to write the text to.
      Here's some example code:
      (I've put a bunch of "a's" in there to give enough time to test releasing the CTRL+SHIFT before/during/after the writing of them)
      HotKeySet("^+t", "WriteTxt") Func WriteTxt() WinWaitActive("Untitled - Notepad") $var = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" send($var, 1) EndFunc While 1 Sleep(500) WEnd Thanks guys!
    • JJ1122
      I'm stuck with while/if loop... please help!
      By JJ1122
      #include <Misc.au3>
      While 1
         If _IsPressed(59) Then
      I want the script to do this:
      - if I press "Y", send "B" once and hold left click down until i release "Y".
      - if I take my hands off of "Y" key, then send "B" once again and release left click.
      but the script I made has problems.
      when I run the script, it starts sending "B" repeatedly, and my left click won't work.
      I'm not smart enough to figure out what the problem is... please help me!
      sorry for bad English.
    • FMS
      Commandline function
      By FMS
      I've made a GUI that can send multiple commands.
      The way I'm doing this at the moment is whit "send" commands.
      also first go to the right directory where the "to be used" program sits
      And send from there the commandline argument whit parameters.
      Here is a example of the way I'm using it now:
      Func restart_app($xip) Run("C:\WINDOWS\system32\cmd.exe") WinWaitActive("C:\WINDOWS\system32\cmd.exe") Sleep(50) send("cd\" & "{ENTER}") Sleep(50) send("cd Tools" & "{ENTER}") Sleep(50) send("pskill \\" & $$xip & " -u username -p pass /accepteula app.exe" & "{ENTER}") EndFunc This way is working and I got no problems whit this.
      Also I realy think there is a mush better and way to do the same and maybe a little bit less error free
      (even better if this is hidden for the user :))
      On this forum I could not find anything related to this subject (or I was not looking in the right direction) and hope somebody knows a better way
      Is there a way where u can send the arguments and parameters directly in 1 line to the commandpromt whitout using "send" to commandprompt?
      Thanks in advanced

      ps: I also tried :
      ShellExecute("pskill", "\\" & $xip & " -u username -p pass /accepteula app.exe")

      But din't work