AkelPad Forum Index AkelPad
Support forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert clipboard

 
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English)
View previous topic :: View next topic  
Author Message
Akuro



Joined: 27 Mar 2015
Posts: 42

PostPosted: Tue Mar 31, 2015 3:16 pm    Post subject: Insert clipboard Reply with quote

I know how to insert selected text with the \s switch, but is there something similar for inserting the clipboard content, such as \cp or any other way to get the current clipboard text inserted?
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1577
Location: Poland

PostPosted: Tue Mar 31, 2015 5:44 pm    Post subject: Reply with quote

Akuro
Read about AkelPad Scripts methods in ...\AkelPad\AkelFiles\Docs\Scripts-Eng.txt:
AkelPad.GetClipboardText()
AkelPad.ReplaceSel()
Back to top
View user's profile Send private message
Akuro



Joined: 27 Mar 2015
Posts: 42

PostPosted: Tue Mar 31, 2015 7:32 pm    Post subject: Reply with quote

Thank you KDJ,
after reading about those 2 methods, I am still in the dark how to pull this off. Maybe it's best to nail it down step by step:

1) There is nothing similar to
Code:
[b]\s[/b]

that would allow me to simply exchange the \s - part for say, \clipboard or something like that? Is this correct?

2) The clipboard text is read into a variable that I must declare up front, then call the method to fill it with the clipboard content. Still correct?

3) How do I get this variable into the parentheses of AkelPad.ReplaceSel()?

4) And how do I squeeze all of the above into my toolbar entry?

Would you please point me to other rescources that deal with 3) and 4) in particular. I could not find help material that would close that gap.
Thank you.
Back to top
View user's profile Send private message
KDJ



Joined: 06 Mar 2010
Posts: 1577
Location: Poland

PostPosted: Tue Mar 31, 2015 8:20 pm    Post subject: Reply with quote

Akuro
We can use the standard script EvalCmd.js for evaluate this expression (JScript):
Code:
AkelPad.ReplaceSel("[b]" + AkelPad.GetClipboardText() + "[/b]");
Command for Hotkeys plugin:
Code:
Call("Scripts::Main", 1, "EvalCmd.js", `AkelPad.ReplaceSel("[b]" + AkelPad.GetClipboardText() + "[/b]");`)
Command for Toolbar plugin:
Code:
"Insert from clipboard" Call("Scripts::Main", 1, "EvalCmd.js", `AkelPad.ReplaceSel("[b]" + AkelPad.GetClipboardText() + "[/b]");`) Icon(9)

--------
Added:
Also you can save this expression in the file named eg. InsertFromClipboard.js (in directory ...\AkelPad\AkelFiles\Plugs\Scripts\) and use command:
Code:
Call("Scripts::Main", 1, "InsertFromClipboard.js")
Back to top
View user's profile Send private message
Akuro



Joined: 27 Mar 2015
Posts: 42

PostPosted: Tue Mar 31, 2015 8:43 pm    Post subject: Reply with quote

GREAT. This works exactly the way I had hoped for. Cool
Was able to modify it to meet my needs. Could have never pulled this off on my own. Really appreciating your help. Many thanks. Very Happy
Back to top
View user's profile Send private message
Instructor
Site Admin


Joined: 06 Jul 2006
Posts: 5867

PostPosted: Wed Apr 01, 2015 6:06 am    Post subject: Reply with quote

Akuro
Insert.js
Back to top
View user's profile Send private message Send e-mail
Akuro



Joined: 27 Mar 2015
Posts: 42

PostPosted: Wed Apr 01, 2015 7:01 am    Post subject: Reply with quote

Wow, that's even better. Surprised
Surpasses my expectations and opens up additional luxuries I didn't imagine possible.
THANK YOU.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AkelPad Forum Index -> Discussion (English) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


SourceForge.net Logo Powered by phpBB © 2001, 2005 phpBB Group