Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'java'
- include_class 'java.awt.Robot'
- class String
- def to_a
- array = []
- self.each_char { |letter| array << letter }
- return array
- end
- def permutations range
- array = []
- range.each do |i|
- self.to_a.combination(i).to_a.each do |j|
- j.permutation.to_a.each { |k| array << k.join }
- end
- end
- array
- end
- end
- robo = Robot.new
- robo.delay 10
- @enter_key = 10
- print "Enter your six letters: "
- letters = gets.gsub("\n", "").upcase
- puts "Letters will begin sending in three seconds. Click the game screen."
- sleep 3.0
- letters.permutations(3..5).each do |word|
- word.each_char do |letter|
- robo.keyPress(letter.sum)
- robo.keyRelease(letter.sum)
- end
- robo.keyPress @enter_key
- robo.keyRelease @enter_key
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement