Choosing from previously used values or new value every time a snippet is launched #231
Replies: 4 comments
-
Not perfectly but perhaps close enough. Two methods: 1 automatic increaseBelow part 1 and 2 of a snippet, it is uses a counter that automatically increases each time you call the snippet. If you want to reset the counter execute part 2 (shift+enter) in the lintalist gui Part 1:
Part 2:
2 automatic increase with choiceFirst we need a function to be able to prepare the options for choice, so add this to "plugins\myfunctions.ahk" and restart lintalist Range(in,max)
{
loop, % max
output .= StrReplace(in,"ID$",A_Index) "|"
return trim(output,"|")
} Part 2 is the same as above, but part 1 calls a function that will prepare a choice list, each time you call it the choices grow - note that "ID$" is a place holder for the A_Index in the function above. Part 1:
|
Beta Was this translation helpful? Give feedback.
-
Hmm, I might have described it badly. I am not looking to programmatically increment page numbers.
|
Beta Was this translation helpful? Give feedback.
-
In that case I think you would have to create a new plugin with a CombBox control - https://www.autohotkey.com/docs/commands/GuiControls.htm#ComboBox - the entered data
So don't clear PageChoices as you would normally do with other plugin variables, that way it should remember what has been entered so you can select it - as well as type/enter new data. Documentation:
|
Beta Was this translation helpful? Give feedback.
-
Is gui10 free to use to populate and destroy? I don't think there's any documentation on what numbers LL internally occupies - which might be helpful for others writing their own code/plugins. Thank you for the reply. I'll get to work on this over the coming weeks as its one of the two "wonderful" times of the year that I write exams, so time is extremely preoccupied. |
Beta Was this translation helpful? Give feedback.
-
Hello,
I am writing a template script to embed specific pages of a pdf-file into an open document.
The idea would be to have an initially empty choice-box, and insert the path of the file to be embedded. On subsequent calls, I want the previously used files to be a choice to choose from, or insert a new entry that's not yet present and use that instead.
assets/source1.pdf
first, hit enter, and go on writing the rest of my current text.assets/source2.pdf
, so I relaunch the snippet. I should see a choice box withassets/source1.pdf
as an option. I enterassets/source2.pdf
and press enterassets/source1.pdf
andassets/source2.pdf
as options , filter forassets/source1.pdf
and hit enter.Is something like this even possible?
Right now, I am just using the clipboard as a primitive storage, but considering that lintalist frequently muddies* the clipboard on my end, that's a very... fleeting solution. Especially because editing takes way more time than should be necessary.
Thank you,
Sincerely,
~Gw
* I know it technically shouldn't, paste method is set to 0. I have no clue why that happens, and after many hours of scanning through settings and bundles I don't know why. It happens regardless of what I am running, even on plain notepad with zero other programs or scripts. No clue why.
Edit 12.01.2022 12:09:11:
I don't need data persistency beyond a script-restart imo.
Beta Was this translation helpful? Give feedback.
All reactions