-
Notifications
You must be signed in to change notification settings - Fork 1
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
Renamed variables/functions #5
Comments
:OOOOOOOOOOOOOOOOOOOOO LEXICOS thank you for giving me hope (I needed it again) for this project I'll write(replies) about the code tomorrow |
so before, I was doing 7eca656#diff-5ba5444a568db9aa720762591b0381021e9e66d0d39fa92089e7841cad4401b2R88 //https://www.autohotkey.com/v2/v2-changes.htm#built-in-variables
renameVar('a_loopfilefullpath','A_LoopFilePath')
renameVar('a_loopfilelongpath','A_LoopFileFullPath')
renameVar('clipboard','A_Clipboard')
renameVar('comspec','A_ComSpec') functions. currently I'm doing functions manually because I expected them to be much different if (thisLowered === 'varsetcapacity') {
//#function
if (getArgs()) { return 2 }
if (argsArr.length === 1) {
// VarSetCapacity(TargetVar)
// TargetVar.Size
a(1); p('.Size'); s()
} else {
// VarSetStrCapacity(TargetVar, RequestedCapacity, FillByte)
// TargetVar:=BufferAlloc(RequestedCapacity,FillByte)
a(1); p(':=BufferAlloc('); a(2); o(',',3); a(3); p(')'); s()
}
} I kinda need a priority for functions to convert, which ones do I do first ? |
Find scripts which need conversion that isn't done yet, fix the conversion, test, repeat. I think I would find that approach more motivational than prioritizing a list and working through it. It's good to regularly see your work paying off. |
the reason I started using v2 was a coincidence, I "needed?" multithreading for ahk_explorer FuPeiJiang/ahk_explorer#6, I wanted to try AHK_H, decided to also try v2 at the same time, so AHK_H v2, I started using WinClip.ahk, and decided to use v2, so I had to convert it using v2, at the start, I used many RegExReplace(), worked, but didn't work perfectly. I successfully did that, and now I have nothing that I want to convert. I ran out of reasons to convert v1 to v2 v1 vs v2
vs
somehow, the one with
global could be helpful for large scripts but I'm also using typescript for no reason(for a challenge I guess, AND because people are using it, and I like to use the newest). It helped me only Some times, on minor things. typescript: I learned project management, I gave myself another puzzle my v1 scripts work, and they look nicer. why convert ? |
v2 function call without () is cool |
This might not be the best place for such a discussion...
I disagree. Using braces with hotkeys means that you do not need return, which means less typing. The open brace can be placed on the same line as the hotkey, so it does not even require more lines. There are also several other advantages. For small scripts, the cost of "more typing" is proportionately small. Small scripts can still be affected by common points of confusion in v1. Authors are still required to take into account the syntax inconsistencies, whatever size the script is.
In v1? Unlike v1, there is no need to declare global variables inside functions in v2 if they are only being read. If the hotkey modifies a global variable it must be declared, which requires more typing as you say, but carries the benefits of showing clearly which global variables a hotkey might modify and reducing unintentional sharing of variables.
I might convert my main hotkey scripts so that when I add new hotkeys, I'm not forced to use v1 syntax, and I'm able to take advantage of features unique to v2. It's not worth converting manually because it would be much more work than simply continuing to use v1 syntax, given that I don't change these scripts often. Others might argue that having decent automatic conversion (even if it can't be 100%) might reduce the resistance for some users to upgrade. I intend to create tools for this myself, as v2 scripts. |
why not ? because it's outside the scope of this github issue? is there a better place ?
wow I didn't know that, it's way quicker $f1::{
send "^c"
sleep 100
A_Clipboard:=StrLower(A_Clipboard)
send "^v"
} I should edit my converter
it may be because I'm using AHK_H v2, which hasn't been up to date var:=1
$f1::{
msgbox var
} Warning: This variable appears to never be assigned a value. Specifically: local var (same name as a global)
this made me remember this
string manipulation in ahk is harder, that's why I chose javascript, and it can be on website |
That depends on whether you would welcome alternative opinions. Here, your comments have low visibility; i.e. they (and my responses) will likely be seen only by someone who is interested in this Issue. If you are interested in sharing or testing your opinion and maybe learning something new, you are likely to get more input by posting on the autohotkey.com forums.
Right. It is a reasonably recent change.
vscode-autohotkey-debug by zero-plusplus supports both versions. There is very little reason that any debugger client would support only one version, since they both use the same protocol. |
should it be in
I'll keep that in mind vscode-autohotkey-debug by zero-plusplus:
sorry, didn't look if there were any debugger for v2, I'm using AutoHotkey Plus Plus by Mark Wiemer
well, it's running my v2 thanks for this extension
why does it need separate extensions ? zero-plusplus/vscode-autohotkey-debug#90
then they say they'll be using Tree-sitter, I'll see what this is |
Just set the In my case, the default path is There's no official installer yet for v2, and therefore no official path.
I don't know why the debug extension needs a language extension, but if you don't have a language extension, you won't have syntax highlighting or other language support that is unrelated to the debugger. |
Some variables and commands/functions exist in both versions, but have been renamed. You may find lists in v2-changes under "Renamed:". (In some cases the usage has also changed.)
For example, A_LoopFileFullPath was renamed to A_LoopFilePath and A_LoopFileLongPath was renamed to A_LoopFileFullPath. If left as is,
A_LoopFileFullPath
is now actually the full path (whereas before it could be relative) and is case-corrected, whileA_LoopFileLongPath
is undefined.Or is this outside the scope of this script? How complete is the conversion intended to be? As much as feasible?
The text was updated successfully, but these errors were encountered: