Ask Your Question
0

Save as events not working consistently as Save events

asked 2015-10-28 21:35:49 +0200

jay Arr gravatar image

updated 2015-10-29 20:40:45 +0200

Alex Kemp gravatar image

Using LO Version: 5.0.2.2 with OSX 10.10.5

Attached you'll find a simple document with one line of text

which has the following macros attached to the following events

Event save document -- Macro1 BEFORE_SAVE

Event Document has been saved -- Macro2 AFTER_SAVE

Event Save Document As -- Macro3 BEFORE_SAVE_AS

Event Document has been saved as -- Macro4 After_SAVE_AS

Now if you SAVE the document the following happens:

Macro1 executes -- the saving of the document -- and then Macro2 executes

BUT if you SAVE AS the document the following happens:

the save as prompt window -- then Macro3 executes and then Macro4 executes.

My question is:

Is this a BUG

or have I missed something?

C:\fakepath\TESTING_SAVE_EVENT.odt

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2015-10-29 20:33:18 +0200

jay Arr gravatar image

Forgive me, but I think you may have missed the point I was making.

My interpretation of the order of events is is that Macro 3 should execute BEFORE the prompt window and NOT after.

just like the BEFORE SAVE event macro does. If not, then what's the point of the event you might just as well have ONE save as event that executes AFTER the save as window prompt.

This is particularly pertinent to those users (like me) who want maximum control of the save as and be able to supply the filename BEFORE the window prompt appears.

edit flag offensive delete link more

Comments

@jay Arr I have edited my reply as it is too long for a comment.

peterwt gravatar imagepeterwt ( 2015-11-01 11:53:08 +0200 )edit
0

answered 2015-10-29 18:28:43 +0200

peterwt gravatar image

updated 2015-11-01 11:51:58 +0200

It is working correctly.
I have added to the Macro "BEFORE_SAVE_AS" some code to insert text into the document. When I "Save as" the prompt window comes up, enter new file name, BEFORE_SAVE_AS Macro runs, text is inserted, message box 3, message box 4.
Make sure you set a new file name in the "Save as" and not accept the current file name otherwise it just does a Save and the Macro 1 and 2 operate.

EDITED @jay Arr I think you are misunderstanding how the program works. When you click on "Save as" the pop up interface open so that the file details can be input. When you click on "OK" the file is saved according to the specification and it is at this time the "Save as" event is triggered. There is no extra window with "Save" so the event fires then. You cannot have the "Save as" event before saving is about to take place and this is when the "OK" is pressed. I can understand the need to be able to set the file name in a Macro. There would need to be an event which fired when the pop up appears which could then be used to access the pop up and set the file details. I don't think there is such an event. However you can Save a document using a Macro with the command:-
storeToURL("file:///path/to/file.odt", Args(0)).

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-10-28 21:35:49 +0200

Seen: 115 times

Last updated: Nov 01 '15