New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Choice.ahk #68

Closed
flyingaliens opened this Issue Oct 23, 2016 · 9 comments

Comments

Projects
None yet
2 participants
@flyingaliens

flyingaliens commented Oct 23, 2016

First of all, thanks a lot for the well-designed program (with good documentation). I am trying to create some 'templates' with field options. I've encountered some problems with running the script when the Choice plugin is used for more than once in the same snippet. Any ideas?

@lintalist lintalist added the bug label Oct 23, 2016

@lintalist lintalist self-assigned this Oct 23, 2016

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 23, 2016

Owner

First of all, thanks a lot for the well-designed program (with good documentation).

Thanks.

I am trying to create some 'templates' with field options. I've encountered some problems with running the script when the Choice plugin is used for more than once in the same snippet. Any ideas?

I just tried this myself and indeed it seems that snippets with multiple choice plugins fail. Going back to release v1.7 works so something went wrong when I made some changes to the v1.8+ release. I will investigate and solve this.

Edit: thanks for reporting it btw 👍

Owner

lintalist commented Oct 23, 2016

First of all, thanks a lot for the well-designed program (with good documentation).

Thanks.

I am trying to create some 'templates' with field options. I've encountered some problems with running the script when the Choice plugin is used for more than once in the same snippet. Any ideas?

I just tried this myself and indeed it seems that snippets with multiple choice plugins fail. Going back to release v1.7 works so something went wrong when I made some changes to the v1.8+ release. I will investigate and solve this.

Edit: thanks for reporting it btw 👍

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 23, 2016

Owner

Reverting back the loop (instead of the while) and an additional change to the new Random feature this seems to fix it. Download the fixed choice.ahk below. Close Lintalist and copy this to plugins\choice.ahk and overwrite the choice.ahk that is there. Start Lintalist and snippets with multiple plugins should work correctly again.

Edit: choice.zip alas not fully ready yet
will have to test this more I think...
Choice.zip

Owner

lintalist commented Oct 23, 2016

Reverting back the loop (instead of the while) and an additional change to the new Random feature this seems to fix it. Download the fixed choice.ahk below. Close Lintalist and copy this to plugins\choice.ahk and overwrite the choice.ahk that is there. Start Lintalist and snippets with multiple plugins should work correctly again.

Edit: choice.zip alas not fully ready yet
will have to test this more I think...
Choice.zip

@flyingaliens

This comment has been minimized.

Show comment
Hide comment
@flyingaliens

flyingaliens Oct 24, 2016

Thanks a lot for the prompt reply and effort.

I've tested your newer version, and it appears to work if the output is in notepad.exe. I couldn't get it to work within a flash textbox though (compared with Input where it worked beautifully). Will await your testing, and will see if I have time to debug the code too, but I guess you are probably more familar with the logic of the program.

flyingaliens commented Oct 24, 2016

Thanks a lot for the prompt reply and effort.

I've tested your newer version, and it appears to work if the output is in notepad.exe. I couldn't get it to work within a flash textbox though (compared with Input where it worked beautifully). Will await your testing, and will see if I have time to debug the code too, but I guess you are probably more familar with the logic of the program.

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 24, 2016

Owner

I couldn't get it to work within a flash textbox though

Is that a Flash edit control in a browser window or an edit control in the Adobe Flash (Animate CC) editor program? I'll see if I can download the Adobe Program. The Adobe program might not receive the "paste" command (the ^v shortcut).

( I've tested it the above fix all day and haven't run into any problems )

Edit: if you think it might be the snippet feel free to post an (edited, omitting private data) example so I can use that to test as well. But if it works in notepad the snippet is probably formatted fine.

Edit 2: What you could try is change the PasteDelay setting and increase it to say 750 (extreme value).
Right click on the tray icon, configuration, PasteDelay. If it is now being pasted correctly you can decrease the setting to 500 and try again and so on to find the smallest possible value that works.

SendMethod might be another setting to play around with.

Owner

lintalist commented Oct 24, 2016

I couldn't get it to work within a flash textbox though

Is that a Flash edit control in a browser window or an edit control in the Adobe Flash (Animate CC) editor program? I'll see if I can download the Adobe Program. The Adobe program might not receive the "paste" command (the ^v shortcut).

