[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Problem in calling the script written in other file

Pranjal Jain

4/8/2008 6:14:00 AM

Dear ALL
Hi,
I am practicing Ruby from the last 2 weeks.
I am trying to call the script in one file to the script written in
other file.

I had written a script in test.rb
The script is as follows :
#######################################################################

def test_b_count

sleep 2

puts "\n\nNumber of links on the web page are :" "
#{$ie.links.length}"
puts "\nNumber of divisions on the web page are :" "
#{$ie.divs.length}"

all_links_href = Array.new

$ie.links.each {|link| all_links_href << link.href}
#puts all_links_href
i = 0
until i > $ie.links.length
$worksheet_two.Range("a#{i+1}").value = all_links_href[i]
i += 1
end
j = 0
until j > $ie.links.length
$ie.goto "$worksheet_two.Range(a#{j+1}).Value"
if $ie.h2(:text,"Error 404--Not Found" ).exists?
$worksheet_two.Range("b#{j+1}").Value = "Fail"
else
$worksheet_two.Range("b#{j+1}").Value = "Pass"
end

j += 1
end
end
end
#############################################################

I am trying to call this script in other file called login.rb

But i am getting the error:

*********************************************************

c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
'gem_original_require': ./test.rb:4:syntax error, unexpected
kIN,expecting $end(SyntaxError)
Finished in 3.469 seconds.
from
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 'require
from login.rb : 6
**********************************************************

Please help.
Thanks in advance
--
Posted via http://www.ruby-....

1 Answer

matt

4/9/2008 5:35:00 PM

0

Pranjal Jain <pranjal.jain123@gmail.com> wrote:

> Dear ALL
> Hi,
> I am practicing Ruby from the last 2 weeks.
> I am trying to call the script in one file to the script written in
> other file.
>
> I had written a script in test.rb
> The script is as follows :
> #######################################################################
>
> def test_b_count
>
> sleep 2
>
> puts "\n\nNumber of links on the web page are :" "
> #{$ie.links.length}"
> puts "\nNumber of divisions on the web page are :" "
> #{$ie.divs.length}"
>
> all_links_href = Array.new
>
> $ie.links.each {|link| all_links_href << link.href}
> #puts all_links_href
> i = 0
> until i > $ie.links.length
> $worksheet_two.Range("a#{i+1}").value = all_links_href[i]
> i += 1
> end
> j = 0
> until j > $ie.links.length
> $ie.goto "$worksheet_two.Range(a#{j+1}).Value"
> if $ie.h2(:text,"Error 404--Not Found" ).exists?
> $worksheet_two.Range("b#{j+1}").Value = "Fail"
> else
> $worksheet_two.Range("b#{j+1}").Value = "Pass"
> end
>
> j += 1
> end
> end
> end
> #############################################################
>
> I am trying to call this script in other file called login.rb
>
> But i am getting the error:
>
> *********************************************************
>
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
> 'gem_original_require': ./test.rb:4:syntax error, unexpected
> kIN,expecting $end(SyntaxError)
> Finished in 3.469 seconds.
> from
> c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in 'require
> from login.rb : 6
> **********************************************************
>
> Please help.

The test.rb script script as you've shown it here is faulty (too many
"end" lines). m.

--
matt neuburg, phd = matt@tidbits.com, http://www.tidbits...
Leopard - http://www.takecontrolbooks.com/leopard-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...