You are here

Macro Save to Relative Path

1 post / 0 new
farmer
Offline
Last seen: 17 years 11 months ago
Joined: 2006-12-17 17:39
Macro Save to Relative Path

I am new to OpenOffice and OOMacros.

I am trying to save a file to a relative path on my thumb drive.

The Macro I recorded works fine and saves as designed (saves as same file name in both html and odt formats)but I must have the drive letter "H:/" for it to save correctly.

Macro snippet:
rem ----------------------------------------------------------------------
dim args1(2) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///H:/OpenOfficePortable/Data/ER/test.odt"
args1(1).Name = "FilterName"
args1(1).Value = "writer8"
args1(2).Name = "SelectionOnly"
args1(2).Value = true

dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())

rem ----------------------------------------------------------------------
dim args2(2) as new com.sun.star.beans.PropertyValue
args2(0).Name = "URL"
args2(0).Value = "file:///H:/OpenOfficePortable/Data/ER/test.html"
args2(1).Name = "FilterName"
args2(1).Value = "HTML (StarWriter)"
args2(2).Name = "SelectionOnly"
args2(2).Value = true

dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args2())

Problem: When I move the thumb to another computer, a different drive letter may be assigned ("G:/" for example) and then saving with the above macro fails.

Does anyone know of a way to assign a relative path to a macro in BASIC?

Thanks in advance and please let me know if you need further information.
Farmer

PS: Did a thorough search and did not see this topic covered. If I missed it please send a link.