I need to write a name with a random number or a consecutive number house12 house15 or house18 house19....
I do it:
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mForm ATTR=ID:checkoutm CONTENT=house
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:mForm ATTR=ID:checkoutm CONTENT= EVAL("var randomNumber=Math.floor(Math.random()*100 + 1); randomNumber;")
iMacros writes house but when writes the random number deletes house...
How can I do for iMacros doesn’t delete house? And how can I do you write consecutive number house18, house19, house20....?
Thanks
Related
bookmark = [(10).times {print "<||>"}]
puts "\n#{bookmark}"
This is what I can see when printing this variable.
$
<||><||><||><||><||><||><||><||><||><||>
[10]
How could I do that this will be printing the correct operation inside of the variable bookmark
Edited: Let's change the number of times to 10. I will like to be able to use the result of that variable any time that I recall it
Thank you.
So what you're doing when you do this:
bookmark = [(10).times {print "<||>"}]
puts "\n#{bookmark}"
Is you are creating a variable named bookmark. Then you are setting it to an array, with one element. Te element is: (10).times {print "<||>"}. What that does is take the integer 10, and then loops 10 times and prints <||>. It then returns itself which is the integer 10. If you want an array with ten values, each of them being "<||>", then you need to do something a little bit different.
You can multiply arrays by an integer to increase the amount of the elements you multiplied.
bookmark = ["<||>"] * 10 will set bookmark to ["<||>", "<||>", "<||>", "<||>", "<||>", "<||>", "<||>", "<||>", "<||>", "<||>"]. If when you puts "#{bookmark}" you want each of those elements to be on it's own line, you shouldn't add a newline in front (\n), but you can join the array to form a string, and you can separate each element with a newline: puts bookmark.join("\n").
I currently use iMacro for Firefox for quick form filling with random letters.
SET !VAR1 EVAL("var letters = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','w','x','y','z']; var string = ''; for(var i = 0; i < 11; i++){string += letters[parseInt(Math.random() * 25)]}; string")
EVENT TYPE=CLICK SELECTOR="#namex" BUTTON=0
EVENTS TYPE=KEYPRESS SELECTOR="#namex" CHARS="{{!var1}}"
Result is e.g. adionudmeai.
I have a text file that containing
one hundred thousand names in this format.
johny.hunter
tim.davies
emil.bernadette
I want to use this names instead of the random combinations
with two additional random numbers at the end.
The end result should look like bill.cayne32.
Here is the code for random names with two additional random numbers at the end:
SET !DATASOURCE names.txt
SET linesInTxt 100000
SET rndLine EVAL("Math.floor(Math.random()*'{{linesInTxt}}') + 1;")
SET !DATASOURCE_LINE {{rndLine}}
SET !VAR1 EVAL("'{{!COL1}}' + Math.random().toString().substr(2, 2);")
I Use pre-generated strings from a text/csv file (Can be generated manually or by a 'random name generator' online).
Generate a file.csv where each line holds comma seperated info for one user. Info is accessed as {{!COL1}} for first item, 2 for second item etc'.
Using this csv method allows you to split first/last names and use them for both info filling and for the desired username with a period in between.
SET !DATASOURCE C:\Temp\stackoverflow.csv
SET !LOOP 1337 'where to start in the csv file
SET !DATASOURCE_LINE {{!LOOP}}
EVENTS TYPE=KEYPRESS SELECTOR="#new_post>DIV>P>DIV>DIV" CHARS={{!COL1}}{{!COL2}}.{{!COL3}}{{!VAR1}}
stackoverflow.csv file example:
pika,chuu,easypassword123
wobbu,ffet,mypassword
chari,zard,123456
after {{!COL1}} you can insert your random {{!VAR1}} or just {{!LOOP}} if it doesn't have to be real random.
To get VAR1 to display numbers and not chars do:
SET !VAR1 EVAL("var letters = ['1','2','3','4','5','6','7','8','9','0']; var string = ''; for(var i = 0; i < 2; i++){string += letters[parseInt(Math.random() * 10)]}; string")
I've read the documentation for Auto Hot Key, but am new to writing scripts. I keep getting errors.
I want a very simple script - so when I use a hotkey CTRL-ALT-N - Autohotkey creates a random number that is:
3 Digits - Decimal - 8 Digits
With the very first digit of the first group being between 1 and 4.
The rest can be completely random.
Off the sample scripts I tried to edit one posted - but I am doing something wrong. If anyone could help it would be really appreciated!
The output should look like this: 314.99382028 The first number always between 1 and 4, the rest random, and decimal always the 4th character.
Then, it should just paste the number to where ever you currently are within windows - not pop up display.
Thanks for anyone who could take a quick look and help out.
Rocket
^!n:: ;<-- change this if you want a diff hotkey
Chars1 = 1234
Chars2 = 1234567890
Chars3 = .
str =
clipboard =
UpperRange = 3 ;<-- use all 3 character strings
len = 12 ;<-- number of characters in the number
; generate a new number
loop, %len%
{ random,x,1,%UpperRange% ;<-- selects the Character string
random,y,1,26 ;<-- selects the character in the string
if (x = 12) ; if numeric there are only 10 digits
}
{ random,y,1,10
StringMid,z,Chars%x%,1 ;<-- grab the selected letter
str = %str%%z% ;<-- and add it to the number string
}
clipboard = %str% ;<-- put the completed string on the clipboard
Clipwait ;<-- wait for the clipboard to accept the string`
AND THEN PASTE WHERE EVER MY CURSOR IS - Not sure how to do that.
Thanks so much for the help!
Rocket
This should do the job if I understood it correctly:
^!n::
SendInput, % "{LButton}" . RandomString(1,"1234") . RandomString(2) . "." . RandomString(8)
Return
RandomString(length,chars:="0123456789") {
charsCount := StrLen(chars)
Loop % length {
Random, num, 1, % StrLen(chars)
string .= SubStr(chars,num,1)
}
Return string
}
Since you have your answer on your clipboard, you could simply use:
Send, ^v
This will paste where your caret is, not your mouse cursor, so if you want to paste where your mouse cursor is, just add Click before....
Click
Sleep, 30
Send, ^v
I have a text file having numbers like this +12345678912 (start with + and is 11 digit long) separated by tab whitespaces (seems like) in a text among with other data.
How can I match only those who have a + before the text and match the first 11 characters if they're present and they're all digits?
Updated:
This is the input
+12345678912 http://google.com 2012-05-07 11:30:06
+12345678913 http://google.com 2012-05-07 19:26:21
And the output should be an array with matching results
[12345678912, 12345678913]
Use this...
matches = str.scan(/^\+(\d{11})/m).flatten!;
CodePad.
I'm trying to select an anchor element by first containing the text "To Be Coded", then extracting a number from a string using substring, then using the greater than comparison operator (>0). This is what I have thus far:
/a[number(substring(text(),???,string-length()-1))>0]
An example of the HTML is:
<a class="" href="javascript:submitRequest('getRec','30', '63', 'Z')">
To Be Coded (23)
</a>
My issue right now is I don't know how to find the first occurrence of the open parenthesis. I'm also not sure how to combine what I have with the contains(text(),"To Be Coded") function.
So my criteria for the selection is:
Must be an anchor element
Must include the text "To Be Coded"
Must contain a number greater than 0 in the parentheses
Edit: I suppose I could just "hard code" the starting position for the substring, but I'm not sure what that would be - will XPath count the white space before the text in the element? How would it handle/count the characters?
Here try this :
a[contains(., 'To Be Coded') and number(substring-before(substring-after(., '('), ')')) > 0]