Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Thank you. This seems very handy. I'll give it a try.
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
There is now a development branch available that replaces the Loop + Input with the Hotstring() - took me a while to implement.
It should work the same as before (hopefully) - this is a first step, once I'm confident this works as it should (e.g. the same) I can add other hotstring features as well by allowing the user to enter native hotstring features for example (:C:BTW, :*:etc)
https://github.com/lintalist/lintalist/issues/144#issuecomment-625394959
Do backup your bundles, I had a bug at some point that deleted snippets after using a hotstring...
It should work the same as before (hopefully) - this is a first step, once I'm confident this works as it should (e.g. the same) I can add other hotstring features as well by allowing the user to enter native hotstring features for example (:C:BTW, :*:etc)
https://github.com/lintalist/lintalist/issues/144#issuecomment-625394959
Do backup your bundles, I had a bug at some point that deleted snippets after using a hotstring...
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
"User-friendly" running text file list for choice plugin
Hello, I would very much appreciate any help regarding this problem I am having with implementing LL to achieve a certain process.
I am trying to have LL modify a text file before LL uses that text file in its "choice" plugin. However, I cannot seem to get this to work. My idea is that I have "Test.txt" being a user-friendly text file in which I can constantly add/edit list items (using line breaks to separate list items), and "Test - Modified.txt" being that same document but formatted for LL's "choice" plugin (i.e., the line breaks are replaced with "|" symbols). I figured the below would be one way to do this, but it is ultimately failing for me. The script generates "Test - Modified.txt" only after the LL choice plugin is run and not before it is run. So the choice plugin ultimately pulls up a blank choice list because Test - Modified.txt does not exist when the choice plugin is run. When I hit enter on that blank choice list, the list closes and only then is "Test - Modified.txt" finally created (but too late for the choice plugin to use).
Any help would be greatly appreciated. Alternatively, if anyone knows of an easier way to achieve a "user-friendly" running text file list, that is ultimately what I am trying to achieve. Thank you very much for any possible help.
The is the Script portion of my snippet:
This is Part 1 of the snippet:
I am trying to have LL modify a text file before LL uses that text file in its "choice" plugin. However, I cannot seem to get this to work. My idea is that I have "Test.txt" being a user-friendly text file in which I can constantly add/edit list items (using line breaks to separate list items), and "Test - Modified.txt" being that same document but formatted for LL's "choice" plugin (i.e., the line breaks are replaced with "|" symbols). I figured the below would be one way to do this, but it is ultimately failing for me. The script generates "Test - Modified.txt" only after the LL choice plugin is run and not before it is run. So the choice plugin ultimately pulls up a blank choice list because Test - Modified.txt does not exist when the choice plugin is run. When I hit enter on that blank choice list, the list closes and only then is "Test - Modified.txt" finally created (but too late for the choice plugin to use).
Any help would be greatly appreciated. Alternatively, if anyone knows of an easier way to achieve a "user-friendly" running text file list, that is ultimately what I am trying to achieve. Thank you very much for any possible help.
The is the Script portion of my snippet:
Code: Select all
#NoEnv
#SingleInstance, force
SetBatchLines, -1
ListLines, off
FileRead, TextVar, C:\Users\Gibbons\Desktop\Test.txt
TextForChoicePlugin := StrReplace(TextVar, "`r`n", "|") ; replaces line breaks with "|" symbols for LL's choice plugin
FileLocation = C:\Users\Gibbons\Desktop\Test - Modified.txt
FileDelete, %FileLocation%
FileAppend, %TextForChoicePlugin%, %FileLocation%
[[llpart1]] ; I expected this to cause the Part 1 snippet below to run LL's choice plugin with the list items in "Test - Modified.txt" but it fails to do so.
ExitApp
Code: Select all
[[Choice=!|[[File=C:\Users\Gibbons\Desktop\Test - Modified.txt]]]]
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
I can see how that would be useful and you would expect something like
to work, but it doesn't at the moment. I will think about how to allow it.
But there are some workarounds which you may or may not like.
1 - Using Split + File + Choice
Snippet:
This example works for 100 lines as we pass on a 100 SPs to choice. So if your text file is longer or much shorter you can edit the snippet
Drawback: if your text file has 10 lines, there will 90 empty entries in the Choice but as you start typing it filters as it should.
Notes to self:
- update choice to strip empty entries as they are pointless [see edit below]
- perhaps consider a wildcard [[sp=*]], or [[sp=all]] to avoid writing out such a long line of SPs above.
2 - Using many files: File + FileList
Create a folder where you place a number of text files, each one with one or more lines. The filenames will be what you search so they should make sense.
Lintalist-folder\MyFiles\directions to office.txt
Lintalist-folder\MyFiles\bbq recipe.txt
Lintalist-folder\MyFiles\etc.txt
Snippet:
You should see choice filled with
Lintalist-folder\MyFiles\directions to office.txt
Lintalist-folder\MyFiles\bbq recipe.txt
Lintalist-folder\MyFiles\etc.txt
Select one and File= should read it and paste it.
Note to self:
- consider a preview option/window for the FileList
3 - using a script
Note you use this in a local var (so place the script and use that as script code, that way you only have to update the script once in case you want to make changes)
Create a new snippet:
Part1 will be
test.txt
Your script:
Edit: if you want to use the 1 split + choice method above but avoid the empty entries insert the following code at https://github.com/lintalist/lintalist/blob/master/plugins/Choice.ahk#L44 - will be part of the next update so nothing is lost
Code: Select all
[[Choice=!|[[File=C:\Users\Gibbons\Desktop\Test - Modified.txt]]]]
But there are some workarounds which you may or may not like.
1 - Using Split + File + Choice
Snippet:
Code: Select all
[[Split=[[File=test.txt]]|\n]][[choice=!|[[sp=1]]|[[sp=2]]|[[sp=3]]|[[sp=4]]|[[sp=5]]|[[sp=6]]|[[sp=7]]|[[sp=8]]|[[sp=9]]|[[sp=10]]|[[sp=11]]|[[sp=12]]|[[sp=13]]|[[sp=14]]|[[sp=15]]|[[sp=16]]|[[sp=17]]|[[sp=18]]|[[sp=19]]|[[sp=20]]|[[sp=21]]|[[sp=22]]|[[sp=23]]|[[sp=24]]|[[sp=25]]|[[sp=26]]|[[sp=27]]|[[sp=28]]|[[sp=29]]|[[sp=30]]|[[sp=31]]|[[sp=32]]|[[sp=33]]|[[sp=34]]|[[sp=35]]|[[sp=36]]|[[sp=37]]|[[sp=38]]|[[sp=39]]|[[sp=40]]|[[sp=41]]|[[sp=42]]|[[sp=43]]|[[sp=44]]|[[sp=45]]|[[sp=46]]|[[sp=47]]|[[sp=48]]|[[sp=49]]|[[sp=50]]|[[sp=51]]|[[sp=52]]|[[sp=53]]|[[sp=54]]|[[sp=55]]|[[sp=56]]|[[sp=57]]|[[sp=58]]|[[sp=59]]|[[sp=60]]|[[sp=61]]|[[sp=62]]|[[sp=63]]|[[sp=64]]|[[sp=65]]|[[sp=66]]|[[sp=67]]|[[sp=68]]|[[sp=69]]|[[sp=70]]|[[sp=71]]|[[sp=72]]|[[sp=73]]|[[sp=74]]|[[sp=75]]|[[sp=76]]|[[sp=77]]|[[sp=78]]|[[sp=79]]|[[sp=80]]|[[sp=81]]|[[sp=82]]|[[sp=83]]|[[sp=84]]|[[sp=85]]|[[sp=86]]|[[sp=87]]|[[sp=88]]|[[sp=89]]|[[sp=90]]|[[sp=91]]|[[sp=92]]|[[sp=93]]|[[sp=94]]|[[sp=95]]|[[sp=96]]|[[sp=97]]|[[sp=98]]|[[sp=99]]|[[sp=100]]]]
Drawback: if your text file has 10 lines, there will 90 empty entries in the Choice but as you start typing it filters as it should.
Notes to self:
- update choice to strip empty entries as they are pointless [see edit below]
- perhaps consider a wildcard [[sp=*]], or [[sp=all]] to avoid writing out such a long line of SPs above.
2 - Using many files: File + FileList
Create a folder where you place a number of text files, each one with one or more lines. The filenames will be what you search so they should make sense.
Lintalist-folder\MyFiles\directions to office.txt
Lintalist-folder\MyFiles\bbq recipe.txt
Lintalist-folder\MyFiles\etc.txt
Snippet:
Code: Select all
[[File=[[FileList=!p|MyFiles\*.txt]]]]
Lintalist-folder\MyFiles\directions to office.txt
Lintalist-folder\MyFiles\bbq recipe.txt
Lintalist-folder\MyFiles\etc.txt
Select one and File= should read it and paste it.
Note to self:
- consider a preview option/window for the FileList
3 - using a script
Note you use this in a local var (so place the script and use that as script code, that way you only have to update the script once in case you want to make changes)
Create a new snippet:
Part1 will be
test.txt
Your script:
Code: Select all
/*
Based on Choice plugins
*/
#NoEnv
#SingleInstance, force
SetBatchLines, -1
ListLines, off
LLInit() ; fake call to load global variables from Lintalist main script - see Docs
ClipSet("s",1,SendMethod,Clipboard) ; store current clipboard contents
ClearClipboard()
SetTitleMatchMode, 2
[[llpart1]]
FileRead, PluginOptions, %llpart1%
PluginOptions:=StrReplace(PluginOptions,"`n","|")
Gui, 10:Destroy
Gui, 10:+AlwaysOnTop
Gui, 10:Default
Gui, 10:Add, Edit, x5 y5 w400 vChoiceFilterText gChoiceFilterText,
Gui, 10:Add, ListBox, xp yp+30 w400 R10 vItem, %PluginOptions%
Gui, 10:Add, button, vChoiceCancel gCancelChoice, &Cancel
Gui, 10:Add, button, xp yp default vChoiceOK gChoiceOK hidden, OK
Gui, 10:Show, w410, Search text file
ControlSend, ListBox1, {Down}, Search text file
Return
ChoiceFilterText:
ControlGetText, PluginsFilterText, Edit1, Search text file
Loop, Parse, PluginOptions, |
{
re:="iUms)" PluginsFilterText
if InStr(PluginsFilterText,A_Space) ; prepare regular expression to ensure search is done independent on the position of the words
re:="iUms)(?=.*" RegExReplace(PluginsFilterText,"iUms)(.*)\s","$1)(?=.*") ")"
if RegExMatch(A_LoopField,re)
PluginOptionsResults .= A_LoopField "|"
}
GuiControl, 10:, ListBox1, |%PluginOptionsResults%
PluginsFilterText:=""
PluginOptionsResults:=""
Return
CancelChoice:
Gui, 10:Destroy
ExitApp
Return
ChoiceOK:
Gui, 10:Submit,NoHide
If (item = "") ; if we didn't focus on results list while "typing to filter" in Choice it may return empty
{
ControlGet, item, List, Focused, ListBox1, Search text file
If InStr(item,"`n") ; we may get all the results of the "typing to filter" so asume we want first result
item:=Trim(StrSplit(item,"`n").1,"`n`r")
}
Gui 10:Destroy
Clipboard:=item
SendKey(SendMethod, ShortcutPaste) ; paste changed clipboard using SendMethod defined by Lintalist settings
Clipboard:=ClipSet("g",1) ; restore original clipboard contents
Sleep 500
ExitApp
Return
#IfWinActive, Search text file ahk_class AutoHotkeyGUI
Esc::ExitApp
Up::
SendMessage, 0x188, 0, 0, ListBox1, Search text file ; 0x188 is LB_GETCURSEL (for a ListBox).
PreviousPos:=ErrorLevel+1
ControlSend, ListBox1, {Up}, Search text file
SendMessage, 0x18b, 0, 0, ListBox1, Search text file ; 0x18b is LB_GETCOUNT (for a ListBox).
ItemsInList:=ErrorLevel
SendMessage, 0x188, 0, 0, ListBox1, Search text file ; 0x188 is LB_GETCURSEL (for a ListBox).
ChoicePos:=ErrorLevel+1
If (ChoicePos = PreviousPos)
{
SendMessage, 0x18b, 0, 0, ListBox1, Search text file ; 0x18b is LB_GETCOUNT (for a ListBox).
SendMessage, 390, (Errorlevel-1), 0, ListBox1, Search text file ; LB_SETCURSEL = 390
}
Return
Down::
SendMessage, 0x188, 0, 0, ListBox1, Search text file ; 0x188 is LB_GETCURSEL (for a ListBox).
PreviousPos:=ErrorLevel+1
SendMessage, 0x18b, 0, 0, ListBox1, Search text file ; 0x18b is LB_GETCOUNT (for a ListBox).
ItemsInList:=ErrorLevel
ControlSend, ListBox1, {Down}, Search text file
SendMessage, 0x188, 0, 0, ListBox1, Search text file ; 0x188 is LB_GETCURSEL (for a ListBox).
ChoicePos:=ErrorLevel+1
If (ChoicePos = PreviousPos)
SendMessage, 390, 0, 0, ListBox1, Search text file ; LB_SETCURSEL = 390 - position 'one'
Return
#IfWinActive
Edit: if you want to use the 1 split + choice method above but avoid the empty entries insert the following code at https://github.com/lintalist/lintalist/blob/master/plugins/Choice.ahk#L44
Code: Select all
PluginOptions:=RegExReplace(PluginOptions,"\|\|*","|",,,2)
Last edited by list on 09 May 2020, 04:26, edited 2 times in total.
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi list,
Thank you for the detailed reply. I think I may have also found an additional solution by creating a new plugin.
I created a plugin called FileChoiceFormat.ahk (based off File.ahk):
Then Part 1 of my snippet reads the following:
This seems to work properly but do you see anything that should be tightened up code-wise? (I'm quite an amateur)
Also, do you happen to know how I may be able to include my new plugin FileChoiceFormat in the "Plugins" menu list in the LL snippet editor along with the other standard plugins?
Thank you very much for all your help. LL is a wonderful program, jam packed with tonnes of functionality.
Thank you for the detailed reply. I think I may have also found an additional solution by creating a new plugin.
I created a plugin called FileChoiceFormat.ahk (based off File.ahk):
Code: Select all
/*
Plugin : FileChoiceFormat [based on LL's standard File.ahk plugin]
Purpose : Convert contents of file to Choice Plugin format, then inserts the contents of that formatted file
Version : 1.0
*/
GetSnippetFileChoiceFormat:
FileChoiceFormat= ; clear variable
FileRead, TextVar, %PluginOptions%
TextVar := StrReplace(TextVar, "`r`n", "|") ; replaces each line break in the text with a "|" symbol in order to format the text properly for LL's Choice plugin
PluginOptions = C:\Temp\TextFileFormattedForChoicePlugin.txt
FileDelete, %PluginOptions%
FileAppend, %TextVar%, %PluginOptions%
Loop ; get text from file that has now been formatted properly for LL's Choice plugin
{
If (InStr(Clip, "[[FileChoiceFormat=") = 0) or (A_Index > 100)
Break
If !InStr(PluginOptions,"|")
{
PluginOptions:=FixURI(PluginOptions,"txt",A_ScriptDir)
FileRead, PluginSnippetFile, %PluginOptions%
}
Else ; we have options, process select first if present
{
If (StrSplit(PluginOptions,"|").2 = "select") or (StrSplit(PluginOptions,"|").3 = "select")
{
PluginSelectedDir:=FixURI(StrSplit(PluginOptions,"|").1,"txt",A_ScriptDir)
FileSelectFile, PluginSelectedFile, 3 , %PluginSelectedDir%, Select your file to use, *.txt
If (ErrorLevel = 0) ; a file has been selected
FileRead, PluginSnippetFile, %PluginSelectedFile%
else
CancelPlugin:=1
}
If (StrSplit(PluginOptions,"|").2 = "clean") or (StrSplit(PluginOptions,"|").3 = "clean")
{
PluginOptions:=FixURI(PluginOptions,"txt",A_ScriptDir)
FileRead, PluginSnippetFile, %PluginOptions%
StringReplace, PluginSnippetFile, PluginSnippetFile, [, %A_Space%, All
StringReplace, PluginSnippetFile, PluginSnippetFile, ], %A_Space%, All
StringReplace, PluginSnippetFile, PluginSnippetFile, |, %A_Space%, All
}
}
StringReplace, clip, clip, %PluginText%, %PluginSnippetFile%, All
PluginSelectedDir:=""
PluginSnippetFile:=""
PluginOptions:=""
PluginText:=""
ProcessTextString:=""
}
FileChoiceFormat= ; clear variable
FileDelete, %PluginOptions%
Return
Code: Select all
[[Choice=!|[[FileChoiceFormat=C:\Users\Gibbons\Desktop\UserFriendyTextFileList.txt]]]]
Also, do you happen to know how I may be able to include my new plugin FileChoiceFormat in the "Plugins" menu list in the LL snippet editor along with the other standard plugins?
Thank you very much for all your help. LL is a wonderful program, jam packed with tonnes of functionality.
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Adding your own plugin is indeed a good idea - this would be the shortened version - note that you can use relative paths as well. Also you don't have to create a new file as that only slows things down - you should be able to use the code below directly.
Snippet would be:
FileChoiceFormat.ahk code
Adding this to the menu would require hard coding it into Lintalist at the moment, but it is a nice idea and I've prepared some code for the next version which will include a "create my plugins sub-menu" - if you want to add it already (backup lintalist.ahk just to be sure) insert the code below at line https://github.com/lintalist/lintalist/blob/master/lintalist.ahk#L2804 - save and restart lintalist. You should now have a "MyPlugins > Insert [[FileChoiceFormat=]]" submenu
Edit: for good measure I've updated the post earlier with a fix for empty choice entries (see edit)
Snippet would be:
Code: Select all
[[choice=!|[[FileChoiceFormat=test.txt]]]]
Code: Select all
/*
Plugin : FileChoiceFormat [based on LL's standard File.ahk plugin]
Purpose : Convert contents of file to Choice Plugin format, then inserts the contents of that formatted file
Version : 1.0
*/
GetSnippetFileChoiceFormat:
Loop ; get text from file that has now been formatted properly for LL's Choice plugin
{
If (InStr(Clip, "[[FileChoiceFormat=") = 0) or (A_Index > 100)
Break
PluginOptions:=FixURI(PluginOptions,"txt",A_ScriptDir)
FileRead, PluginOptions, %PluginOptions%
PluginOptions := StrReplace(PluginOptions, "`r`n", "|")
StringReplace, clip, clip, %PluginText%, %PluginOptions%, All
}
PluginOptions:=""
PluginText:=""
ProcessTextString:=""
FileChoiceFormat= ; clear variable
Return
Code: Select all
; create menu for your own plugins
FileRead, MyPluginsFile, %A_ScriptDir%\plugins\MyPlugins.ahk
{
MyPluginsMenu:=0
Loop, parse, MyPluginsFile, `n, `r
{
If RegExMatch(A_LoopField,"i)^#include")
{
If !MyPluginsMenu
MyPluginsMenu:=1
Menu, MyPlugins, Add, % "Insert [[" Trim(StrReplace(SubStr(A_LoopField,InStr(A_LoopField,"\",,0,1)+1),".ahk")," `n`t") "=]]", PluginMenuHandler
}
}
MyPluginsFile:=""
}
If MyPluginsMenu
{
Menu, Plugins, Add
Menu, Plugins, Add, &MyPlugins, :MyPlugins
}
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi list,
Thank you very much for the code refinement as well as the additional MyPluginsMenu code. These solve all issues and add the functionality I was looking to implement with LL.
A new unrelated issue I am experiencing involves the [[MD]] plugin and the insertion of an MD snippet into the bulleted list of a Microsoft Word document. Essentially, the insertion of the MD snippet causes the list in Word to break. Here is an example Part 1 snippet:
So, if I insert the Part 1 snippet "MDTextPastedFromLL" on a bulleted line in a Word document, LL creates a new and non-bulleted line and inserts the Part 1 snippet on this new non-bulleted line rather than the bulleted line where I intended to insert it. Example:
Bulleted list in Word document before MD plugin paste:
Bulleted list in Word document after MD plugin paste:
I presume this same issue would occur with a numbered list in Word but I have not confirmed it but can if you'd like.
Thank you for any help that you may be able to provide!
Thank you very much for the code refinement as well as the additional MyPluginsMenu code. These solve all issues and add the functionality I was looking to implement with LL.
A new unrelated issue I am experiencing involves the [[MD]] plugin and the insertion of an MD snippet into the bulleted list of a Microsoft Word document. Essentially, the insertion of the MD snippet causes the list in Word to break. Here is an example Part 1 snippet:
Code: Select all
[[md]]MDTextPastedFromLL
- Bullet1Text
- Bullet2Text {I want to append the Part 1 snippet immediately after the text "Bullet2Text" and on this same bullet line}
- Bullet3Text
- Bullet1Text
- {now a blank bullet}
- Bullet3Text
I presume this same issue would occur with a numbered list in Word but I have not confirmed it but can if you'd like.
Thank you for any help that you may be able to provide!
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
When you use Markdown, it is translated into HTML first to be able to paste it as "formatted text". So thinking about what markdown would do with a single line: it converts to html, which would make it <p>text you have in your snippet</p> e.g. a paragraph which would indeed add a new bullet - but it is MD actually needed? If you have a normal one line text snippet without new lines it should insert an empty bullet but just append/insert the text.
If you do need some formatting, use [[html]], that way you can be sure the <p>...</p> will be omitted and no empty bullet should appear, so
Should paste correctly in the bullet without adding a new line (it does so in Libreoffice anyway so I'm guessing it does so in Word)
If you do need some formatting, use [[html]], that way you can be sure the <p>...</p> will be omitted and no empty bullet should appear, so
Code: Select all
[[html]]this is my snippet, with some <b>bold</b> text ...
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi list. Your suggestion to use html worked perfectly in Microsoft Word. And thank you for the explanation regarding what's happening under the hood with the MD plugin.
I look forward to implementing more of LL in my daily tasks.
I look forward to implementing more of LL in my daily tasks.
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi list / all,
I'm experiencing an issue with LL. Every so often (and I don't know what causes it), when I run a LL hotkey/shorthand the appropriate snippet is not pasted. Rather, LL pastes what was originally in the clipboard prior to when I ran the the LL hotkey/shorthand. If I keep running the hotkey/shorthand, LL keeps just pasting what is in the clipboard and does not paste the snippet. Eventually, after some undetermined amount of time, LL reverts to its proper behaviour and pastes the snippet that was assigned to the LL hotkey/shorthand.
I thought perhaps this issue could involve the SendMethod or PasteDelay. I tried various configurations within those settings but it did not fix the problem. I have PasteMethod set at its default zero configuration value.
I appreciate any assistance in helping me troubleshoot this issue. Thank you
I'm experiencing an issue with LL. Every so often (and I don't know what causes it), when I run a LL hotkey/shorthand the appropriate snippet is not pasted. Rather, LL pastes what was originally in the clipboard prior to when I ran the the LL hotkey/shorthand. If I keep running the hotkey/shorthand, LL keeps just pasting what is in the clipboard and does not paste the snippet. Eventually, after some undetermined amount of time, LL reverts to its proper behaviour and pastes the snippet that was assigned to the LL hotkey/shorthand.
I thought perhaps this issue could involve the SendMethod or PasteDelay. I tried various configurations within those settings but it did not fix the problem. I have PasteMethod set at its default zero configuration value.
I appreciate any assistance in helping me troubleshoot this issue. Thank you
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Sometimes this happens for me too, I usually find that I have something large in the clipboard (lintalist stores, sets, pastes, restores the clipboard) - so it may help 'clearing' the clipboard by selecting single word and copy that.
I don't know if you use a clipboard manager, if so, that could also cause an issue as it tries to keep up with the changes in the clipboard. Many clipboard programs have a setting to "delay access" to the clipboard and it might be helpful to increase the time, usually in milliseconds. Combine that with various PasteDelay setting tests if it happens often, perhaps that fixes it.
A simple reload/restart of Lintalist might help as well.
If you do notice that it happens for particular snippets often ,and you mind your current clipboard being lost, you can add [[PasteMethod=1]] to the snippet, that should ensure the original clipboard isn't restored so the snippet is actually pasted as it should - see https://lintalist.github.io/#pastemethod-plugin (so there is a PasteMethod setting in the configuration to act as global setting, and you can define it per snippet using the PasteMethod plugin).
If you happen to notice it "always happens in this scenario" (combination of programs, workflow) feel free to post and there might be something I can try and fix.
I don't know if you use a clipboard manager, if so, that could also cause an issue as it tries to keep up with the changes in the clipboard. Many clipboard programs have a setting to "delay access" to the clipboard and it might be helpful to increase the time, usually in milliseconds. Combine that with various PasteDelay setting tests if it happens often, perhaps that fixes it.
A simple reload/restart of Lintalist might help as well.
If you do notice that it happens for particular snippets often ,and you mind your current clipboard being lost, you can add [[PasteMethod=1]] to the snippet, that should ensure the original clipboard isn't restored so the snippet is actually pasted as it should - see https://lintalist.github.io/#pastemethod-plugin (so there is a PasteMethod setting in the configuration to act as global setting, and you can define it per snippet using the PasteMethod plugin).
If you happen to notice it "always happens in this scenario" (combination of programs, workflow) feel free to post and there might be something I can try and fix.
Lintalist: website - source (github)
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
The recent versions of Windows 10 include a clipboard manager using Win+v to paste from a history list (if enabled). Even if it's not enabled, its presence seems to have slowed down the process of pasting, so issues like this occur much more often now with AHK scripts that restore the clipboard to its original value after pasting. Several people on the forum have noted the problem that it's pasting the original contents of the clipboard instead of what it's supposed to even though it's verified that the clipboard did contain the new contents before pasting. It has always been because of this issue, and it is fixed by simply adding a Sleep, 500 after pasting and before restoring the original clipboard contents. Making this modification to Lintalist should solve this problem as well.list wrote: ↑18 Jul 2020, 03:53Sometimes this happens for me too, I usually find that I have something large in the clipboard (lintalist stores, sets, pastes, restores the clipboard) - so it may help 'clearing' the clipboard by selecting single word and copy that.
I don't know if you use a clipboard manager, if so, that could also cause an issue as it tries to keep up with the changes in the clipboard. Many clipboard programs have a setting to "delay access" to the clipboard and it might be helpful to increase the time, usually in milliseconds. Combine that with various PasteDelay setting tests if it happens often, perhaps that fixes it.
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
@boiler in practice that is already happening https://github.com/lintalist/lintalist/blob/master/include/Default.ahk#L119 I send the paste, then sleep for the set PasteDelay time. I could create PasteDelay1 and PasteDelay2 e.g. sleep after setting the snippet as clipboard content before pasting, and a sleep after sending the paste command to wait before restoring the original clipboard. So like this:
Code: Select all
ClipSave:=ClipboardAll
Clipboard:=""
Clipboard:=Snippet
Sleep, PasteDelay1
Send, ^v
Sleep, PasteDelay2 ; current pastedelay setting
Clipboard:=ClipboardAll
ClipSave:=""
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi all,
I did some searching and found a discussion dealing with what I believe boiler was speaking about. User freespacing seems to have isolated the issue here and the community solution seems to be here that seems to attempt to minimize potentially wasted sleep time.
List, to answer some of your questions:
I did some searching and found a discussion dealing with what I believe boiler was speaking about. User freespacing seems to have isolated the issue here and the community solution seems to be here that seems to attempt to minimize potentially wasted sleep time.
List, to answer some of your questions:
- When the problem happens, it happens regardless of the size of what was originally in the clipboard
- When the problem happens, it will persist even if I restart/reload LL
- I do not use a clipboard manager but I do have the native Win10 clipboard manager feature (that boiler speaks about) in my Win10 version
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
The "sleep 500" would be setting PasteDelay to 500, 600 - so that should help if that is actually the solution. I don't think the "Control" method is that accurate, a webpage doesn't have a control for example so I don't see the advantage as such. Something very similar built-in already with SendMethod=4, see https://github.com/lintalist/lintalist/blob/master/include/Default.ahk#L112 (slightly different but still).
So I'll try with the Windows 10 clipboard turned on for a while and see what happens.
So I'll try with the Windows 10 clipboard turned on for a while and see what happens.
Lintalist: website - source (github)
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
I agree that the method where they monitor a control for a “safe paste” can lead to big problems when the window being pasted into doesn’t have identifiable controls. Having a hard delay would actually be safer across all cases.
I wasn’t aware that Lintalist had a Pastedelay property. That’s good forethought.
What I had learned from helping people on the forum that encountered this issue is that the extended clipboard functionality of Windows 10 didn’t even have to be enabled and people would still encounter the problem. I’m guessing that the pasting procedure takes longer now that the new feature exists whether it’s enabled or not. It may be that users with slower machines are more susceptible, so testing on a newer machine with a fast processor may not reveal the extent of the issue for all users.
I don’t really see a 500 to 600 ms delay as being a problem. Efforts to minimize that delay in the earlier linked thread seem unnecessary to me. When a user is manually pasting something, whether via Lintalist or their own script, that defines a point of human interaction where nothing needs to immediately happen after that. There won’t be anything else the script needs to accomplish in a few milliseconds after a human pressed a key to paste something. The user will have not selected and tried to copy new content into the clipboard within a fraction of a second after having pasted something. Nor would they try to paste the original clipboard contents within that time.
I wasn’t aware that Lintalist had a Pastedelay property. That’s good forethought.
What I had learned from helping people on the forum that encountered this issue is that the extended clipboard functionality of Windows 10 didn’t even have to be enabled and people would still encounter the problem. I’m guessing that the pasting procedure takes longer now that the new feature exists whether it’s enabled or not. It may be that users with slower machines are more susceptible, so testing on a newer machine with a fast processor may not reveal the extent of the issue for all users.
I don’t really see a 500 to 600 ms delay as being a problem. Efforts to minimize that delay in the earlier linked thread seem unnecessary to me. When a user is manually pasting something, whether via Lintalist or their own script, that defines a point of human interaction where nothing needs to immediately happen after that. There won’t be anything else the script needs to accomplish in a few milliseconds after a human pressed a key to paste something. The user will have not selected and tried to copy new content into the clipboard within a fraction of a second after having pasted something. Nor would they try to paste the original clipboard contents within that time.
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi all,
Just so I am clear, you're suggesting the potential solution to the problem may be setting the PasteDelay setting value to 500ms+? If so, I believe I already tried that and the pasting problem persisted but I will try again to confirm and I will report back whether the problem persists.
Thank you very much
Just so I am clear, you're suggesting the potential solution to the problem may be setting the PasteDelay setting value to 500ms+? If so, I believe I already tried that and the pasting problem persisted but I will try again to confirm and I will report back whether the problem persists.
Thank you very much
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
It's worth trying. Also, if you turn of the Windows 10 clipboard does the problem go away?
Lintalist: website - source (github)
-
- Posts: 31
- Joined: 07 Apr 2020, 11:53
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
Hi. I have always had my Win10 clipboard disabled, so like boiler said it seems the Win10 clipboard interferes with the LL/ahk paste regardless of whether it is enabled.
My understanding from the thread I linked to previously (link) and from what boiler said, the sleep needs to come after the paste. Doesn't the PasteDelay setting insert the pause before the paste? If that is the case, wouldn't we need something like the following?
Code: Select all
ClipSave:=ClipboardAll
Clipboard:=""
Clipboard:=Snippet
Sleep, PasteDelay1
Send, ^v
Sleep, 500 ; <=== Sleep after paste
Sleep, PasteDelay2 ; current pastedelay setting
Clipboard:=ClipboardAll
ClipSave:=""
Re: Lintalist 1.9 Searchable interactive lists to copy & paste text with plugins
That is already the case. The clipboard is stored, the clipboard is emptied, the snippet is processed, the clipboard is set to the result of the snippet after processing plugins, then the paste command is sent and THEN the paste delay, so in code this already happens (scattered throughout the script due to the many options available (formats, cancellations etc).
You can see that in the line I linked to above, the sendkeys are ABOVE the Sleep PasteDelay. So paste, sleep, restore. Apparently it still manages to paste the restored clipboard content in your case which is annoying. It rarely happens for me so that makes it hard to debug.
Is it always in the same program you try to paste into, perhaps Word for example? Some programs also monitor the clipboard, I believe Word or other office apps can do too and show a history - perhaps you can disable it, I found this as an example https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-disable-office-2016-office-clipboard/162d0d95-9054-4eee-b543-bced2b5ddc8d
Code: Select all
ClipSave:=ClipboardAll
Clipboard:="" ; the clipboard has no contents, not possible as it is empty.
; process snippet
Clipboard:=Snippet
Send, ^v ; or whatever is defined as "paste keys"
Sleep, PasteDelay ; this is what happens, the say 500ms you tried - so this should be ample time to paste
Clipboard:=ClipboardAll
ClipSave:=""
Is it always in the same program you try to paste into, perhaps Word for example? Some programs also monitor the clipboard, I believe Word or other office apps can do too and show a history - perhaps you can disable it, I found this as an example https://answers.microsoft.com/en-us/msoffice/forum/all/how-to-disable-office-2016-office-clipboard/162d0d95-9054-4eee-b543-bced2b5ddc8d
Lintalist: website - source (github)