AutoHotkey Community

It is currently May 26th, 2012, 8:33 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: August 20th, 2009, 10:28 pm 
Offline

Joined: August 20th, 2009, 9:23 pm
Posts: 2
Hi, just started using AHK, and have written my first little script for MS OneNote but am having trouble with the second. I'm pretty lost with this stuff, to be honest.

I find that OneNote has pretty weak hyperlinking commands, so I want to make a couple of tweaks.

First, I wanted to be able to quickly link two pages to each other. This little script copies the hyperlink to the current page, inserts that hyperlink to the previous page (at wherever the insertion point was left) and then inserts a hyperlink to that second page back on the first page where you started. IOW, it creates mutually linking pages.

Code:
#c::
Send !ehg!{Left}^v^t!ehg!{Right}^v
   ;copies hyperlink to current page
   ;back to last page
   ;paste
   ;move to page header
   ;copies hyperlink to current page
   ;forward to earlier page
   ;paste
return


OK, so it's a pretty simple code. How could it be improved upon? I don't even know how to make it work exclusively in OneNote.

But here's my question. I'd like to make another script to copy text formatted with a hyperlink to its current section. IE, the pasted item contains a link to its original position (similar to what happens when you paste a clip from a web site, in fact).

I was going to do a simple macro of keyboard commands like the previous script. Something like the following commands, which I could use when I have something selected: "Copy hyperlink to current section" > "insert hyperlink" > "paste" > "enter" > "copy" > "AppsKey" > "remove hyperlink".

Again, not very sophisticated, I'm sure, but I don't see why it wouldn't work.

The only problem is that after closing the hyperlink dialog box, the text that was originally selected is no longer selected, (ie, between "enter" and "copy" in my little sequence). So, I'm thinking I need AHK to remember what I had originally selected, and then reselect it before going on to the next set of commands.

So how would i do that? Or am I going about this all wrong?


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 21st, 2009, 3:33 am 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
Jeebu wrote:
I don't even know how to make it work exclusively in OneNote.

the ahk_class for my version of onenote (2003) is Framework::CFrame
so you would do
Code:
#IfWinActive ahk_class Framework::CFrame
; ...
; your code
; ...
#IfWinActive

Jeebu wrote:
"Copy hyperlink to current section" > "insert hyperlink" > "paste" > "enter" > "copy" > "AppsKey" > "remove hyperlink"

what are the menu options / key commands to do this?

also, what version one note are you using?

_________________
Image
ʞɔпɟ əɥʇ ʇɐɥʍ


Report this post
Top
 Profile  
Reply with quote  
PostPosted: August 21st, 2009, 9:52 pm 
Offline

Joined: August 20th, 2009, 9:23 pm
Posts: 2
thanks for the reply. I'll try what you did with the code.

As for the commands you asked about:
Code:
!eha  ;Copy hyperlink to current section
^k  ;insert hyperlink
^v  ;paste
{enter}  ;enter
^c  ;copy
{AppsKey}  ;context menut
r  ;remove hyperlink


That was the sequence of commands that I envisioned.

I'm using OneNote 2007 SP2, so it might be different on yours.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, joetazz, Mickers, Pulover, tidbit, tomoe_uehara, Yahoo [Bot] and 55 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group