Making clickable citations possible in notion

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
john3639
Posts: 4
Joined: 07 Aug 2022, 03:37

Making clickable citations possible in notion

Post by john3639 » 07 Aug 2022, 07:02

My main goal is, to be able to click an annotation 3 times and open the Zotero editor
(See Attachment 1)

I have tested if it is possible to open the annotation in Zotero,
(as you can see in attachment 2) and it works beautifully.

In order to make this "automation" possible, I will need, to have a script that:

Scrip 1: reads the clipboard and subtracts only the application URL, and then runs it like in attachment 2.

(But obviously, I need to have the "annotation blocks" in notion first, So I can use the script 1 on them.)

Script 2: process the Zoteros extracted file (see attachment 3) and create a new one(or edit the same), So then I can copy/paste the content directly into Notion.

I think the conversion will be easy because every annotation is separated from each other with an empty line, and not much editing is needed (see example in attachment 3).

Any suggestion will help me a lot.

Do you think that this is going to be possible? (I think it is an easy task)
!Should I edit or create a new file every time?!
Do you know any function (like run in attachment 3), that I should use?

download/file.php?id=18745
download/file.php?id=18744
download/file.php?id=18742
Attachments
notepad_41rIsvv7E9.png
Attachment 3
notepad_41rIsvv7E9.png (191.87 KiB) Viewed 690 times
mspaint_etD5KKrBme.png
Attachment 1
mspaint_etD5KKrBme.png (155 KiB) Viewed 690 times
notepad_wG2o8ERwvy.png
Attachment 2
notepad_wG2o8ERwvy.png (30.19 KiB) Viewed 690 times
Last edited by BoBo on 07 Aug 2022, 07:28, edited 1 time in total.

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: Making clicable citations possible in notion

Post by BoBo » 07 Aug 2022, 07:42

1st: Welcome :)
Hint: at least the script's content should be posted as code.
TBH, I (and probably a billion other supporters) aren't keen to use an OCR to get any sample code to work with from an :arrow: image :wtf: :lolno:

Taken from the 2nd image - the path you wanna extract seems always (?) the trailing string after the least positioned colon, correct?

Code: Select all

!c::
	clipboard:=""
	Send ^c
	ClipWait
	MsgBox % StrSplit(clipboard,":").Count() ;Replace 'MsgBox' with 'Run' after testing.
	return

john3639
Posts: 4
Joined: 07 Aug 2022, 03:37

Re: Making clickable citations possible in notion

Post by john3639 » 07 Aug 2022, 09:55

Thank you for your corrections :)

Sorry, but I don't fully understand your question.

If you still want to help me,

This is where i am:

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

^q::

myvariable := Clipboard
msgbox % myvariable


return

The script is going to be executed on different annotations every time,
but every time, at the end of EVERY annotation, is going to be the application URL
as you can see in attachment 1

For now, I was wondering if I could capture those URLs at the end of those different Annotations

maybe this could be done, if I was able to recognize the string "zotero://" and then capturing everything after this string
So, at the end, i could save the entire url in a variable temp
Attachments
chrome_bME2knaYDT.png
chrome_bME2knaYDT.png (36.97 KiB) Viewed 601 times

john3639
Posts: 4
Joined: 07 Aug 2022, 03:37

Re: Making clickable citations possible in notion

Post by john3639 » 07 Aug 2022, 10:06

here,
already found such a function.
image.png
image.png (3.09 KiB) Viewed 595 times

User avatar
mikeyww
Posts: 26594
Joined: 09 Sep 2014, 18:38

Re: Making clickable citations possible in notion

Post by mikeyww » 07 Aug 2022, 10:42

Code: Select all

str  = xyzzotero://abc
url := SubStr(str, Instr(str, "zotero://"))
MsgBox, 64, URL, %url%

john3639
Posts: 4
Joined: 07 Aug 2022, 03:37

Re: Making clickable citations possible in notion

Post by john3639 » 07 Aug 2022, 12:39

Thanks, to both of you.
I made the script that i wanted :)

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

XButton2::


Send ^c
ClipWait

myvariable := Clipboard

str  := myvariable
url := SubStr(str, Instr(str, "zotero://"))


;MsgBox, 64, URL, %url%

Run, %url%


clipboard := ""

return

User avatar
mikeyww
Posts: 26594
Joined: 09 Sep 2014, 18:38

Re: Making clickable citations possible in notion

Post by mikeyww » 07 Aug 2022, 16:47

Good!

Could do:

Code: Select all

XButton2::
Clipboard =
Send ^c
ClipWait, 0
If ErrorLevel
 MsgBox, 48, Error, An error occurred while waiting for the clipboard.
Else Run, % SubStr(Clipboard, Instr(Clipboard, "zotero://"))
Return

Post Reply

Return to “Ask for Help (v1)”