random typer
Moderators: Dorian (MJT support), JRL
random typer
how would i make a simple script that would randomly type a word using a set list of characters that i set and how could i set it to make the word only of length 0-20
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Do you need a WORD to be real word found in a dictionary of your language, or is any group of characters be considered a word? A length of zero is really acceptable?
Do each of the next 9 lines contain legitimate words?
this
is
really
good
abcdds
ccdddrrt
kjkk
general
------------------------------------------------
Do each of the next 9 lines contain legitimate words?
this
is
really
good
abcdds
ccdddrrt
kjkk
general
------------------------------------------------
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
words
any group of characters is considered a word well guess i should make it 1-20 instead of 0-20 oh and could i also use space as a character?i wanted to create something similiar to that using all numbers letters and space bar as charcaters but i want it make the word random im not wanting to make a list i just want it to type one random word so each time it types its random
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
So you want a random string of characters, length from 1-20 inclusive.
Accepatable characters include and are limited to:
letters a-z, numbers 0-9, space character.
include uppercase and/or uppercase?
If only allow one case, then have a total of 37 characters = CharCount
or
If allow both cases, then have a total of 63 characters = CharCount
Here is an outline to code for 63 chars:
-------------------------------------------------------
Make a string a-z,A-Z,space,0-9 = CharMembers.
Select a random number 1-20 for WordLength
Make a loop to cycle WordLength times
In the loop
Select a random number 1-CharCount
Concatenate Word by adding CharCount position of CharMembers
Increment Loop Counter
If Loop Counter>WordLength, End, Else Repeat loop
End
Accepatable characters include and are limited to:
letters a-z, numbers 0-9, space character.
include uppercase and/or uppercase?
If only allow one case, then have a total of 37 characters = CharCount
or
If allow both cases, then have a total of 63 characters = CharCount
Here is an outline to code for 63 chars:
-------------------------------------------------------
Make a string a-z,A-Z,space,0-9 = CharMembers.
Select a random number 1-20 for WordLength
Make a loop to cycle WordLength times
In the loop
Select a random number 1-CharCount
Concatenate Word by adding CharCount position of CharMembers
Increment Loop Counter
If Loop Counter>WordLength, End, Else Repeat loop
End
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
yeah i needed caps to
that is what im trying to do
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
???
i don't get how to use the random at all little more help please?like a small example of how to use random?
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
To generate a random number between 1 and 10:
Random>10,rand
Let>rand=rand+1
MessageModal>Random number is: %rand%
the first parm is the range, and the second is the variable to store the result in. The result is a value between 0 and range-1.
Random>10,rand
Let>rand=rand+1
MessageModal>Random number is: %rand%
the first parm is the range, and the second is the variable to store the result in. The result is a value between 0 and range-1.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Greetings idiot, (sorry, couldn't resist)
Bob gave you some great advice there... psuedocode for the steps to write the macro. Look at the Help File for an example of how to use the Random> command.
Here is a simple version of what you are trying to do. See if you can modify it to include *all* the characters that you want to potentially be part of your word... including the space char if that's what you're after.
...and let us know how it turns out.
Bob gave you some great advice there... psuedocode for the steps to write the macro. Look at the Help File for an example of how to use the Random> command.
Here is a simple version of what you are trying to do. See if you can modify it to include *all* the characters that you want to potentially be part of your word... including the space char if that's what you're after.
Code: Select all
Let>SourceString=ABCDEF
Let>RandomWord=
Let>k=0
Repeat>k
Let>k=k+1
Random>6,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
Until>k=20
MDL>Your random 20 character word is:%CRLF%%CRLF%%RandomWord%
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
code
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Let>RandomWord=
Let>k=0
Repeat>k
Let>k=k+1
Random>34,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
Until>k=20
send>%RandomWord%
ok i got it to type a random 20 letter word but how do i get it to do a range of 1-20?i know if i change the until>k=20 i can change the length but not sure about how to make it a range.
Let>RandomWord=
Let>k=0
Repeat>k
Let>k=k+1
Random>34,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
Until>k=20
send>%RandomWord%
ok i got it to type a random 20 letter word but how do i get it to do a range of 1-20?i know if i change the until>k=20 i can change the length but not sure about how to make it a range.
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Bob,
34 is OK because that number is related to the number of characters in the SourceString, not the number of characters in the output RandomWord.
Idiot,
You need to generate another random number for the length of the output string. Something like this untested code:
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Let>RandomWord=
//get random word length
Random>19,wlen
Let>wlen=wlen+1
Let>k=0
Repeat>k
Let>k=k+1
Random>34,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
//terminate after it has looped wlen times
Until>k=wlen
send>%RandomWord%
P.S. Why do you have that "space " at the beginning of SourceString?
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
34 is OK because that number is related to the number of characters in the SourceString, not the number of characters in the output RandomWord.
Idiot,
You need to generate another random number for the length of the output string. Something like this untested code:
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Let>RandomWord=
//get random word length
Random>19,wlen
Let>wlen=wlen+1
Let>k=0
Repeat>k
Let>k=k+1
Random>34,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
//terminate after it has looped wlen times
Until>k=wlen
send>%RandomWord%
P.S. Why do you have that "space " at the beginning of SourceString?
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
question
ok the above code does work but how do i set it to be a random range like 5-20 and not just totally random?also how would i use the writeln command to send the send>%RandomWord% to a file like say i have a file called text.txt on desktop how can i send the same result that im having it type to this file aswell?its so i can use the space bar as a character in the random word putting space either at front or back of sourcestring was easier
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
Re: question
Try this:idiot wrote:ok the above code does work but how do i set it to be a random range like 5-20 and not just totally random?
Code: Select all
//get random word length
//with Range=16, wlen will be a number from 0 to 15
Random>16,wlen
//now add 5 and you get a range of 5 to 20
Let>wlen=wlen+5
Have you looked up the Writeln> command in the Help file? Have you tried to use it? Post some code for what you've tried...idiot wrote:also how would i use the writeln command to send the send>%RandomWord% to a file like say i have a file called text.txt on desktop how can i send the same result that im having it type to this file as well?
Instead of this:idiot wrote:its so i can use the space bar as a character in the random word putting space either at front or back of sourcestring was easier
Code: Select all
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Code: Select all
Let>SourceString= 1234567890qwertyuiopasdfghjklzxcvbnm
Code: Select all
Random>34,RandomResult
MidStr>SourceString,RandomResult,1,Letter
Code: Select all
Random>37,RandomResult
Let>RandomResult=RandomResult+1
MidStr>SourceString,RandomResult,1,Letter
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Hi Marcus,
The example code you have for the Random> command in the Help file:
is misleading... No matter how may times you run this, its never going to roll a 6 and quite often rolls a 0. Dice like that can get you in trouble.
To roll 1-6, you might want to replace the example with this:
Thanks Me_again, until I saw your post, I thought Random>6,Result would generate 1-6.
Now I know it generates 0-5 and you just add 1 to bump the result up to 1-6 if desired.
The example code you have for the Random> command in the Help file:
Code: Select all
Random>6,DiceResult
Message>You threw a %DiceResult%
To roll 1-6, you might want to replace the example with this:
Code: Select all
//Set DiceResult to a random number from 0-5
Random>6,DiceResult
//Add 1, DiceResult now a number from 1-6
Let>DiceResult=DiceResult+1
Message>You threw a %DiceResult%
Now I know it generates 0-5 and you just add 1 to bump the result up to 1-6 if desired.
jpuziano
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
Note: If anyone else on the planet would find the following useful...
[Open] PlayWav command that plays from embedded script data
...then please add your thoughts/support at the above post -
code
im pretty sure the problem im having is i dont know what command i use to grab the random result but heres what i tried and it dosent work at all
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Let>RandomWord=
Let>k=0
//get random word length
Random>19,wlen
Let>wlen=wlen+5
Repeat>k
Let>k=k+1
Random>37,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
Until>k=wlen
send>%RandomWord%
putclipboard>%RandomWord%
GetClipBoard>%RandomWord%
writeln>c:\documents,text.txt,%RandomWord%
Let>SourceString=space 1234567890qwertyuiopasdfghjklzxcvbnm
Let>RandomWord=
Let>k=0
//get random word length
Random>19,wlen
Let>wlen=wlen+5
Repeat>k
Let>k=k+1
Random>37,RandomResult
MidStr>SourceString,RandomResult,1,Letter
ConCat>RandomWord,Letter
Until>k=wlen
send>%RandomWord%
putclipboard>%RandomWord%
GetClipBoard>%RandomWord%
writeln>c:\documents,text.txt,%RandomWord%
if idiots rule the world then im the king!!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!
i want a free t-shirt give me all of your rep!!!
please give me pro version of macro scheduler and appnavigator!!!