Submitted by carloscadu on 2020/05/20 17:23
 Hi,
 
I'd appreciate your help.
When I paste plain text URLs into IQ DocPane, they are pasted by default as plain text.
If I want IQ to format/parse the URL as a link (blue color, underlined, and actionable by clicking) I need to press manually "enter" key after every URL's line. And pressing "enter" when you have several URLs is time-consuming and eventually I will not perform that, ending up with an IQ document without formatted links. 
Is it possible to copy a URL from plain text and paste it already as a formatted/clickable URL link into IQ DocPane?
I performed some tests (screencast: https://bit.ly/36iFSRw) pasting the same links into Evernote/OneNote, and the URLs were pasted as formatted/clickable URL. So, I'm looking for the same behavior for IQ.
 
Thank you,
Carlos
 
 
 

Comments

Since you said you are running Autohotkey, try this as a hotkey for ^v or whatever key combo you want use for paste. When it detects a file path or a hyperlink on the clipboard, it adds html formatting around it and uses IQ's 'Paste special' command, option 3 - 'HTML', to paste an active link into any (?) IQ editing control. Otherwise it just sends ^v to the active window.
 
$^v::
    if (WinActive("ahk_exe InfoQube.exe")) {
       if (FileExist(Clipboard) or RegExMatch(Clipboard, "^(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$")) {
            Clipboard := "<a href=""" . Clipboard . """>" . Clipboard . "</a>"
            Sleep 30
            SendEvent +^v
            WinWaitActive, Paste Special..., , 1
            if !ErrorLevel
                SendEvent 3
            return
        }
    }
    SendEvent ^v
return

carloscadu

2020/05/21 09:05

In reply to by LeftEccoForIQ

 Hi @LeftEccoForIQ
 
Many thanks for sharing such a handy script!
It did work when the clipboard had a single URL.
However, if the clipboard has a set of URLs, or URLs + Text, the script didn't work.
Can you please confirm if the script is set to work only with the clipboard having single URL only?
If yes, do you know if AHK has the capability to parse several URLs or URLs+Text, converting them to formatted/clickable URL links?
 
Best,
Carlos

Hi Carlos,
 
Thanks. It was fun adapting the script. My previous version only worked when editing in the grid, this one now works for the item editor and the docs pane as well.
 
Yes, it is currently limited to the clipboard containing a single URL or file path only. I assume URLs are much more relevant than local file paths. I'm sure it could be adapted to handling multiple URLs embedded in text, e.g. by using parts of this script: www.autohotkey.com/docs/commands/LoopReadFile.htm#ExURL , though this is beyond my time budget ATM.
 
 

carloscadu

2020/05/21 16:33

In reply to by LeftEccoForIQ

[quote=LeftEccoForIQ]
Yes, it is currently limited to the clipboard containing a single URL or file path only. I assume URLs are much more relevant than local file paths. I'm sure it could be adapted to handling multiple URLs embedded in text, e.g. by using parts of this script: www.autohotkey.com/docs/commands/LoopReadFile.htm#ExURL , though this is beyond my time budget ATM.
[/quote]
 
Hi @LeftEccoForIQ,
Thanks for informing that the script also works with file paths. In my workflow both URL and File Path are equally valuable to be pasted as links. 
From the AHK information you sent I will try to investigate further the possibility to batch process links.
 
@Pierre_Admin
Could IQ be improved to parse multiple URLs, allowing pasting from plain text as formatted/clickable URL links into DocPane, same way Evernote/OneNote can do (https://bit.ly/36iFSRw)?
 
Cheers,
Carlos

It wasn't so time-consuming to get the script to handle any mix of text, URLs and file paths after all. I haven't done much testing, but it seems to work well at first glance. Not sure if it's necessary for it to remove all formatting from the clipboard, but it doesn't bother me. Here goes:
  
$^v::
if (WinActive("ahk_exe InfoQube.exe")) {
   
    if (RegExMatch(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*") or RegExMatch(Clipboard, "^(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$")) {

        Clipboard := Clipboard ;; removes formatting from clipboard - unnecessary?
       
        ;; turn file paths on clipboard into HTML links:
        if (RegExMatch(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*"))
            Clipboard := RegExReplace(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*", "<a href=$0>$0</a>")
   
        ;; turn URLs on clipboard into HTML links:
        if (RegExMatch(Clipboard, "^(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$"))
            Clipboard := RegExReplace(Clipboard, "(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?", "<a href=$0>$0</a>")
           
        Sleep 30
        SendEvent +^v
        WinWaitActive, Paste Special..., , 1
        if !ErrorLevel
            SendEvent 3
    } else
        SendEvent ^v
return
Enjoy!

carloscadu

2020/05/24 08:04

In reply to by LeftEccoForIQ

[quote=LeftEccoForIQ]
It wasn't so time-consuming to get the script to handle any mix of text, URLs and file paths after all. I haven't done much testing, but it seems to work well at first glance. Not sure if it's necessary for it to remove all formatting from the clipboard, but it doesn't bother me. Here goes:
[/quote]
 
Hi LeftEccoForIQ,
 
Thank you so much for developing further and sharing your handy script. Invaluable resource!
 
The script seems to be missing a closing curly brace }. I tried to add it, but couldn't find out the correct placement to make the script to work properly.
 
=> Could you please inform if (and where) there is the need of adding that curly brace } ?
 
Just sharing one of the main usage of your script in my workflow: to paste single/multiple webpage titles/URLs into InfoQube.
To copy the webpage titles/URLs into the clipboard, including batch copy of multiple tabs, I rely on the Chrome's extension CopyTabTitleUrl:
And here it follows a screencast illustrating the usage of CopyTabTitleUrl with IQ:  https://bit.ly/2yud77T
 
Cheers,
Carlos

LeftEccoForIQ

2020/05/24 10:53

In reply to by carloscadu

Sorry about the brace problem - I have more stuff in my own version so couldn't just use a 1:1 copy. This should be correct:
 
$^v::
    if (WinActive("ahk_exe InfoQube.exe") and (RegExMatch(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*") or RegExMatch(Clipboard, "^(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$"))) {

        Clipboard := Clipboard ;; removes formatting from clipboard - unnecessary?
       
        ;; turn file paths on clipboard into HTML links:
        if (RegExMatch(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*"))
            Clipboard := RegExReplace(Clipboard, "[a-z]:\\(?:[^\\/:*?""<>|\r\n]+\\)*[^\\/:*?""<>|\r\n]*", "<a href=$0>$0</a>")
   
        ;; turn URLs on clipboard into HTML links:
        if (RegExMatch(Clipboard, "^(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$"))
            Clipboard := RegExReplace(Clipboard, "(https?://|www\.)[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?", "<a href=$0>$0</a>")
           
        Sleep 30
        SendEvent +^v
        WinWaitActive, Paste Special..., , 1
        if !ErrorLevel
            SendEvent 3
    } else
        SendEvent ^v
return
HTH!

carloscadu

2020/05/27 10:41

In reply to by LeftEccoForIQ

 Hi LeftEccoForIQ,
 
My double thanks for the fixed script!
After experiencing with the last version of your AHK script, it does work without errors.
However, I'm able to paste/parse as 'active' links just single URLs from the clipboard.
When the clipboard has text and multiple URLs, I'm not able to make the script working, as shown in this screencast: https://bit.ly/3en9foA
As an example, I'm trying to paste as active links on IQ DocPane the following plain text content from a text editor:
 
What's New << | InfoQube
Is it possible to paste formatted/clickable URL links into IQ DocPane? | InfoQube
 
Is your script supposed to parse the content above?
 
Thank you, 
Carlos 

Hi. Are you sure you've updated your .ahk correctly to use the second version of the code? Your example works for me in the grid inline editor without any problems... (except in the document pane and item editor the links are highlighted but I can't click them - not sure if that's a problem with my config, but all the links do appear in blue/underline style). Also, is your Autohotkey version up to date? Could you also try with just Autohotkey and InfoQube running, no clipboard app etc.? Also try pasting into a grid item and the item editor rather than the document pane to see if it works there. Let me know what you find. Thanks!

KeithB

2020/05/28 20:45

In reply to by LeftEccoForIQ

[quote=LeftEccoForIQ]
s... (except in the document pane and item editor the links are highlighted but I can't click them - not sure if that's a problem with my config, but all the links do appear in blue/underline style)....
[/quote]
Nice script! It works perfectly in the document pane if you toggle the doc pane "view mode". Look in the manual  under "Browse mode", which I believe was the former name. The Ctrl+M shortcut is still accurate. to toggle.
As shown with the "view mode" highlighted, this is the "browse mode" and the hyperlink will work
 

I see. Thanks, Keith! Can you confirm that it works for you with text plus multiple URLs on the clipboard?

carloscadu

2020/05/31 09:24

In reply to by LeftEccoForIQ

 Hi,
 
Indeed, the script is working for me just when a single URL is on the clipboard.
I'm considering that another InfoQube clipboard issue may be messing with the script expected behavior.
I'm trying to isolate that issue about the default IQ clipboard, before trying the script again. 
This screencast (https://bit.ly/3gC8uKd) shows the clipboard issue in detail.
The problem is when I paste plain text into IQ DocPane, the line breaks are removed
I tried all paste special options: Unicode, Text, HTML.
When pasting, does the automatic removal of line breaks happen to you too?
Is there any setting that would make possible to paste plain text into IQ DocPane keeping the original formatting with the line breaks?
Does it sound that this clipboard issue can interfere with the script?
 
Thank you,
Carlos

KeithB

2020/05/31 12:18

In reply to by LeftEccoForIQ

[quote=LeftEccoForIQ]
Can you confirm that it works for you with text plus multiple URLs on the clipboard?
[/quote]
Strangely enough, I at first got exactly like Carlos, with no linebreaks at all. I then fiddled with the doc pane options, changing from IE10 to IE11 I think it was. 
Then I got line breaks to show in the doc pane, but there were no hyperlinks.
Once I got this far, I was unable to revert to get no linebreaks.
Even though there were no hyperlinks, manually going to the end of a hyperlink line and hitting enter in the doc pane made the hyperlink appear, and I could do this for everyline.
 
I'm suspecting it's something going on with the doc pane, more than the script.
 

carloscadu

2020/06/01 09:26

In reply to by KeithB

 Hi,
In DocPane options, I changed from IE10 to IE11. In my case, it didn't solve either the undesirable removal of line breaks or the script's output.
Do you know if the option "HTML Tags cleanup list" can affect the removal of line breaks? 
Thanks!
Carlos

Cyganet

2020/06/01 16:23

In reply to by KeithB

I see something similar going on, so perhaps the rendering of edit mode in the doc pane is wonky. When I add an existing markdown file to the doc pane using the doc pane Menu > File > Open > Open File, all the line breaks are missing in the text in edit mode. The markdown file itself still has them (as can be verified by opening it in a plain text editor).

And when you switch the doc pane to view mode, the markdown renders correctly, meaning that the line breaks are inside the document, otherwise the lines would all run together there as well. My doc pane options are as default, using IE 10.

carloscadu

2020/06/01 17:35

In reply to by Cyganet

 Thanks for the feedback Cyganet.
I performed further tests, as shown in this screencast: https://bit.ly/2zHSNRh
My DocPane options are as default as well, using IE 10.
I found some inconsistencies regarding the DocPane's line break handling:
  • I pasted text with line breaks on the DocPane, then copied the content again through both the Edit and View modes. In both cases, the text pasted from IQ into a text editor kept the line breaks (not seen on IQ), but adding new line breaks that didn't exist in the original content. 
  • I converted the DocPane content to "HTML File", and performed the same tests. The output was the same, having IQ adding more line breaks than the original content had when pasting into the text editor.
  • I also opened the "HTML File" from IQ using "Edit with Microsoft Word". The content was shown on MS Word without the line breaks, also presenting uneven spacing between the lines.

Cyganet

2020/06/01 17:56

In reply to by carloscadu

Hi Carlos,

I've been adding markdown files to my doc pane and seeing different results. When I open them with Notepad++ they all have line breaks. But when I ask Notepad++ to show me the EOL character, I see some have CR/LF (which is Windows standard) and they show up fine in the doc pane. Others have LF (which is Unix standard, and comes from documents that I created on my phone) and they show up as one paragraph in the doc pane. When I use Notepad++ to convert the LF to CR/LF, they now show up properly in the doc pane. Is it an option for you to do the EOL conversion?

Regards,
Cyganet

carloscadu

2020/06/01 18:23

In reply to by Cyganet

 Hi Cyganet,
 
I'm not used to EOL conversion.
I could find out how to handle it, but I'm wondering if for every plain text I paste on IQ I would need to perform such conversion using a third-party software in order to obtain consistent line breaks on IQ DocPane.
Considering all the different line breaks outputs showed on my previous tests (https://bit.ly/2zHSNRh), do you think IQ DocPane is presenting a strange behavior, or would it be expected?
 
Thanks,
Carlos

Cyganet

2020/06/01 18:51

In reply to by carloscadu

Hi Carlos,

I'm not an expert, but as far as I can tell, the CR/LF vs LF issue is at the operating system level, not specific to InfoQube, see for example this page.

If your text is being added via the autohotkey script, perhaps you (or Left?) can edit it to add `r `n characters between the multi-line entries? See for example here.

Regards,

Cyganet

carloscadu

2020/06/02 18:44

In reply to by Cyganet

Hi Cyganet,
Many thanks for all feedback!
Carlos

carloscadu

2020/06/04 09:21

In reply to by Cyganet

The v115f release fixed/improved most issues regarding the DocPane discussed in this thread:
- Specifically, the line breaks were being removed when plain text was pasted on the DocPane. Now the line breaks are there.
- Also, the "HTML File" opened using "Edit with Microsoft Word" had the content shown on MS Word without the line breaks and presenting uneven spacing between the lines. Now, no problem at all.
- The only issue that remains is when I copy the same text from IQ and paste it again into a text editor, there are new/additional line breaks that didn't exist in the original content.

--------------------------------
 
A note from Pierre:

[quote=Pierre_Admin]
(...) The CR on paste one took quite a bit of time to fix, it should have been noted. It isn't perfect though. For example, if you paste in a list (bullet / numbered), the paste should not go as it should
I'll add these to the release notes. (...)
[/quote]

--------------------------------
 
@LeftEccoForIQ, 
After those changes, your script (in my system) is still working for pasting single URLs on the grid. However, the URLs pasted on the DocPane are presented this way now:
 
 
--------------------------------
 
Best,
Carlos
How do I ?