[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Hi Alister, I've already started playing around on ways to implement roo in there. Thank you. On Jan 23, 6:27 am, Alister Scott alister.sc...@gmail.com wrote: This is probably a lot easier if you use Roo. Full details available here:http://roo.rubyforge.org/ An example on how to read OpenOffice here:http://watirmelon.wordpress.com/2009/01/05/watir-and-roo/ The advantage is that you can then switch between excel, OO and GDocs without any code change. Cheers, Alister On Jan 23, 4:00 am, dmitry...@gmail.com dmitry...@gmail.com wrote: Yeah that makes sense. I don't mind contributing to your minds at all. Here is how I've implemented the .odsdata file read between two scripts. firstscript.rb: require 'secondscript' class FirstScript def testone(x, y) #these control the columns within the .odsfile i = #{y + 1} j = #{x + 1} k= #{x + 2} l = #{x + 3} noArgs = [] file_uri = file:///c:/test.ods serviceManager = WIN32OLE.new(com.sun.star.ServiceManager) coreReflection = serviceManager.createInstance (com.sun.star.reflection.CoreReflection) desktop = serviceManager.createInstance(com.sun.star.frame.Desktop) spreadsheet = desktop.loadComponentFromURL(file_uri, _blank, 0, noArgs) sheetsCollection = spreadsheet.Sheets sheet1 = sheetsCollection.getByIndex(0) $browser.text_field(:id,'position1').value = sheet1.getCellByPosition (i, j).Formula sleep 2 $browser.text_field(:id,'position2').value = sheet1.getCellByPosition (i, k).Formula sleep 2 $browser.text_field(:id,'position3').value = sheet1.getCellByPosition (i, l).Formula sleep 2 end SecondScript.new.testtwo([-1, 0], [-1, 1], [-1, 2]) end secondscript.rb goes like this: require firstscript class SecondScript def testtwo(a, b, c) FirstScript.new.testone (*a) #The *a controls the rows within the .odsfile FirstScript.new.testone (*b) FirstScript.new.testone (*c) end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
This is probably a lot easier if you use Roo. Full details available here: http://roo.rubyforge.org/ An example on how to read OpenOffice here: http://watirmelon.wordpress.com/2009/01/05/watir-and-roo/ The advantage is that you can then switch between excel, OO and GDocs without any code change. Cheers, Alister On Jan 23, 4:00 am, dmitry...@gmail.com dmitry...@gmail.com wrote: Yeah that makes sense. I don't mind contributing to your minds at all. Here is how I've implemented the .ods data file read between two scripts. firstscript.rb: require 'secondscript' class FirstScript def testone(x, y) #these control the columns within the .ods file i = #{y + 1} j = #{x + 1} k= #{x + 2} l = #{x + 3} noArgs = [] file_uri = file:///c:/test.ods serviceManager = WIN32OLE.new(com.sun.star.ServiceManager) coreReflection = serviceManager.createInstance (com.sun.star.reflection.CoreReflection) desktop = serviceManager.createInstance(com.sun.star.frame.Desktop) spreadsheet = desktop.loadComponentFromURL(file_uri, _blank, 0, noArgs) sheetsCollection = spreadsheet.Sheets sheet1 = sheetsCollection.getByIndex(0) $browser.text_field(:id,'position1').value = sheet1.getCellByPosition (i, j).Formula sleep 2 $browser.text_field(:id,'position2').value = sheet1.getCellByPosition (i, k).Formula sleep 2 $browser.text_field(:id,'position3').value = sheet1.getCellByPosition (i, l).Formula sleep 2 end SecondScript.new.testtwo([-1, 0], [-1, 1], [-1, 2]) end secondscript.rb goes like this: require firstscript class SecondScript def testtwo(a, b, c) FirstScript.new.testone (*a) #The *a controls the rows within the .ods file FirstScript.new.testone (*b) FirstScript.new.testone (*c) end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Yeah that makes sense. I don't mind contributing to your minds at all. Here is how I've implemented the .ods data file read between two scripts. firstscript.rb: require 'secondscript' class FirstScript def testone(x, y) #these control the columns within the .ods file i = #{y + 1} j = #{x + 1} k= #{x + 2} l = #{x + 3} noArgs = [] file_uri = file:///c:/test.ods serviceManager = WIN32OLE.new(com.sun.star.ServiceManager) coreReflection = serviceManager.createInstance (com.sun.star.reflection.CoreReflection) desktop = serviceManager.createInstance(com.sun.star.frame.Desktop) spreadsheet = desktop.loadComponentFromURL(file_uri, _blank, 0, noArgs) sheetsCollection = spreadsheet.Sheets sheet1 = sheetsCollection.getByIndex(0) $browser.text_field(:id,'position1').value = sheet1.getCellByPosition (i, j).Formula sleep 2 $browser.text_field(:id,'position2').value = sheet1.getCellByPosition (i, k).Formula sleep 2 $browser.text_field(:id,'position3').value = sheet1.getCellByPosition (i, l).Formula sleep 2 end SecondScript.new.testtwo([-1, 0], [-1, 1], [-1, 2]) end secondscript.rb goes like this: require firstscript class SecondScript def testtwo(a, b, c) FirstScript.new.testone (*a) #The *a controls the rows within the .ods file FirstScript.new.testone (*b) FirstScript.new.testone (*c) end end --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Hey Wesley, Sure thing. Will put up the solution here tonight. :) Just wanted to make sure I explain it clear as it's a bit of a hassle the way I've implemented it. I'm sure there has to be an easier way :0 Thanks, Dmitry On Jan 19, 8:45 pm, wesley chen cjq@gmail.com wrote: Why don't you put your solution here and let more people learn from you? Why do you let others consult to you privately? Thanks. Wesley Chen. On Tue, Jan 20, 2009 at 2:26 AM, dmitry...@gmail.com dmitry...@gmail.comwrote: Thanks guys for the comments guys, I already got it to work. Turned out a bit more complex but it works :) If anyone runs into this issue let me know, I'll try and guide ou through the steps I took. On Jan 19, 12:35 pm, bwaybandit lenridge...@gmail.com wrote: arity is a computer science term for arguments to a function. FirstTest.new.test (1, 0) should be resulting in an error that you do not have enough arguments since the definition of test only takes one argument. After that is fixed, and you get the error you are seeing, it is because that is a COM error. As Amit mentioned, getCellByPosition takes two arguments - a row and a column. You only have something called id. You are instantiating your class with two arguments. Change that and getCellByPosition and you will be in business hope that helps On Jan 19, 10:53 am, dmitry...@gmail.com dmitry...@gmail.com wrote: That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Thanks, when we put our opinion here, we may study more from others suggestion. Thanks. Wesley Chen. On Thu, Jan 22, 2009 at 12:46 AM, dmitry...@gmail.com dmitry...@gmail.comwrote: Hey Wesley, Sure thing. Will put up the solution here tonight. :) Just wanted to make sure I explain it clear as it's a bit of a hassle the way I've implemented it. I'm sure there has to be an easier way :0 Thanks, Dmitry On Jan 19, 8:45 pm, wesley chen cjq@gmail.com wrote: Why don't you put your solution here and let more people learn from you? Why do you let others consult to you privately? Thanks. Wesley Chen. On Tue, Jan 20, 2009 at 2:26 AM, dmitry...@gmail.com dmitry...@gmail.comwrote: Thanks guys for the comments guys, I already got it to work. Turned out a bit more complex but it works :) If anyone runs into this issue let me know, I'll try and guide ou through the steps I took. On Jan 19, 12:35 pm, bwaybandit lenridge...@gmail.com wrote: arity is a computer science term for arguments to a function. FirstTest.new.test (1, 0) should be resulting in an error that you do not have enough arguments since the definition of test only takes one argument. After that is fixed, and you get the error you are seeing, it is because that is a COM error. As Amit mentioned, getCellByPosition takes two arguments - a row and a column. You only have something called id. You are instantiating your class with two arguments. Change that and getCellByPosition and you will be in business hope that helps On Jan 19, 10:53 am, dmitry...@gmail.com dmitry...@gmail.com wrote: That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
arity is a computer science term for arguments to a function. FirstTest.new.test (1, 0) should be resulting in an error that you do not have enough arguments since the definition of test only takes one argument. After that is fixed, and you get the error you are seeing, it is because that is a COM error. As Amit mentioned, getCellByPosition takes two arguments - a row and a column. You only have something called id. You are instantiating your class with two arguments. Change that and getCellByPosition and you will be in business hope that helps On Jan 19, 10:53 am, dmitry...@gmail.com dmitry...@gmail.com wrote: That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Thanks guys for the comments guys, I already got it to work. Turned out a bit more complex but it works :) If anyone runs into this issue let me know, I'll try and guide ou through the steps I took. On Jan 19, 12:35 pm, bwaybandit lenridge...@gmail.com wrote: arity is a computer science term for arguments to a function. FirstTest.new.test (1, 0) should be resulting in an error that you do not have enough arguments since the definition of test only takes one argument. After that is fixed, and you get the error you are seeing, it is because that is a COM error. As Amit mentioned, getCellByPosition takes two arguments - a row and a column. You only have something called id. You are instantiating your class with two arguments. Change that and getCellByPosition and you will be in business hope that helps On Jan 19, 10:53 am, dmitry...@gmail.com dmitry...@gmail.com wrote: That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
Why don't you put your solution here and let more people learn from you? Why do you let others consult to you privately? Thanks. Wesley Chen. On Tue, Jan 20, 2009 at 2:26 AM, dmitry...@gmail.com dmitry...@gmail.comwrote: Thanks guys for the comments guys, I already got it to work. Turned out a bit more complex but it works :) If anyone runs into this issue let me know, I'll try and guide ou through the steps I took. On Jan 19, 12:35 pm, bwaybandit lenridge...@gmail.com wrote: arity is a computer science term for arguments to a function. FirstTest.new.test (1, 0) should be resulting in an error that you do not have enough arguments since the definition of test only takes one argument. After that is fixed, and you get the error you are seeing, it is because that is a COM error. As Amit mentioned, getCellByPosition takes two arguments - a row and a column. You only have something called id. You are instantiating your class with two arguments. Change that and getCellByPosition and you will be in business hope that helps On Jan 19, 10:53 am, dmitry...@gmail.com dmitry...@gmail.com wrote: That's not the answer I was looking for. but thanks. Just wondering what does arity mean? Dmitry --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---
[wtr-general] Re: Issue with using arguments within Open Office (column, row) code
you need to pass (row,column) for the function sheet1.getCellByPosition(id)...arity of this function is 2. On Sat, Jan 17, 2009 at 2:01 AM, dmitry...@gmail.com dmitry...@gmail.comwrote: Hello everyone, Running into an issue, would really appreciate some help. I have to files. One has a method with arguments defined for the Open Office Calc code like so: firstscript.rb: class FirstTest def test(id) noArgs = [] file_uri = file:///c:/test.ods serviceManager = WIN32OLE.new(com.sun.star.ServiceManager) coreReflection = serviceManager.createInstance (com.sun.star.reflection.CoreReflection) desktop = serviceManager.createInstance (com.sun.star.frame.Desktop) spreadsheet = desktop.loadComponentFromURL(file_uri, _blank, 0, noArgs) sheetsCollection = spreadsheet.Sheets sheet1 = sheetsCollection.getByIndex(0) $browser.text_field(:id, 'position_req_id').value = sheet1.getCellByPosition(id).Formula end end My other script sets the id: require firstscript FirstTest.new.test (1, 0) results in an error: method_missing': getCellByPosition (WIN32OLERuntimeError) OLE error code:1001 in [automation bridge] InterfaceOleWrapper_Impl::Invoke : [automation bridge]UnoConversionUtilitiesT::variantToAny Cannot convert the value of vartype :8 to the expected UNO type of type class: 6 HRESULT error code:0x80020009 Any ideas? Thank you. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Watir General group. To post to this group, send email to watir-general@googlegroups.com Before posting, please read the following guidelines: http://wiki.openqa.org/display/WTR/Support To unsubscribe from this group, send email to watir-general-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/watir-general -~--~~~~--~~--~--~---