Assigning shortcut keys and deleting macros

Creating a macro - Writing a Script - Using the API

Assigning shortcut keys and deleting macros

Postby garrymo » Sun Oct 02, 2011 12:18 am

:( 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
garrymo
 
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm

Re: assigning shortcut keys and deleting macros

Postby floris v » Sun Oct 02, 2011 11:15 am

Binding accented letters to macros with keyboard shortcuts is rather expensive in keyboard shortcuts. It's better to use a program like [url="http://sourceforge.net/projects/allchars/"]allchars[/url] 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.
AOO 4.1.6 op Linux Mint
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
floris v
Moderator
 
Posts: 4195
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: assigning shortcut keys and deleting macros

Postby franx » Sun Oct 02, 2011 2:01 pm

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   Expand viewCollapse view
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   Expand viewCollapse view
args1(1).Name = "FontName"
args1(1).Value = "Liberation Sans"


The modified macro 'insert_ar'[/b]
Code: Select all   Expand viewCollapse view
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 5446 times


BTW: In real life I prefer the extension → Compose Special Characters
;)
LibreOffice 4.0.4 · WinXP
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

Postby garrymo » Mon Oct 03, 2011 12:29 am

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

Postby garrymo » Mon Oct 03, 2011 2:39 am

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

Postby garrymo » Mon Oct 03, 2011 2:40 am

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

Postby floris v » Mon Oct 03, 2011 8:37 am

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..
AOO 4.1.6 op Linux Mint
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
floris v
Moderator
 
Posts: 4195
Joined: Wed Nov 28, 2007 1:21 pm
Location: Netherlands

Re: Assigning shortcut keys and deleting macros

Postby garrymo » Tue Oct 04, 2011 2:29 am

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
garrymo
 
Posts: 28
Joined: Sat Sep 17, 2011 5:50 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 7 guests