Assigning shortcut keys and deleting macros

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
garrymo
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Assigning shortcut keys and deleting macros

Post by garrymo »

:( I spent some time assigning shortcut keys to various special characters such as the spanish accented vowels but found that once created, the shortcut key always defaults to the font used when the macro was recorded. Meaning if " á " was recorded in arial, whenever I'm writing in Times New Roman and need that symbol, the shortcut key will retrieve it only in arial. However, the shortcuts only worked for about a week and now when used they open a page called "My macros and dialogs.standard" with an error warning/notification: "BASIC syntax error.Symbol expected" which requires three clicks to close.

How do I assign permanent shortcut keys that work in all texts?
How do I remove the macros that are persisting in my: customize: keyboard: functions: macros category box even after deleting them several times from the shortcut list?
Last edited by garrymo on Wed Oct 05, 2011 1:51 am, edited 2 times in total.
Open Office 3.3 on Windows Vista
User avatar
floris v
Volunteer
Posts: 4431
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: assigning shortcut keys and deleting macros

Post by floris v »

Binding accented letters to macros with keyboard shortcuts is rather expensive in keyboard shortcuts. It's better to use a program like allchars or an extension. You can even use the United States (international) keyboard (in Windows), but that will make typing quotation marks followed by characters that may combine into accented letters (all vowels, y and c) more troublesome.
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
User avatar
franx
Volunteer
Posts: 540
Joined: Wed Nov 12, 2008 9:25 pm
Location: FRA 'n' QXB

Re: assigning shortcut keys and deleting macros

Post by franx »

garrymo wrote::( I spent some time assigning shortcut keys to various special characters such as the spanish accented vowels but found that once created, the shortcut key always defaults to the font used when the macro was recorded. Meaning if " á " was recorded in arial, whenever I'm writing in Times New Roman and need that symbol, the shortcut key will retrieve it only in arial. [...]
How to modify a recorded macro á, ñ, etc. (should work fine with all fonts)
[LibreOffice 3.4.3]:

Go to menu
Tools > Macros > Organize Macros > LibreOffice Basic > My Macros > Standard > Module1
Select the relevant macro (e.g.: 'insert_ar' = á) > Edit

The recorded macro 'insert_ar'

Code: Select all

sub insert_ar
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Symbols"
args1(0).Value = "á"
args1(1).Name = "FontName"
args1(1).Value = "Liberation Sans"

dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())

end sub
Remove the following lines, and save the file...

Code: Select all

args1(1).Name = "FontName"
args1(1).Value = "Liberation Sans"
The modified macro 'insert_ar'[/b]

Code: Select all

sub insert_ar
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Symbols"
args1(0).Value = "á"

dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())

end sub
Test
test_á_fonts.png
test_á_fonts.png (9.2 KiB) Viewed 7295 times
BTW: In real life I prefer the extension → Compose Special Characters
;)
LibreOffice 4.0.4 · WinXP
garrymo
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Re: Assigning shortcut keys and deleting macros

Post by garrymo »

I downloaded and installed the extension, restarted, but nothing shows in my Insert menu.
I checked in "downloads" where it informed me that the extension is installed. What's the next step to get it into "Insert", please?

I sent an email to: "support@productivityapps.com" for assistance but it came back as undeliverable.
Open Office 3.3 on Windows Vista
garrymo
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Re: Assigning shortcut keys and deleting macros

Post by garrymo »

update:
on checking into my downloads file I find that upon installing, LibreOffice over-rode O O and the extension is there, in L O. How can I get the download to install into O O and prevent L O from grabbing it?
Open Office 3.3 on Windows Vista
garrymo
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Re: Assigning shortcut keys and deleting macros

Post by garrymo »

update: :?:
on checking into my downloads file I find that upon installing, LibreOffice over-rode O O and the extension is there, in L O. How can I get the download to install into O O and prevent L O from grabbing it?
Open Office 3.3 on Windows Vista
User avatar
floris v
Volunteer
Posts: 4431
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Assigning shortcut keys and deleting macros

Post by floris v »

Open OOo, open the extensions manager, select the extension and install.
Note that in the OOo/LO etc series the last installed program will override all file bindings, including to opening odt, ods etc..
OpenOffice 4.1.11 on Ubuntu; LibreOffice 6.4 on Linux Mint, LibreOffice 7.6.2.1 on Ubuntu
If your problem has been solved or your question has been answered, please edit the first post in this thread and add [Solved] to the title bar.
Nederlandstalig forum
garrymo
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Re: Assigning shortcut keys and deleting macros

Post by garrymo »

Well, for a few moments that worked. I was happy but NOW, in the insert menu the extension notation has disappeared.
At TOOLS; EXTENSION MANAGER; it shows the extension as being there and I've reinstalled it, disabled it and then enabled it again, but NOTHING in the INSERT menu. . .

Also,theres another OO forum site. It's not this one. At the same time I lost the extension, I also lost the listing for this forum in my "favorites"menu. Searching on Yahoo for a link gives: www.oooforum.org
and brings up a site that says it's OO forums but is not THIS site. What's happening?
Open Office 3.3 on Windows Vista
Post Reply