# Problem in calling the script written in other file

**URL:** <https://www.ruby-forum.com/t/problem-in-calling-the-script-written-in-other-file/134138>\
**Category:** Ruby\
**Created:** [April 8, 2008, 8:13am UTC](https://www.ruby-forum.com/t/problem-in-calling-the-script-written-in-other-file/134138 "2008-04-08T08:13:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pranjal\_jain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Post date:** [April 8, 2008, 8:13am UTC](https://www.ruby-forum.com/t/problem-in-calling-the-script-written-in-other-file/134138/1 "2008-04-08T08:13:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pranjal\_jain](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ac91a4/32.png) [@pranjal\_jain](https://www.ruby-forum.com/u/pranjal_jain)\
**Post date:** [April 9, 2008, 7:40pm UTC](https://www.ruby-forum.com/t/problem-in-calling-the-script-written-in-other-file/134138/2 "2008-04-09T19:40:41Z")

</div>

Pranjal J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def test\_b\_count  
> $ie.links.each {|link| all\_links\_href \<\< link.href}  
> $worksheet\_two.Range(“b#{j+1}”).Value = “Fail”  
> I am trying to call this script in other file called login.rb  
> 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.
