Beanshell + Java : file path problem

Java, C++, C#, Delphi, ??? - Using the UNO bridges

Beanshell + Java : file path problem

Postby tanith » Thu Apr 17, 2008 12:06 pm

Hi everybody,

i'm asked to develop an extension for Calc in Beanshell.
The beanshell code import Java classes, and one of them had to use File.getPath function. My problem goes from the result of this function. The string is like : ${$SYSBINDIR/bootstrap.ini::UserInstallation}... And Java cannot work whith a such path.

So my question is :

Is there a way to convert ${$SYSBINDIR/bootstrap.ini::UserInstallation} into a windows path ?

thanks for answering
tanith
 
Posts: 2
Joined: Thu Apr 17, 2008 11:57 am

Re: Beanshell + Java : file path problem

Postby Villeroy » Thu Apr 17, 2008 1:45 pm

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28440
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Beanshell + Java : file path problem

Postby tanith » Thu Apr 17, 2008 3:16 pm

Your information explain the form of my path...but it seems that i need get a filepath without using this Bootstrap system.

Thanks for your answer
tanith
 
Posts: 2
Joined: Thu Apr 17, 2008 11:57 am

Re: Beanshell + Java : file path problem

Postby ms777 » Sun Jun 01, 2008 1:26 pm

you do not have to use the bootstrap mechanism to use the services mentioned in the links above. Try this beanshell script ...
Code: Select all   Expand viewCollapse view
sInput = "${$SYSBINDIR/bootstrap.ini::UserInstallation}";

oMacroExpander = XSCRIPTCONTEXT.getComponentContext().getValueByName("/singletons/com.sun.star.util.theMacroExpander");
sOutput = oMacroExpander.expandMacros(sInput);

javax.swing.JOptionPane.showMessageDialog(null, sOutput, sInput, javax.swing.JOptionPane.WARNING_MESSAGE);

return 0;
ms777
Volunteer
 
Posts: 132
Joined: Mon Oct 08, 2007 1:33 am


Return to External Programs

Who is online

Users browsing this forum: No registered users and 3 guests