From: matt@... (matt neuburg) Date: 2008-04-10T02:40:06+09:00 Subject: Re: Problem in calling the script written in other file Pranjal Jain 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.com/matt/ Leopard - http://www.takecontrolbooks.com/leopard-customizing.html AppleScript - http://www.amazon.com/gp/product/0596102119 Read TidBITS! It's free and smart. http://www.tidbits.com