( I've tested it the above fix all day and haven't run into any problems )

Edit: if you think it might be the snippet feel free to post an (edited, omitting private data) example so I can use that to test as well. But if it works in notepad the snippet is probably formatted fine.

Edit 2: What you could try is change the PasteDelay setting and increase it to say 750 (extreme value).
Right click on the tray icon, configuration, PasteDelay. If it is now being pasted correctly you can decrease the setting to 500 and try again and so on to find the smallest possible value that works.

SendMethod might be another setting to play around with.

@flyingaliens

This comment has been minimized.

Show comment
Hide comment
@flyingaliens

flyingaliens Oct 25, 2016

I've re-tested the new Choice.ahk. The multiple choice function has no problems, even within a textbox within a Flash object (within a browser). Thanks a lot for the effort. The function is very helpful in creating templates.

The problem which I have encountered might be an issue with the specific Flash text editor (which is within an IEframe), as I could only correctly 'paste'/'send' the contents when I trigger the snippet using a keyboard shortcut. If I double-click from the menu, it does not work, my guess is that because somehow the program cannot capture the last active window and cursor position (may be related to CheckCursorPos()).

If you ever decide to add any enhancements to choice.ahk, it would be nice if one could add a title/remark to the choice box, because there may be similar choices for the same snippet, and it might be a bit challenging to remember which choice is which (e.g. A tiny/small/medium/large apple and a tiny/small/medium/large orange are placed into a bag).

Thanks once again. Very impressed with your program.

flyingaliens commented Oct 25, 2016

I've re-tested the new Choice.ahk. The multiple choice function has no problems, even within a textbox within a Flash object (within a browser). Thanks a lot for the effort. The function is very helpful in creating templates.

The problem which I have encountered might be an issue with the specific Flash text editor (which is within an IEframe), as I could only correctly 'paste'/'send' the contents when I trigger the snippet using a keyboard shortcut. If I double-click from the menu, it does not work, my guess is that because somehow the program cannot capture the last active window and cursor position (may be related to CheckCursorPos()).

If you ever decide to add any enhancements to choice.ahk, it would be nice if one could add a title/remark to the choice box, because there may be similar choices for the same snippet, and it might be a bit challenging to remember which choice is which (e.g. A tiny/small/medium/large apple and a tiny/small/medium/large orange are placed into a bag).

Thanks once again. Very impressed with your program.

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 25, 2016

Owner

The problem which I have encountered might be an issue with the specific Flash text editor (which is within an IEframe)

I've found a page with a similar flash control and indeed can confirm what you describe. The problem is that the flash control no longer has focus when you activate the Lintalist GUI so when it pastes the result it actually does paste, but as no control has focus it ends up nowhere.

It will not be possible to detect and set focus back to a flash control so I will add a note to the documentation that flash controls might cause problems and link to this discussion for a solution.

There is one solution you could already adapt and one that would have to be added to the program, both have their disadvantages.

1. PasteMethod = 2 setting (or 1)


There is a PasteMethod setting (see configuration). Set it to 1 or 2 and Lintalist will either try to paste or do nothing but it keeps the snippet in the clipboard. That allows you to manually paste it.
So the scenario would be: open Lintalist, select snippet one way or another so the Gui closes.
If you've set PasteMethod 1 the snippet will be pasted - say in notepad - but also kept in memory, if you are in your flash control it probably won' t be pasted so click the control first and then manually paste ^v

The disadvantage here is of course your current clipboard contents will not be available as it is replaced by the Snippet. If you use a Clipboard history/cache program you could still retrieve it.

2. Modify paste


Probably in includes/default.ahk (sendkey function) a check could be built-in to see if the active program is your Flash editor, if so don't paste but show a tooltip that the snippet can now be pasted by double clicking. That way Lintalist works everywhere as it is now, only in your specific Flash editor (I assume we can use the Page Title of the browser) it will skip the paste and start "a double click to paste routine".

I won't add it to Lintalist as it is such a specific issue so if you do make something you would probably have to add it each time you update Lintalist. (or just make default.ahk readonly so it is not overwritten during updates)

Owner

