Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Need help creating variable hotkeys that get the key names from a 2 letter file name


  • Please log in to reply
8 replies to this topic
cooljunk
  • Members
  • 19 posts
  • Last active: Oct 31 2015 08:03 PM
  • Joined: 22 Oct 2015

(meant to say that the files are 2 character files and that they are script files)

 

I'm trying to make something for our employees to use so that they dont have to alter the script itself to define hotkeys. This may only work for hotkeys which can be defined by a single character, but that's fine, as there are so many combinations that can be made with them, and they can be very easy to remember. The script would look only at 2 character AHK files (or 6 if you must the extention) in the working directory. And the variables it would search for could be defined with RegEx so for the first hotkey, it would look like ^. and then second would look like .(?=\.) Once a match is found, it would simply launch that matched file. Has something like this been done before? It seems so simple but I can't seem to find anything on it.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

Can you go more in depth about what you're looking for? I'm confused on 1) What kind of hotkeys you want (hotkeys or hotstrings?) and 2) Why you're using two letter file names to make them?

 

Would it be better if you use the Hotkey command in conjunction with a Gui, Hotkey control and reading/writing to a .ini file? In other words, have a script do this sequence:

 

1) Read your ini file. If it doesn't exist or hasn't defined the hotkey you want to know about then:

2a) Prompt your user to put in a hotkey combination using the Hotkey control for GUIs.

2b) Save that combination to the inifile.

3) Use the Hotkey command to make the hotkey active in your script.



cooljunk
  • Members
  • 19 posts
  • Last active: Oct 31 2015 08:03 PM
  • Joined: 22 Oct 2015

I suppose it would be both hotstrings and hotkeys. Any 2 character file name could become a hotstring and would be the same as the hotkey.

 

The user should only have to make file names, and avoid any sort of additional gui system or ini file. If an ini file or something absolutely must be made then it should be something that can be generated automatically.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

I mean, I guess you can parse a list of files using Loop, Files. Then take the file name and make them into hotstrings... Though I'm not entirely sure how you make dynamic hotstrings. Hotkeys you use the Hotkey command...

 

Well, if we do hotkeys, we can do a custom one by splitting the file name if it's two letters into it's keys. Then assigning it like so:

 

~%letterone% & %lettertwo%

 

Maybe. I haven't tested any of these ideas.

 

(Edit: http://autohotkey.co...mic-hotstrings/came back as a search result for dynamic hotstrings. Many years old and the link to download is 404'd, but within 16 pages of replies, it's possible someone mirrored the file or put it within a post.)



cooljunk
  • Members
  • 19 posts
  • Last active: Oct 31 2015 08:03 PM
  • Joined: 22 Oct 2015

I mean, I guess you can parse a list of files using Loop, Files. Then take the file name and make them into hotstrings... Though I'm not entirely sure how you make dynamic hotstrings. Hotkeys you use the Hotkey command...

 

Well, if we do hotkeys, we can do a custom one by splitting the file name if it's two letters into it's keys. Then assigning it like so:

 

~%letterone% & %lettertwo%

 

Maybe. I haven't tested any of these ideas.

 

(Edit: http://autohotkey.co...mic-hotstrings/came back as a search result for dynamic hotstrings. Many years old and the link to download is 404'd, but within 16 pages of replies, it's possible someone mirrored the file or put it within a post.)

 

Cool, thanks for finding those resources!

 

What do you think about this whole thing though? I think it would work great for not just our employees, but getting more script-illiterate people to use scripts and optimize their workflow. And it would even help people with knowledge of scripting as well. A lot of scripts are loaded manually and then wait for your response, rather than only being open when you actually want to use them. I think this makes so much sense. I'm surprised the only somewhat relevant topic on it is years old.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

I'll reserve my opinion until you have a working example of what you're trying to accomplish. Just because I don't think I understand the whole purpose of this thread to be quite honest.



cooljunk
  • Members
  • 19 posts
  • Last active: Oct 31 2015 08:03 PM
  • Joined: 22 Oct 2015

I'll reserve my opinion until you have a working example of what you're trying to accomplish. Just because I don't think I understand the whole purpose of this thread to be quite honest.

 

Sorry, I thought I was being clear.

 

Basically this is a way for "noobs" to easily load scripts in a way that is easy for them to remember.  You assign the shortcut to the script by editing the filename and essentially placing the shortcut in the file name itself. A script makes a list of all these files which have the shortcut in the name and it is always running and prepared to launch. It's a sort of script manager.



Exaskryz
  • Members
  • 3249 posts
  • Last active: Nov 20 2015 05:30 AM
  • Joined: 23 Aug 2012

I think it'll be easier for a novice to use a GUI honestly. Have a list of the files with descriptive names and make it so a single hotkey can launch the GUI and let people go from there. And/or have them able to launch their script manager from their desktop or something to decide which script they'd like to run.

 

To implement your idea of giving them hotkeys to work with, I still think using a Hotkey control to let them assign a hotkey associated with a file would be best so they can assign their scripts with something they find intuitive would be best.

 

This of course is simply going beyond Windows Explorer as a script manager. IDK if giving scripts to someone who doesn't know how to open files would be the best thing.



cooljunk
  • Members
  • 19 posts
  • Last active: Oct 31 2015 08:03 PM
  • Joined: 22 Oct 2015

I think it'll be easier for a novice to use a GUI honestly. Have a list of the files with descriptive names and make it so a single hotkey can launch the GUI and let people go from there. And/or have them able to launch their script manager from their desktop or something to decide which script they'd like to run.

 

To implement your idea of giving them hotkeys to work with, I still think using a Hotkey control to let them assign a hotkey associated with a file would be best so they can assign their scripts with something they find intuitive would be best.

 

This of course is simply going beyond Windows Explorer as a script manager. IDK if giving scripts to someone who doesn't know how to open files would be the best thing.

 

Well, this isn't about being the best thing, but the easiest and most accessible. Say someone finds a useful script from a legitimate source on the web. They can just right click, save as, enter the shortcut as two chracters for the file name, save to the folder which contains the script manager and use the script right away.