auto_click is a gem pretty much used for manipulating keyboard/mouse via
ruby script.
The command below will take the mouse’s cursor to the given co-ordinates
mouse_move(100,100) #100,100 is the x and y coordinates (maybe?)
if you do
mouse_move(0,0) the cursor will go to the top-left corner of the screen
Now I want to pass the co-ordinates via a variable
So far, I haven’t found any smart way to do it.
Let’s look what irb thinks of it below.
DL is deprecated, please use Fiddle
irb(main):001:0> require ‘auto_click’
=> true
irb(main):002:0> coordinate = “100,100”
=> “100,100”
irb(main):003:0> mouse_move("#{coordinate}")
ArgumentError: wrong number of arguments (1 for 2)
from
C:/Ruby200/lib/ruby/gems/2.0.0/gems/auto_click-0.2.0/lib/auto_click
.rb:21:in mouse_move' from (irb):3 from C:/Ruby200/bin/irb:12:in
’
irb(main):004:0>
UPDATE:
DL is deprecated, please use Fiddle
irb(main):001:0> require ‘auto_click’
=> true
irb(main):002:0> x = 0
=> 0
irb(main):003:0> y = 0
=> 0
irb(main):004:0> mouse_move(x,y)
=> 1
irb(main):005:0>
I tried the above way and it worked, Only question now is shall I delete
this topic?