[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Unable to run(automate) different file via Ruby

Pranjal Jain

5/22/2008 9:28:00 AM

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 :)
--
Posted via http://www.ruby-....

3 Answers

Gordon Thiesfeld

5/22/2008 3:41:00 PM

0

On Thu, May 22, 2008 at 4:28 AM, Pranjal Jain <pranjal.jain123@gmail.com> wrote:
> 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")}

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


> #sleep 25
> #wsh.SendKeys('{F5}')
>
>
> Thankx in advance :)
> --
> Posted via http://www.ruby-....
>
>

Pranjal Jain

5/23/2008 5:07:00 AM

0

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 :)


Gordon Thiesfeld wrote:
> On Thu, May 22, 2008 at 4:28 AM, Pranjal Jain
> <pranjal.jain123@gmail.com> 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

--
Posted via http://www.ruby-....

Gordon Thiesfeld

5/23/2008 1:39:00 PM

0

On Fri, May 23, 2008 at 12:07 AM, Pranjal Jain
<pranjal.jain123@gmail.com> 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