kalekje / LNCHR-pub

MIT License
25 stars 4 forks source link

Hitting ctrl+l on the commands spreadsheet does not seem to generate LNCHR-Commands.ahk #4

Closed Avastgard closed 1 year ago

Avastgard commented 1 year ago

I'm trying to use the spreadsheet to manage my commands, but it doesn't seem to be generating a new LNCHR-Commands.ahk file with the added commands when I press Ctrl + L. Is there something I could be doing wrong?

Also, I would love to see some more documentation on how to use the sheet. It seems to be a great idea that's flying over my head.

kalekje commented 1 year ago

You have to ensure macros are enabled. If you had this appear, chances are the macro is blocked. You'll likely have to go to the "Trust Center" options and add the path. image I made the help tab with some descriptions of the categories. It shouldn't be too difficult to look at what is generated and figure it out.

Avastgard commented 1 year ago

Right, I had macros enabled from the start, but I was mistaken in that the new commands were not being added to LNCHR-Commands.ahk - they indeed are. What I forgot to do was to reload LNCHR-Main.ahk to have the new commands take effect. Is that step actually supposed to be manual?

Also, what do the letters in the Type column indicate? Do they have any influence in the actual code?

kalekje commented 1 year ago

Yes you have to reload the script--you can conveniently do so with a rel

kalekje commented 1 year ago

Yes the type affects the code that is generated. See the Help tab for an explanation on what each one does. Look into the Macro code as well, it's a short script. For categories, only the _work category affects the code, the rest are used for organization.

Avastgard commented 1 year ago

Thanks for the clarification.

only the _work category affects the code

Is it somehow possible to have the same command trigger different actions according to the category? E.g., could I type mail in my work computer and have it open outlook, and mail in my home computer and have it open my personal gmail? This is assuming I have the exact same script in both the work and home computers.

kalekje commented 1 year ago

Yes, that is exactly what _work is for. Notice in LNCHR-Main.ahk the line: UsingAnyWorkComputer := InStr(A_ComputerName, "xyz") == 1 ;

Set "xyz" to your work computer name.

The UsingAnyWorkComputer boolean is included in the output of the Excel macro's code. For example, in LNCHR-Commands.ahk, we see: if ((input == "cal") and (UsingAnyWorkcomputer)) ; Work Calendar { close_lngui()tryrun('"C:\Program Files\Microsoft Office\root\Office16\OUTLOOK.EXE" /recycle /select outlook:calendar') return }

The and (UsingAnyWorkcomputer is only added to _work categories.

An important caveat is that _work commands (if they overlap) must appear before the others.

In that same file, there is another "cal" command later on.

if input == "cal" ; Calendar {close_lngui()tryrun('https://www.google.com/calendar')return}

So cal opens my Outlook calendar on my work computer, but Google Calendar on my home computer.

Avastgard commented 1 year ago

Neat, this addresses one of the biggest issues I have with plul's code, which is having to change all file paths whenever I have to work on different computers, and thus having to maintain several versions of the script.

Another question: are there only two categories ("main work computer" and "any work computer") or could I create custom ones?

kalekje commented 1 year ago

The UsingMainWorkComputer is only used to change the title of the GUI. I have it this way because I often am at work, but remote in to other computers at work and it helps for me to see which LNCHR is being used. As of now, only UsingAnyWorkComputer affects the code. You are free to do as you wish with the code 🙂 but there isn't a clean way to make more of these conditionals without going into the Excel and ahk code.