It:Usare le Macro

From NeoWiki

Revision as of 09:57, 10 November 2008 by Valterb (Talk | contribs)
Jump to: navigation, search
Questo articolo non è aggiornato, o ha bisogno di cambiamenti strutturali o stilistici per conformarsi al resto del wiki.


Pagina non ancora completa.

Contents

Registrare una semplice Macro

  1. Vai su Strumenti, scegli Macro quindi Registra Macro
  2. Esegui la serie di passaggi che vuoi che la macro esegua automaticamente (Per esempio, applica uno stile particolare)
  3. Quando hai finito tutti i passaggi, clicca su Termina registrazione
  4. Nella finestra che apparte, assegna un nome alla macro.
  5. Assegna la macro alla Libreria ed al Modulo (Controlla il capitolo 10 della NeoOffice User Guide sotto citata per ulteriori informazioni)
  6. Clicca su Salva quando hai le impostazioni che desideri.

Registrare del codice come Macro

Può accadere che tu trovi del codice su un forum o in un documento e che tu voglia aggiungerlo ad una macro. Per farlo, segui questi passaggi:

  1. Nel menù Strumenti scegli Macro, poi Organizza Macro, ed infine NeoOffice Basic...
    Fi attenzione che se il codice è scritto in un linguaggio diverso dal NeoOffice/OpenOffice.org Basic, hai bisogno di scegliere il linguaggio corrispondente in questo punto: in questo momento i linguaggi possibili sono, oltre al NeoOffice/OpenOffice.org Basic, Python, Bean Shell e JavaScript.
  2. Se necessario, clicca sul triangolo vicino a Mie Macro per mostrare le altre macro presenti.
    • Se la Macro verrà usata solo nel documento aperto, e/o se pensi di inviare il documento ad un altro utente, dovresti cliccare sul triangolino vicino all'icona del documento nel quale vuoi salvare la macro.
    • Non è possibile aggiungere Macro all'elenco delle Macro di NeoOffice
  3. Clicca sul triangolino vicino a Libreria dove vuoi conservare la macro.
    Attenzione: anche se la Libreria Standard è selezionata per default, conservando le Macro nella libreria Standard si corre il rischio che queste Macro possano essere cancellate in alcune circostanze. Quindi ti raccomandiamo di conservare tutte le tue macro in librerie da te create e nominate. Per creare una nuova Libreria:
    1. Clicca sul bottone Gestisci...
    2. Nella finestra NeoOffice: Gestione macro Basic, clicca sulla linguetta Library
      Attenzione: Se stai usando un altro linguaggio (p.e. Python), la finestra avrà un nome leggermente differente.
    3. Assicurati che il menù a discesa Posizione sia fissato su Macro e finestre di dialogo personale
      Se stai conservando la Macro nel documento, tuttavia, scegli il nome del documento dal menù a discesa Posizione.
    4. Cliccca su Nuovo...
    5. Dai un nome alla Libreria
    6. Clicca su OK
    7. Clicca su Chiudi
  4. Torniamo in NeoOffice: Gestione macro basic, clicca sul Modulo nel quale vuoi aggiungere il codice della Macro. Se desideri creare un nuovo modulo, fai come segue:
    1. Assicurati che la libreria nella quale vuoi aggiungere il Modulo sia selezionata
    2. Clicca su Nuiovo...
    3. Assegna un nuovo nome al Modulo
    4. Clicca su OK
    5. Clicca su Chiudi
  5. Una volta che la Libreria ed il Modulo siano stati scelti, assicurati che nel pannello di destra sia evidenziato "Main"
  6. Clicca su Modifica.
  7. Incolla il codice in una posizione qualunque sotto le linee Main/End Sub - assicurandoti di non incollare in mezzo alle righe di ltre macro salvate; una posizione normale è un paio di righe sotto la linea End Sub della Main.
  8. Clicca su Salva

