Now makes use of a common set of Sub-Macros to save and restore scroll position. These Sub-Macros can be used by other macros, which can contribute to, and make use of the saved Scroll Positions.
NOTE to users of @JMichaelTX's v1.1 version: Very shortly I will be introducing some new sets of macros that will make it extremely likely that either he or I will want to re-do his work. So for now, v2.0 of this macro does not include his changes. Hopefully that will change very soon.
This macro switches you between editing one macro and another. It saves and restores the vertical scroll position, so you don't have to keep scrolling around.
The scrolling is not instantaneous, but I think it's quick enough - you be the judge.
This is not the be-all and end-all solution. It's only good if you're switching back and forth, multiple times. If you are working on one macro and switch to another without using this macro, your scroll position is not saved.
I'd like to come up with a complete solution, but at this time, I can't think of one. Any ideas, feel free to share!
If you can think of a way to improve it, let me know. Especially, a way to save the scroll position before moving to another macro when not using using this macro. I don't think there's a way, but I sure wish there was!
Here’s my current philosophy, however I’ve been known to forget something every now and then, so if my code doesn’t match up to this, let me know:
If a macro does not fail, then I clean up every variable that needs to be cleaned up. If a macro fails, the Cleanup Variables section never gets called, which is fine by me, because I might want to look at the values.
With that said, I think you make a valid point. I’m not a fan of “DND__”, but I could live with it.
The real issue is traction - getting other people to follow the same standards. Well, maybe it’s not the issue - it doesn’t stop me from doing it. I’ll have to think about it.
And of course, this kind of discussion makes me wish I’d finish my code for determining what variables are created/used in a macro. If I could get that done, imagine what we could do. We could produce a list of all variables, and cross-reference them to the macros that create/use them. Wouldn’t that be totally cool?
Putting aside the prefix issue for the moment, my main request is to document which KM Variables must persist (not be deleted, like by the user when cleaning up his/her variable list).
Now, about the prefix. It does not matter so much what the prefix is, as it does to use a prefix, and hopefully in all macros. While I'd prefer there be one prefix we could all use, it is not required. Each macro developer could even have a prefix he/she uses. I like the "DND__" because it really jumps out at me when I view my KM variable list, but is hidden from the user in Prompt for Input. But that's just me. Use whatever you like.
Dan, again a great macro I'm already making good use of.
I found one thing more I'd like it to do, so here's my enhancement.
Please feel free to use or ignore as you see fit.
I tried to follow your style as best as I could determine it.
VER: 1.1 2016-08-12 By JMichaelTX
• ADD Option to select Macro to Switch To
• Simply hold down ("Long Press Key") either Trigger Key for at least 0.5 sec
• Use the arrow keys to highlight the macro, then press RETURN to select it.
MACRO: Toggle Between Macros and Maintain Scroll Position VER 1.1
#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/e/a/eaf57554ac4ec341a204440e97c0b59aa131677c.kmmacros">Toggle Between Macros and Maintain Scroll Position VER 1.1.kmmacros</a> (50 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**
---
![image|575x1999](upload://rygngVsfKR33QfAebmqGmtqQQk9.png)
I think this is exactly what I was hoping for. I’m just not positive the best way to use it, fingers, mouse, keyboard-wise.
Can you tell me the steps, for the long press? I know you hold down the keys for a half second. When the list pops up, what do you do? Scroll with the arrows and hit enter?
I just uploaded version 2.0 of this macro. Give me a little time to upload the remaining macros, then we can discuss re-incorporating your changes into the new version.
I didn't include your changes in this version, because I was fairly sure we'll want to re-work them, to some degree or another, in light of other macros I'll upload shortly. Maybe not, but let's see.
I'll get back to you soon. However, if I forget, hit me up again. And if I do forget, don't feel slighted - with everything rolling around in my head right now, some things are bound to roll right out my ears and drop on the ground. Especially after my fiasco yesterday...
It is due to localization troubles in AppleScript - as I use a French configuration - in the bidirectional conversion of numeric values <=> text, needed by KM only text variables, e.g. "0.7521263669501823" <=> "0,7521263669501823".
For a more localization bullet proof transcoding, I suggest to change beginning of AppleScript code of Macro Scroll Position - Store for Current Macro (Sub-Macro) to
I.e. the macro Toggle Between Macros and Maintain Scroll Position don't use macro Macro Scroll Position - Restore for Current Macro (Sub-Macro) of your zipped package.
I wish I could figure out how to get the list of macros that show up in the list you get when you click the “clock” icon. I don’t see that stored anywhere, at least not that I noticed.
Got any ideas?
BTW, good idea to wait for the dust to settle. I’m learning a bunch of new things today.
Oh, and I hope you notice, all of the macros I uploaded today use “DND__” in front of variables I want to persist. And it’s funny - the moment I actually started using the prefix, I loved it. I thought it was going to look fugly, but it doesn’t at all. Guess I should have given in a long time ago!
OK, what other suggestions have you made that I blew off?