Using macro to save to network location

Keyboard macros or custom scripts

Using macro to save to network location

Postby MATT.B » Fri Dec 04, 2020 3:02 pm

I would like to create an open office macro to save to a network location. normally in windows explorer you would type \\wolv54-pc\Documents\ to get to the folder i want to save in.
I have been having trouble completing this task. so i have been using a workaround i have oo save in a folder and each time the computer starts the folder is transferred to the network location using a windows script.
my current code
Code: Select all   Expand viewCollapse view
Sub TEMPSAVE
        Dim args1(2) as new com.sun.star.beans.PropertyValue
        args1(0).Name = "Zoom.Value"
        args1(0).Value = 100
        args1(1).Name = "Zoom.ValueSet"
        args1(1).Value = 28703
        args1(2).Name = "Zoom.Type"
        args1(2).Value = 0
        Dim args2(1) as new com.sun.star.beans.PropertyValue
        Dim Arg(0) as new com.sun.star.beans.PropertyValue
        url = ConvertToUrl("C:\NetShare\Est Pdf\TEMP.ods")
        oDoc.StoreAsUrl(url,Array())
'ret& = Msgbox ("READY FOR EDIT", 10 + 1, "Information")
    End Sub

code i tried but crashes oo
Code: Select all   Expand viewCollapse view
        url = ConvertToUrl("\\wolv54-pc\documents\TEMP.ods")
        oDoc.StoreAsUrl(url,Array())


any help or advice would be appreciated
OpenOffice 4.1.1 ON WINDOWS 7 64
MATT.B
 
Posts: 161
Joined: Tue Nov 18, 2014 2:16 am

Re: using macro to save to network location

Postby RoryOF » Fri Dec 04, 2020 3:21 pm

My standard solution is, at boot, to automatically map the network folder to a folder on my computer. All files in the target folder now appear as local on my computer, but are actually stored on a network device.
Apache OpenOffice 4.1.9 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32523
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: using macro to save to network location

Postby Villeroy » Fri Dec 04, 2020 3:26 pm

Map a drive letter to the network share.
Or use a real programming language. Basic is past century.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29691
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: using macro to save to network location

Postby MATT.B » Fri Dec 04, 2020 3:46 pm

Villeroy wrote:Map a drive letter to the network share.
Or use a real programming language. Basic is past century.

I mean using another language is an option I just don't know the others.
what one would you suggest to get this job done?
OpenOffice 4.1.1 ON WINDOWS 7 64
MATT.B
 
Posts: 161
Joined: Tue Nov 18, 2014 2:16 am

Re: using macro to save to network location

Postby RoryOF » Fri Dec 04, 2020 3:58 pm

Python might be quickest in which to find some suitable code.

With apologies to Villeroy, have you checked the two Andrew Pitonyak works? It is very possible he has dealt with the problem (in BASIC!).
Apache OpenOffice 4.1.9 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32523
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Using macro to save to network location

Postby RoryOF » Fri Dec 04, 2020 5:07 pm

In https://www.pitonyak.org/AndrewMacro.odt listing 5.103 Andrew Pitonyak makes reference to a setting needed for connection to a network.

A quick search did not find any other useful reference to a network connection in this or his other main document.
Apache OpenOffice 4.1.9 on Xubuntu 20.04.2 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 32523
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Using macro to save to network location

Postby Villeroy » Fri Dec 04, 2020 7:42 pm

That listing connects to a running office program so you can control that remote office by means of macro code. It does not provide access to a Windows file system unless you want to load the file on the remote computer. I thought of something like https://pypi.org/project/pysmb/ , a Python library to access Windows stuff like \\Server\path\file.xyz

Mapping a network resource to a drive letter is very easy. Then you can access the files on driver Z: just like the files on any other drive.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
 
Posts: 29691
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to OpenOffice Basic, Python, BeanShell, JavaScript

Who is online

Users browsing this forum: No registered users and 4 guests