Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have just started on the fascinating journey with Linux (Mint in my case). One of the things I currently do on Windows is to automate various tasks in Word, using macros. One simple one is to make instant backups from an icon on the toolbar. I'm sure I'll be able to nut out making the icon. My question is can I use more or less the same VBA coding on the Macro? Currently I save a copy of the open word file to another drive when I click on the icon. Thus I can keep backups as often as I like while writing (every page, paragraph, sentence or even word!). I'd like to this in Linux too. This is a fragment showing how I currently do it in VBA/Word
strBackupPath = "F:\AAMiscBackupFiles" 'USB Stick
Set oDoc=ActiveDocument
With oDoc
'mark the current cursor position
.Bookmarks.Add Range:=Selection.Range, Name:="OpenAt"
.Save ' to the basic location (main 'hard' disk/SSD)
strFileA = .FullName
strFileB = strBackupPath & aComment & .Name
.Close 'Close the document prior to copying
End With
FileCopy strFileA, strFileB 'copy document
Documents.Open strFileA 'return to document
ActiveWindow.View.Type = wdPrintView
ActiveDocument.Bookmarks("OpenAt").Select 'cursor posn
'
Thanks. The problem is that I currently save to multiple places: a USB stick, an outboard hard drive, the Cloud and the main drive, all with one click. I have written other macros such as one to take a Word document, make changes to it and its title and save it as PDF. That will be a harder one to crack no doubt, but it must be possible. I thought I'd start with the simple one! One of the things is of course the different file tree.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Rep:
I guess you want to be quite careful not to lose any work. That's understandable. I'm simply not sure whether or not LibreOffice can use an actual programming language for macros, or if it is only the LibreOffice macro language.
I have found there is always a way. It might be different than what you are used to. But it also might be better! I did find one user who programmed a macro to convert a document and save it to a remote location in the new format, all with one click.
You mentioned that. So, I thought I'd mention that it is possible. The user didn't cite any examples.
You can write LibreOffice macros in Java, ECMAscript, or Python. There are a few guides around for that. You'll have to look around to find ones that are useful to you.
As an aside, yours is the first use case that makes sense for a macro that I have seen since ages and ages. Interesting idea.
Don't forget that Writer can do automatic saving: you can configure it from the menu: Tools - Options - Load/Save - General. The details are explained in the Writer documentation.
I repeat, it works. Now if I change the line that defines MyPath from home to suit the apparent path to a USB key I have, it does not work. The path to this appears to be media/alan/USBKEY/backup
I confirm that the USB key is called USBKEY and within it I have mkdired a dir called backup, both verified by looking at the path.
I would appreciate comments on what is wrong with my alternative path
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.