Jump to content

Randomizing a message and then typing it


Recommended Posts

I think i got the title wrong...maybe its suppose to be "Randomly choosing a message then typing it"

i need a script that will randomly choose a message from a list then type it in the active ___(what do you call them???like the place where you type something when you are creating posts)

Edited by rrrm99
Link to comment
Share on other sites

Hi,

A while ago i needed function that animate the title of window, so i have made a small(?) function that help me with that (_StringRandomize() and also _StringMove() to help this function :) )...

#include <String.au3>

$hWnd = WinGetTitle("")

TitleAnimate($hWnd, $hWnd, 5, 3)

Func TitleAnimate($hWnd, $FinalTitle, $AniSpeed=0, $TimeToAnimate=5)
    If Not IsHWnd($hWnd) Then $hWnd = WinGetHandle($hWnd)
    Local $CurrentWinTitle = WinGetTitle($hWnd)
    Local $TitlesArr = StringSplit($CurrentWinTitle, "")
    Local $NewTitle = ""
    Local $Timer = TimerInit()
    
    For $iT = 1 To $TitlesArr[0]
        Sleep($AniSpeed)
        $NewTitle = _StringRandomize($CurrentWinTitle)
        WinSetTitle(WinGetTitle($hWnd), "", $NewTitle)
        If TimerDiff($Timer)/1000 >= $TimeToAnimate Then ExitLoop
    Next
    WinSetTitle(WinGetTitle($hWnd), "", $FinalTitle)
EndFunc

Func _StringRandomize($String)
    If StringLen($String) = 0 Then Return
    Local $StrArr = StringSplit($String, ""), $iS, $StrArr, $RandomStr
    For $iS = 1 To $StrArr[0]
        $RandomStr = Random(1, $StrArr[0], 1)
        $String = _StringMove($String, $StrArr[$iS], $RandomStr)
    Next
    Return $String
EndFunc

Func _StringMove($String, $FindStr, $NewPos)
    If StringLen($String) = 0 Then Return
    If Not StringInStr($String, $FindStr) Then Return $String
    Local $NewStr=StringReplace($String, $FindStr, "", 1)
    If $NewPos >= StringLen($String) Then $NewPos = StringLen($String)-1
    Return _StringInsert($NewStr, $FindStr, $NewPos)
EndFunc

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

You can use Send("Text") to simulate those keys...

i know i just dont know how to make it choose what message

________________________________________________________________

Can anybody make me a script that will use the Random()

and then pop up a msgbox if number [random number here] pops up then it will have a different message for each number in the MSGbox then it will

read it then type it to the window [insert window title here]

Link to comment
Share on other sites

global $ran = random(1,5);$ran will be a random number from 1-5

if $ran = 1 Then;if 1 it will make a message box with the message
    msgbox(0,"msg","msg")
EndIf
if $ran = 2 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 3 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 4 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 5 Then
    msgbox(0,"msg","msg")
EndIf

Is this what you wanted?

Link to comment
Share on other sites

global $ran = random(1,5);$ran will be a random number from 1-5

if $ran = 1 Then;if 1 it will make a message box with the message
    msgbox(0,"msg","msg")
EndIf
if $ran = 2 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 3 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 4 Then
    msgbox(0,"msg","msg")
EndIf
if $ran = 5 Then
    msgbox(0,"msg","msg")
EndIf

Is this what you wanted?

Partialy...

how do you make it read the MSGbox then type something in [insert Window title here] according to the message

like if it shows up

msgbox(0,"msg","blablablabla")

then it will type the words OMG in [insert window title here]

Edited by rrrm99
Link to comment
Share on other sites

Partialy...

how do you make it read the MSGbox then type something in [insert Window title here] according to the message

like if it shows up

msgbox(0,"msg","blablablabla")

then it will type the words OMG in [insert window title here]

Does WinSetTitle() ring a bell? It's in the help file.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

yes...but i still don't know all the functions and what they do(only know the mousclicks a few win comands)

here is my script...

; Start of Script.Do not edit anything unless told
MouseClick ("left", 50, 755, 1)
MouseClick ("left", 85, 320, 1)
WinActivate ("http://www.yahoo.com/ - Microsoft Internet Explorer")
WinWaitActive ("http://www.yahoo.com/ - Microsoft Internet Explorer")
MouseClick ("left", 150, 70, 1)
WinActivate ("No page to display - Microsoft Internet Explorer")
WinWaitActive ("No page to display - Microsoft Internet Explorer")
MouseClickDrag ("left", 195, 105, 75, 105)
Send ("http://prankmail.org")
Send ("{ENTER}")
WinActivate ("Prankmail | Making email fun again - Microsoft Internet Explorer")
WinWaitActive ("Prankmail | Making email fun again - Microsoft Internet Explorer")
Sleep (20000)
MouseClick( "left", 305, 650, 1)
Sleep (20000)
MouseClick ("left", 410, 310, 1)
; Email To...need to randomize
Send ("PutEmail@Here.com")
MouseClick ("left", 420, 330, 1)
;Email From...do not need to randomize
Send ("PutEmail@here.com")
MouseClick ("left", 395, 350, 1)
; Subject Below...do not need to randomize
Send ("Subject Here")
MouseClick ("left", 420, 370, 1)
; Now i need the randomizer below
;Put Randomizer here
Send ("what ever the randomizer randomized")
;Script Ends Here...

i need the someone to edit the script so it does the randomize thingies

and as you can see i have very limited autoit knowledge

and it might not work if you try it on your comp

Edited by rrrm99
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...