[api-dev] Re: Get list of printers
On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote: I had hoped it would be as easy as CreateUnoService("com.sun.star.awt.PrinterServer") Unfortunately, the returned object is not usable. "Usable" is a relative term. You can always do something like this: oServer = CreateUnoService("com.sun.star.awt.PrinterServer") oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") oClass = oCore.forName("com.sun.star.awt.XPrinterServer") oMethod = oClass.getMethod("getPrinterNames") aNames = oMethod.invoke(oServer, Array()) Niklas -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
Am Donnerstag, den 07.04.2011, 18:08 +0200 schrieb Niklas Nebel: > On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote: > > I had hoped it would be as easy as > > > > CreateUnoService("com.sun.star.awt.PrinterServer") > > > > Unfortunately, the returned object is not usable. > > "Usable" is a relative term. You can always do something like this: > > oServer = CreateUnoService("com.sun.star.awt.PrinterServer") > oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") > oClass = oCore.forName("com.sun.star.awt.XPrinterServer") > oMethod = oClass.getMethod("getPrinterNames") > aNames = oMethod.invoke(oServer, Array()) Ah, I see. This does work. Can you explain why the intermediate step using Core Reflection is necessary, please? >From those old times there is another macro that must have been working, and it doesn't (work or use CoreReflection): function PrinterNameListNew ps = CreateUnoService("com.sun.star.awt.PrinterServer") dbgM(ps) dbgP(ps) dim xps as object xps = ps.QueryInterface("com.sun.star.awt.XPrinterServer") if NOT IsNull(xps) then dbgM(xps) else msgbox "NULL" endif PrinterNameListNew = ps.getPrinterNames() end function TIA, Marc -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
On 04/07/2011 12:08 PM, Niklas Nebel wrote: On 07.04.2011 15:48, Andrew Douglas Pitonyak wrote: I had hoped it would be as easy as CreateUnoService("com.sun.star.awt.PrinterServer") Unfortunately, the returned object is not usable. "Usable" is a relative term. You can always do something like this: oServer = CreateUnoService("com.sun.star.awt.PrinterServer") oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") oClass = oCore.forName("com.sun.star.awt.XPrinterServer") oMethod = oClass.getMethod("getPrinterNames") aNames = oMethod.invoke(oServer, Array()) Niklas Wow, thanks. Thanks to Ariel, I have a few links, one of which brings me here: http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66 Which I assume explains why we need to jump through the hoops mentioned above. I am amazed Never occurred to me that this could be done. Marc, in answer to your question of why, I assume that it is because the type detection stuff is not in place so Basic cannot see the required interface. (or something like that Did not give that comment much thought since my three year old is dragging me off my computer chair). Thanks! -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
Hi Andrew, >>> I had hoped it would be as easy as >>> >>> CreateUnoService("com.sun.star.awt.PrinterServer") >>> >>> Unfortunately, the returned object is not usable. >> >> "Usable" is a relative term. You can always do something like this: >> >> oServer = CreateUnoService("com.sun.star.awt.PrinterServer") >> oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") >> oClass = oCore.forName("com.sun.star.awt.XPrinterServer") >> oMethod = oClass.getMethod("getPrinterNames") >> aNames = oMethod.invoke(oServer, Array()) >> >> Niklas > Wow, thanks. Thanks to Ariel, I have a few links, one of which > brings me here: > > > http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66 So this means the problem with this absolutely unusable (despite the CoreReflection hoops) service is known for more than 2.5 years already, and nobody of us developers ever cared? Shame on us! Known as http://openoffice.org/bugzilla/show_bug.cgi?id=117765 now, fixed in CWS fs35a. Ciao Frank -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
On 07.04.2011 22:43, Marc Santhoff wrote: Can you explain why the intermediate step using Core Reflection is necessary, please? As Andrew wrote: The usual logic, where Introspection finds the methods from all supported interfaces, requires XTypeProvider. From those old times there is another macro that must have been working, and it doesn't (work or use CoreReflection): function PrinterNameListNew ps = CreateUnoService("com.sun.star.awt.PrinterServer") dbgM(ps) dbgP(ps) dim xps as object xps = ps.QueryInterface("com.sun.star.awt.XPrinterServer") if NOT IsNull(xps) then dbgM(xps) else msgbox "NULL" endif PrinterNameListNew = ps.getPrinterNames() end function In fact, this will work in 3.4, where the "Type" parameter for queryInterface can be given as a string (issue 116184). Niklas -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
Hi, Issue 117765 is good news. But this service com.sun.star.awt.PrinterServer is not documented in the IDL ! Only its interface. I hate using undocumented API. Can it be also corrected ? Regards Bernard Message de Frank Schönheit date 2011-04-08 09:28 : Hi Andrew, I had hoped it would be as easy as CreateUnoService("com.sun.star.awt.PrinterServer") Unfortunately, the returned object is not usable. "Usable" is a relative term. You can always do something like this: oServer = CreateUnoService("com.sun.star.awt.PrinterServer") oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") oClass = oCore.forName("com.sun.star.awt.XPrinterServer") oMethod = oClass.getMethod("getPrinterNames") aNames = oMethod.invoke(oServer, Array()) Niklas Wow, thanks. Thanks to Ariel, I have a few links, one of which brings me here: http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66 So this means the problem with this absolutely unusable (despite the CoreReflection hoops) service is known for more than 2.5 years already, and nobody of us developers ever cared? Shame on us! Known as http://openoffice.org/bugzilla/show_bug.cgi?id=117765 now, fixed in CWS fs35a. Ciao Frank -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
I have created Issue http://openoffice.org/bugzilla/show_bug.cgi?id=117769 to request the IDL documentation. Bernard Message de Bernard Marcelly date 2011-04-08 13:47 : Hi, Issue 117765 is good news. But this service com.sun.star.awt.PrinterServer is not documented in the IDL ! Only its interface. I hate using undocumented API. Can it be also corrected ? Regards Bernard Message de Frank Schönheit date 2011-04-08 09:28 : Hi Andrew, I had hoped it would be as easy as CreateUnoService("com.sun.star.awt.PrinterServer") Unfortunately, the returned object is not usable. "Usable" is a relative term. You can always do something like this: oServer = CreateUnoService("com.sun.star.awt.PrinterServer") oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") oClass = oCore.forName("com.sun.star.awt.XPrinterServer") oMethod = oClass.getMethod("getPrinterNames") aNames = oMethod.invoke(oServer, Array()) Niklas Wow, thanks. Thanks to Ariel, I have a few links, one of which brings me here: http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66 So this means the problem with this absolutely unusable (despite the CoreReflection hoops) service is known for more than 2.5 years already, and nobody of us developers ever cared? Shame on us! Known as http://openoffice.org/bugzilla/show_bug.cgi?id=117765 now, fixed in CWS fs35a. Ciao Frank -- -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help
[api-dev] Re: Get list of printers
Excellent! I documented, so it will be in my latest OOME document when I push it out Not nearly sufficient, however. On 04/08/2011 08:53 AM, Bernard Marcelly wrote: I have created Issue http://openoffice.org/bugzilla/show_bug.cgi?id=117769 to request the IDL documentation. Bernard Message de Bernard Marcelly date 2011-04-08 13:47 : Hi, Issue 117765 is good news. But this service com.sun.star.awt.PrinterServer is not documented in the IDL ! Only its interface. I hate using undocumented API. Can it be also corrected ? Regards Bernard Message de Frank Schönheit date 2011-04-08 09:28 : Hi Andrew, I had hoped it would be as easy as CreateUnoService("com.sun.star.awt.PrinterServer") Unfortunately, the returned object is not usable. "Usable" is a relative term. You can always do something like this: oServer = CreateUnoService("com.sun.star.awt.PrinterServer") oCore = CreateUnoService("com.sun.star.reflection.CoreReflection") oClass = oCore.forName("com.sun.star.awt.XPrinterServer") oMethod = oClass.getMethod("getPrinterNames") aNames = oMethod.invoke(oServer, Array()) Niklas Wow, thanks. Thanks to Ariel, I have a few links, one of which brings me here: http://openoffice.org/projects/api/lists/dev/archive/2008-08/message/66 So this means the problem with this absolutely unusable (despite the CoreReflection hoops) service is known for more than 2.5 years already, and nobody of us developers ever cared? Shame on us! Known as http://openoffice.org/bugzilla/show_bug.cgi?id=117765 now, fixed in CWS fs35a. Ciao Frank -- -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help -- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.odt Info: http://www.pitonyak.org/oo.php -- - To unsubscribe send email to dev-unsubscr...@api.openoffice.org For additional commands send email to sy...@api.openoffice.org with Subject: help