Hi-ya Stephan

when we talk macros our code is practically 100% the
same:

sub PrinterSetup
rem
----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem
----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher =
createUnoService("com.sun.star.frame.DispatchHelper")

rem
----------------------------------------------------------------------
dispatcher.executeDispatch(document,
".uno:PrinterSetup", "", 0, Array())

end sub

When i call this macro from OpenOffice no problems.
But  when I use the scripting framework, no visible
effect. 

Here is the java code I use:

OfficeDocument document =
this.connection.getDocumentN();
XController controller =
document.getCurrentController();

XFrame frame = controller.getFrame();

XDispatchProvider xDispProvider = ( XDispatchProvider
) UnoRuntime.queryInterface(
XDispatchProvider.class,controller );
XURLTransformer xParser = (
com.sun.star.util.XURLTransformer )
UnoRuntime.queryInterface(  XURLTransformer.class, 
this.connection.getServiceFactoryN().createInstance(URL_TRANSFORMER
) );
URL[] aParseURL = new URL[1];
aParseURL[ 0 ] = new URL();

aParseURL[ 0 ].Complete = toDispatch;
xParser.parseStrict( aParseURL );
URL aURL = aParseURL[ 0 ];
XDispatch xDispatcher = xDispProvider.queryDispatch(
aURL, "", 0 ); //$NON-NLS-1$
// dispatch
if ( xDispatcher != null )
{
  xDispatcher.dispatch( aURL, new PropertyValue[] { }
);
}

also no visible effect.

Maybe something is funny with my machine, but I can
print and the Printer Settings command works ok.

weird.


--- Stephan Wunderlich <[EMAIL PROTECTED]>
wrote:

> Hi Kent,
> 
> > This one is really weird. PrintDefault works
> perfect,
> > a little window pops up and it ticks down the
> pages
> > and prints, but PrinterSetup, even though it is
> issued
> > exactly the same was as PrintDefualt never works.
> I
> > even tried to create a macro and called it, and it
> > doesn't work. The only guess I have is that
> somehow
> > the window is being swallowed somewhere. Does
> anyone
> > else have any ideas? Or any work arounds, ie is
> there
> > no other way to get the PrinterSetup window to
> appear?
> 
> Strange ...
> 
> document   = ThisComponent.CurrentController.Frame
> dispatcher =
>
createUnoService("com.sun.star.frame.DispatchHelper")
> dispatcher.executeDispatch(document,
> ".uno:PrinterSetup", "", 0, DimArray())
> 
> opens the PrinterSetup dialog on my machine ... what
> do I do different 
> than you ?
> 
> Regards
> 
> Stephan
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to