Document Event-Driven Macros

This section describes how to assign scripts to application, document or form events.

You can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of document events and at what point an assigned macro is executed.

བྱུང་ལས།

འགན་སྤྲོད་མི་མེཀརོ་འདི་ལག་ལེན་འཐབ་ཡོདཔ...

routine

Start Application

...after a LibreOffice application is started.

OnStartApp

Close Application

... LibreOffice ཧེ་མ་འཇུག་སྤྱོད་འདི་རྩ་གྲོལ་ཡོདཔ་ད།

OnCloseApp

Document created

...New document created with File - New or with the New icon. Note that this event also fires when Basic IDE opens.

OnCreate

New Document

...ཡིག་ཆ་གསརཔ་འདི་གསར་བསྐྲུན་འབད་ཚར་བའི་ཤུལ་དང་བཅས ཡིག་སྣོད་ - གསརཔ ཡང་ན་འདི་དང་གཅིག་ཁར ངོས་དཔར གསརཔ།

OnNew

Document loading finished

...before a document is opened with File - Open or with the Open icon.

OnLoadFinished

ཡིག་ཆ་ཁ་ཕྱེ།

...ཡིག་ཆ་འདི་ཁ་ཕྱེ་ཚར་བའི་ཤུལ་དང་གཅིག་ཁར ཡིག་སྣོད - ཁ་ཕྱེ ཡང་ན་འདི་དང་གཅིག་ཁར ངོས་དཔར ཁ་ཕྱེ།

OnLoad

Document is going to be closed

...ཡིག་ཆ་ཁ་བསྡམས་པའི་ཧེ་མ།

OnPrepareUnload

Document closed

...ཤུལ་ལས་ཡིག་ཆ་ཁ་བསྡམས་ཚར་་ཡི། དྲན་དགོཔ་འདི་ "Save Document" བྱུང་ལས་དོ་རུང་ཡིག་ཆ་ཁ་བསྡམས་པའི་ཧེ་མ་སྲུངས་འབད་ཚར་རུང་འབྱུང་འོང་།

OnUnload

-no UI-

OnLayoutFinished

View created

Document is displayed. Note that this event also happens when a document is duplicated.

OnViewCreated

View is going to be closed

Document layout is getting removed.

OnPrepareViewClosing

View closed

Document layout is cleared prior to the document closure.

OnViewClosed

ཡིག་ཆ་ཤུགས་ལྡན་བཟོ།

...ཡིག་ཆ་འདི་གདོང་གཞི་ལུ་འབག་འོང་པའི་ཤུལ་ལས།

OnFocus

ཡིག་ཆ་ཤུགས་མེད་བཟོ།

...ཡིག་ཆ་གཞན་འདི་གདོང་གཞི་ལུ་འབག་འོང་པའི་ཤུལ་ལུ།

OnUnfocus

ཡིག་ཆ་སྲུངས་བཞག

...ཡིག་ཆ་འདི་དང་གཅིག་ཁར་ ཡིག་སྣོད་ སྲུང་བཞག་ ཡང་ན་ སྲུང་བཞག་་ ངོས་དཔར་ ཡིག་ཆ་མིང་ཧེ་མ་ལས་གསལ་བཀོད་འབད་བྱིན་ཡོད་མི་སྲུང་བཞག་བའི་ཧེ་མ།

OnSaveAs

ཡིག་ཆ་སྲུངས་བཞག་ཡོདཔ།

...ཡིག་ཆ་འདི་སྲུང་བཞག་འབད་ཚར་་བའི་ཤུལ་ལུ་དང་བཅས ཡིག་སྣོད - སྲུང་བཞག ཡང་ན་ ངོས་དཔར་ འདི་ ཧེ་མ་ལས་གསལ་བཀོད་འབད་ཡོད་པའི་ཡིག་ཆ་མིང་བྱིན་ཏེ་ཡོད་མི་དེ་སྲུང་བཞག་འབད།

OnSaveDone

Saving of document failed

Document could not be saved.

OnSaveFailed

ཡིག་ཆ་བཟུམ་སྦེ་སྲུངས་བཞག

...ཡིག་ཆ་འདི་གསལ་བཀོད་འབད་ཡོད་པའི་མིང་འོག་ལུ་ (with ཡིག་སྣོད་ སྲུང་སྦེ་ སྲུང་བཞག་པའི་ཧེ་མ, ཡང་ན་ ཡིག་སྣོད་ སྲུང་དང་གཅིག་ཁར་ ཡང་ན་ ངོས་དཔར་ སྲུང་འདི་ ཡིག་ཆ་མིང་འདི་གསལ་བཀོད་མ་འབདཝ་ད).

OnSaveAs

ཡིག་ཆ་འདི་སྲུངས་ཡོདཔ་བཟུམ་སྦེ།

...ཡིག་ཆ་འདི་གསལ་བཀོད་འབད་ཡོད་པའི་མིང་འོག་ལུ་སྲུང་བཞག་པའི་ཤུལ་ལུ(with File - Save As, or with File - Save or with the Save icon, if a document name has not yet been specified).

OnSaveAsDone

'Save As' has failed

Document could not be saved.

OnSaveAsFailed

-no UI-

When the document disk location has changed, for example after a File - Save As action.

OnStorageChanged

Storing or exporting copy of document

...before a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyTo

Document copy has been created

...after a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyToDone

Creating of document copy failed

Document could not be copied or exported.

OnCopyToFailed

Print document

...after the Print dialog is closed, but before the actual print process begins. This event occurs for each copy printed.

OnPrint

-no UI-

...after document security settings have changed.

OnModeChanged

'Modified' status was changed

Modified state of a document has changed.

OnModifyChanged

Document title changed

When the document title gets updated.

OnTitleChanged

Loaded a sub component

...after a database form has been opened.

OnSubComponentOpened

Closed a sub component

...after a database form has been closed.

OnSubComponentClosed

Printing of form letters started

...before printing form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMerge

Printing of form letters finished

...after printing of form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMergeFinished

Printing of form fields started

...before printing form fields.

OnFieldMerge

Printing of form fields finished

...after printing form fields.

OnFieldMergeFinished

ཤོག་ལེབ་གྱངས་ཁ་རྐྱབས་ནིའི་བསྒྱུར་བཅོས།

When the page count changes.

OnPageCountChanged


note

Most events relate to documents, except OnStartApp, OnCloseApp, OnCreate and OnLoadFinished that occur at application level. OnSubComponentOpened, and OnSubComponentClosed events are fired by database's forms.


tip

Writer documents are triggering those specific events: OnLayoutFinished, OnMailMerge, OnMailMergeFinished, OnFieldMerge, OnFieldMergeFinished and OnPageCountChanged.


མེཀརོ་ལས་བྱུང་ལས་ལུ་འགན་སྤྲོད་འབད་དོ།

  1. ལག་ཆས་ཚུ་ སྲོལ་སྒྲིག་་གདམ་ དང་བྱུང་ལས་ཚུ་ མཆོང་ལྡེ་ འདི་ཨེབ་གཏང་འབད།

  2. Select whether you want the assignment to be globally valid or just valid in the current document in the Save In listbox.

  3. བྱུང་ལས་ ཐོ་ཡིག་ ནང་ལས་བྱུང་ལས་སེལ་འཐུ་འབད།

  4. Click Macro and select the macro to be assigned to the selected event.

  5. དཔེ་མཛོད་མཇུག་བསྣོན་ལུ་ བཏུབ ཨེབ་གཏང་འབད།

  6. ཌའི་ལོག་ཁ་བསྡམས་ནིའི་དོན་ལུ་ བཏུབཨེབ་གཏང་འབད།

མེཀརོ་གི་འགན་ལས་བྱུང་ལས་ལུ་རྩ་བསྐྲད་གཏང་དོ།

  1. ལག་ཆས་ཚུ་ སྲོལ་སྒྲིག་་གདམ་ དང་བྱུང་ལས་ཚུ་ མཆོང་ལྡེ་ འདི་ཨེབ་གཏང་འབད།

  2. ཁྱོད་ཀྱིས་སྤྱི་ཁྱབ་ལས་འགུལ་ཡང་ན་ད་ལྟོའི་ཡིག་ཆ་ནང་ནུས་ཅན་ལས་འགུལ་འདི་ LibreOffice ཡང་ན་ཡིག་ཆ་ གདམ་ཁ་སེལ་འཐུ་འབད་འདི་གིས་རྩ་བསྐྲད་གཏང་ནི་ཨིན་ན་སེལ་འཐུ་འབད།

  3. བྱུང་ལས་ ཐོ་ཡིག་ ནང་ལས་རྩ་བསྐྲད་གཏང་ནིའི་འགན་ལས་ནང་ན་ཡོད་མི་བྱུང་ལས་སེལ་འཐུ་འབད།

  4. རྩ་བསྐྲད་གཏང་ ཨེབ་གཏང་འབད.

  5. ཌའི་ལོག་ཁ་བསྡམས་ནིའི་དོན་ལུ་ བཏུབཨེབ་གཏང་འབད།

In addition to assigning macros to events, one can monitor events triggered in LibreOffice documents.

Please support us!