Unable to run(automate) different file via Ruby

Hi
I am having a LoadRunner File which I want to run via Ruby Script.
I am trying to execute it proper functioning, but can’t.

I am putting the script here; please suggest if i am committing any
mistake.

Script is as follows :

WinClicker Library of Watir module required

require ‘watir/winClicker’

path of the script is specified

Dir.chdir(“d:/Load Runner/gmail”) {system(“gmail.usr”)}
#sleep 25
#wsh.SendKeys(’{F5}’)

Thankx in advance :slight_smile:

On Thu, May 22, 2008 at 4:28 AM, Pranjal J.
[email protected] wrote:

WinClicker Library of Watir module required

require ‘watir/winClicker’

path of the script is specified

Dir.chdir(“d:/Load Runner/gmail”) {system(“gmail.usr”)}

Kernel.system doesn’t know how to handle these files. You’d get the
same thing if you tried to run a ruby file:

test .rb

puts ‘hello world’

irb session

system(‘test.rb’)
=> false
system(‘ruby test.rb’)
hello world
=> true
system(‘call test.rb’)
hello world
=> true

So, either write the command so that it calls the executable that runs
your .usr file, or use ‘call’.

Hope that helps,

Gordon

HI Gordon
Thankx it worked.
But now I am facing a new problem, when I want to run tht script , I
cant do it.
the script is as follows :

This script can drive any scripts return anywhere on system

WinClicker Library of Watir module required

require ‘watir/winClicker’
require ‘win32ole’

wsh = WIN32OLE.new(‘Wscript.Shell’)

path of the script is specified

Dir.chdir(“d:/Load Runner/gmail”) {system(“call gmail.usr”)}
puts “Start”
sleep 3
wsh.SendKeys(‘%u’)
wsh.SendKeys(‘R’)

Wait for 2 seconds

sleep 2
puts “end”

Thankx in advance :slight_smile:

Gordon T. wrote:

On Thu, May 22, 2008 at 4:28 AM, Pranjal J.
[email protected] wrote:

WinClicker Library of Watir module required

require ‘watir/winClicker’

path of the script is specified

Dir.chdir(“d:/Load Runner/gmail”) {system(“gmail.usr”)}

Kernel.system doesn’t know how to handle these files. You’d get the
same thing if you tried to run a ruby file:

test .rb

puts ‘hello world’

irb session

system(‘test.rb’)
=> false
system(‘ruby test.rb’)
hello world
=> true
system(‘call test.rb’)
hello world
=> true

So, either write the command so that it calls the executable that runs
your .usr file, or use ‘call’.

Hope that helps,

Gordon

On Fri, May 23, 2008 at 12:07 AM, Pranjal J.
[email protected] wrote:

HI Gordon
Thankx it worked.
But now I am facing a new problem, when I want to run tht script , I
cant do it.

I’m not sure I understand your problem, but if you’re wanting to just
start gmail.usr, and continue with your script without waiting for it
to finish, you can change call to start. This will start gmail.usr in
a different cmd window.

Gordon