Assegnare una Scorciatoia ad una Macro

  1. Vai su Strumenti>Personalizza...
  2. Clicc sulla linguetta Tastiera
  3. Nella sezione Area, scorri fino a raggiungere la voce "NeoOfficeMacros" ed evidenziala
  4. Espandi la voce cliccando sul triangolino a sinistra e clicca su "user", poi sulla libreria e sul modulo dove la tua macro è stata salvata. Le tue macro sono elencate nella finestra Funzione
  5. Evidenzia una di questa macro
  6. Nella sezione Combinazione tasti seleziona la combinazione di tasti che vuoi usare per quella macro
  7. Seleziona il bottone appropriato per definire se questa combinazione verrà usata da tutto NeoOffice o solo in Writer
  8. clicca su Cambia

Aggiungere un Pulsante alla Barra degli Strumenti per una Macro

  1. Go to Tools>Customize...
  2. Click on the Toolbar tab
  3. Choose the Toolbar you want to add the button to from the Toolbar dropdown near the top of the Customize window.
  4. Click on the Add... button
  5. In the Category box (in the Add Commands window, scroll down to "NeoOfficeMacros" and highlight it
  6. Burrow your way down through "My Macros" and the library and module your macros are stored in. Eventually your new macros will be listed in the Function box
  7. Highlight one of those macros and click the Add button
  8. Once back in the Customize window, you can add or change the icon assigned to the button by selecting the Macro in the Commands box, clicking on the Modify button and choosing Change Icon. Select an icon from those offered (note the up/down arrows that let you move through the collection) or click on the Import... button to import an icon. (Icons must be 26x26 pixels to import correctly.)
  9. Click OK

Creating a Button for a Macro

You can create a button which runs a macro in a Writer or a Calc document by using the followiing method:

  1. Go to the View menu, open the Toolbars sub-menu, and choose Form Controls.
  2. Click on the little triangle on the right top of the toolbar that appears to activate the design mode. Click on the Push button icon. The pointer changes into a cross.
  3. Draw the button as you wish. Control-click it, choose Control... in the context menu.
  4. Click on the General tab and give your button a title (label).
  5. Click on the Events tab. Click on the event, for example Mouse button pressed and click on the ... button to open the Assign action window.
  6. Click on the Macro... button.
  7. Choose your macro. Click on OK and again on OK, and then close the Properties: Button window.
  8. Quit the Design mode by clicking on the little triangle in the top right of the toolbar.

Documentation/Support for Macros

Print and E-books

Free

Chapter 10 of the NeoOffice User Guide discusses Basic and Macros. (The entire guide can be downloaded in pdf form from this link.)

The Getting Started with Macros Guide to OpenOffice.org can be downloaded with this link Just remember to use the command key where the OpenOffice guide says to use the control key.

Andrew Pitonyak has both a free downloadable document on OpenOffice Macros and a book that you can purchase.

Learn OpenOffice.org Spreadsheet Macro Programming: OOoBasic and Calc automation by Dr. Mark Alexander Bain (print or e-book for purchase). Look for the link to download a sample chapter (On working with Databases).

For Purchase

Andrew Pitonyak has both a free downloadable document on OpenOffice Macros and a book that you can purchase.

Forums and Wikis

The Open Office.org wiki has a section on BASIC.

The OpenOffice.org Community Forum has a forum on Macros.

The older OpenOffice.org Macros and API forum is a good source of information on Macros.

See especially this thread with an extensive list of internet and print resources on Macros.

Sources of Macros

Macros in Trinity Forum posts

From time to time, someone will provide a macro for a specific task in the trinity forums.

Other Sources of Macros

  • Writer Tools A set of macros that appear as an additional menu in OpenOffice.org.
N.B. Currently Writer Tools do not appear to work in NeoOffice. See this thread in trinity. Should anyone be able to adapt them to work in NeoOffice, please post the solution(s) in the aforementioned trinity thread. If a solution is found, this article provides some background on how to use them.
  • wr.Makros Macros for various components of OpenOffice.org.
Text of page is in German and English. These macros have not been tested on NeoOffice.


This article in other languages: Français
Personal tools