lintalist commented Oct 25, 2016

The problem which I have encountered might be an issue with the specific Flash text editor (which is within an IEframe)

I've found a page with a similar flash control and indeed can confirm what you describe. The problem is that the flash control no longer has focus when you activate the Lintalist GUI so when it pastes the result it actually does paste, but as no control has focus it ends up nowhere.

It will not be possible to detect and set focus back to a flash control so I will add a note to the documentation that flash controls might cause problems and link to this discussion for a solution.

There is one solution you could already adapt and one that would have to be added to the program, both have their disadvantages.

1. PasteMethod = 2 setting (or 1)


There is a PasteMethod setting (see configuration). Set it to 1 or 2 and Lintalist will either try to paste or do nothing but it keeps the snippet in the clipboard. That allows you to manually paste it.
So the scenario would be: open Lintalist, select snippet one way or another so the Gui closes.
If you've set PasteMethod 1 the snippet will be pasted - say in notepad - but also kept in memory, if you are in your flash control it probably won' t be pasted so click the control first and then manually paste ^v

The disadvantage here is of course your current clipboard contents will not be available as it is replaced by the Snippet. If you use a Clipboard history/cache program you could still retrieve it.

2. Modify paste


Probably in includes/default.ahk (sendkey function) a check could be built-in to see if the active program is your Flash editor, if so don't paste but show a tooltip that the snippet can now be pasted by double clicking. That way Lintalist works everywhere as it is now, only in your specific Flash editor (I assume we can use the Page Title of the browser) it will skip the paste and start "a double click to paste routine".

I won't add it to Lintalist as it is such a specific issue so if you do make something you would probably have to add it each time you update Lintalist. (or just make default.ahk readonly so it is not overwritten during updates)

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 25, 2016

Owner

If you ever decide to add any enhancements to choice.ahk, it would be nice if one could add a title/remark to the choice box,

Good idea. If the first item in the choice options starts with a question mark () it will be removed from the options but added as Text to the options Gui. So taking your example it should show Apple and Orange in the two Choice GUIs.

Testing Choice tip:
a [[choice=?Apple|tiny|small|medium|large]] apple and a [[choice=?orange|tiny|small|medium|large]] are placed into a bag.

As above, download the zip file, close Lintalist, overwrite choice.ahk in the plugins folder, start Lintalist and add the snippet above as a test.

Choice.zip

😃

Owner

lintalist commented Oct 25, 2016

If you ever decide to add any enhancements to choice.ahk, it would be nice if one could add a title/remark to the choice box,

Good idea. If the first item in the choice options starts with a question mark () it will be removed from the options but added as Text to the options Gui. So taking your example it should show Apple and Orange in the two Choice GUIs.

Testing Choice tip:
a [[choice=?Apple|tiny|small|medium|large]] apple and a [[choice=?orange|tiny|small|medium|large]] are placed into a bag.

As above, download the zip file, close Lintalist, overwrite choice.ahk in the plugins folder, start Lintalist and add the snippet above as a test.

Choice.zip

😃

@flyingaliens

This comment has been minimized.

Show comment
Hide comment
@flyingaliens

flyingaliens Oct 30, 2016

I've tested the new Choice.ahk, works with no problems. Thank you for the enhancement.

I am using PasteMethod = 1/2 to solve the specific issue I mentioned, seems to work so far with no problems. Thanks once again for your help.

Another method which works fine is to use keyboard hotkeys instead (which I have been using all along for other AHK scripts).

flyingaliens commented Oct 30, 2016

I've tested the new Choice.ahk, works with no problems. Thank you for the enhancement.

I am using PasteMethod = 1/2 to solve the specific issue I mentioned, seems to work so far with no problems. Thanks once again for your help.

Another method which works fine is to use keyboard hotkeys instead (which I have been using all along for other AHK scripts).

@lintalist lintalist added this to the v1.9 milestone Oct 30, 2016

@lintalist

This comment has been minimized.

Show comment
Hide comment
@lintalist

lintalist Oct 30, 2016

Owner

Thanks for testing!

Owner

lintalist commented Oct 30, 2016

Thanks for testing!

@lintalist lintalist closed this Oct 30, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment