Jump to content

Random between designated letters.


Recommended Posts

Could you write out the actually script for me

Sure, simply deposit $100 in my PayPal account and I'll get right to it, sir.

array junk is new to me.

At one time, it was new to me, too.

Try searching the manual for "junk", or whatever, it's filled with useful examples.

This forum also has a search facility.

-mu

Link to comment
Share on other sites

Sure, simply deposit $100 in my PayPal account and I'll get right to it, sir.

At one time, it was new to me, too.

Try searching the manual for "junk", or whatever, it's filled with useful examples.

This forum also has a search facility.

-mu

i'll do it for $95.99 ^.^ lol :)

Link to comment
Share on other sites

i'll do it for $95.99 ^.^ lol :)

You need to look at using StringSplit (with no delimiter) with all the letters of the alphabet in the string.

So if your String is "ABCDEF" then StringSplit wil return an array with each element being a letter.

So the element in $Array[1] would be A, in $Array[2] would be B etc

Then you need to use the Random function to generate a number between 1 and 26 and make this a variable to pick a letter from the array, like this $Letter = $Array($Random)

Use _StringInsert to put this letter back into your original string.

Read the Helpfile, look at the examples, post some code here.

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

Hi,

maybe this helps a bit :

Dim $letter_A[3] = ['Y','O','U']

For $i=0 To 5
    MsgBox(0,$i, $letter_A[Random(0,UBound($letter_A)-1, 1)])
Next

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I want to [add/insert] random [letters/numbers/both?] between a set of letters I want to send.

"Y", "O", and "U" are the letters.

If you don't understand what I am asking, please tell me.

I'm not sure that I understand what you want - hence my edit of your quoted post.

Try this:

MsgBox(0, "", _SendRandomStuff("CAN YOU CODE", 3, 11))

;Send(_SendRandomStuff("CAN YOU CODE", 3, 11))

Func _SendRandomStuff($var, $min, $max)
    Local $varARRAY = StringSplit($var, "")
    Local $SRS = ""
    For $i = 1 To $varARRAY[0]
        Local $stuff = ""
        For $ii = 1 to (Random($min, $max, 1))
            $stuff = $stuff & Chr(Random(Asc("a"), Asc("z"), 1))
        Next
        $SRS = $SRS & $varARRAY[$i] & $stuff
    Next
    Return $SRS
EndFunc   ;==>_SendRandomStuff
The MsgBox is just for ease of testing.

Comment it out and uncomment the "Send" line.

You can change the "3" and the "11" when you call the UDF.

For the example above, 3 is the minimum number of lower cased letters that the UDF will insert between your letters... 11 is the maximum number inserted.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • Moderators

@plato - You're a better man than I if that is what he actually wants. I have read that thing 10 x's and still don't get it, and example on his part would have been great, I was assuming he only wanted to shuffle Y/O/U ... but that makes no sense either :).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Seriously. The trend lately seems to be: "How can I ask a question in the most cryptic way possible and provide the least amount of relevant examples/information at the same time?"

AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Seriously. The trend lately seems to be: "How can I ask a question in the most cryptic way possible and provide the least amount of relevant examples/information at the same time?"

Very observant, and also very true. I read (another) post on this forum over ten times earlier today, trying to figure out what the poster wanted (which *looked* like it would have been easy) before just giving up.

To my mind, it's the one asking the question that should be doing the leg-work, examples, sample code, clearly defining the task and goal, etc. But usually it takes umpteen posts from other members to even establish these basics.

crazy.

-mu

Link to comment
Share on other sites

I want to random between a set of letters I want to send.

"Y", "O", and "U" are the letters.

If you don't understand what I am asking, please tell me.

I think he means that he wants to send three sets of random letters between Y, O, and U.

$Letters = 5 ; Number of letters between Y, O, and U.

Global $Result

For $i = 1 To $Letters*2
     $Result = $Result & Chr(Random(65,90,1))
Next

$Result = "Y" & StringLeft($Result,$Letters) & "O" & StringRight($Result,$Letters) & "U"

MsgBox(0,"Result",$Result)
Edited by JoshDB
Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite
Link to comment
Share on other sites

...between Y, O, and U...

I like your use of

Chr(Random(65,90,1))

and I thought of using it, but was too lazy to look up the numbers...

I did not pay much attention to the word "between".

While 1
    MsgBox(0, "", _SendRandomStuff("YOU", 4, 22))
WEnd

Func _SendRandomStuff($var, $min, $max)
    Local $varARRAY = StringSplit($var, "")
    Local $SRS = ""
    For $i = 1 To ($varARRAY[0] - 1)
        Local $stuff = ""
        For $ii = 1 to (Random($min, $max, 1))
            $stuff = $stuff & Chr(Random(Asc("!"), Asc("~"), 1))
        Next
        $SRS = $SRS & $varARRAY[$i] & $stuff
    Next
    Return $SRS & StringRight($var, 1)
EndFunc   ;==>_SendRandomStuff

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

Maybe..

Dim $Y[4]
$Y[1]=Send('Y')
$Y[2]=Send('O')
$Y[3]=Send('U')

For $i= 1 to 3
Send(Random($Y[1],$Y[$i]))
Next

"YOU000"... very random haha

well.. i thought it would work. :/

You had the right idea, i just edited your code a bit:

hotkeyset("{end}","terminate")

sleep(2000)

DIm $Y[4]
$Y[1]='Y'
$Y[2]='O'
$Y[3]='U'

While 1
    
Send($Y[Random(1,3,1)])

sleep(30)

Wend

Func terminate()
    Exit    
Endfunc

Press the End key to make it stop.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

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...