Search found 133 matches

by chinagreenelvis
27 Mar 2024, 01:30
Forum: Ask for Help (v2)
Topic: Getting the ID of a window created from running a .bat file? Topic is solved
Replies: 1
Views: 53

Re: Getting the ID of a window created from running a .bat file? Topic is solved

Nevermind, I see in the documentation for v2 there is &OutputVarPID in the run command.
by chinagreenelvis
27 Mar 2024, 01:18
Forum: Ask for Help (v2)
Topic: Getting the ID of a window created from running a .bat file? Topic is solved
Replies: 1
Views: 53

Getting the ID of a window created from running a .bat file? Topic is solved

I'm trying to figure out how to get the unique ID of the window that is made when AHK uses the run command pointing to a batch file. I'm anticipating circumstances in which other command windows may also be running and possibly active at the time, so just getting the active window or ahk_exe cmd.exe...
by chinagreenelvis
24 Mar 2024, 22:35
Forum: Ask for Help (v2)
Topic: INIRead Error Topic is solved
Replies: 4
Views: 75

Re: INIRead Error Topic is solved

Corrected and improved full INI creator script: #Requires AutoHotkey v2 SplitPath A_ScriptFullPath, &ScriptFileName, &ScriptDir, &ScriptExtension, &ScriptNameNoExt, &ScriptDrive INIFile := ScriptNameNoExt ".ini" INISettings := {} If not (FileExist(INIFile)) { INITop := ( "# Comment Line 1 `n" "# Com...
by chinagreenelvis
24 Mar 2024, 21:29
Forum: Ask for Help (v2)
Topic: INIRead Error Topic is solved
Replies: 4
Views: 75

Re: INIRead Error Topic is solved

Nevermind, I figured it out not realizing there was a fourth value to replace an error message: SetINI(OutPutVar, FileName, Section, Key, DefaultSetting := 0) { %OutPutVar% := IniRead(FileName, Section, Key, "ERROR") If %OutPutVar% := "ERROR" { IniWrite DefaultSetting, FileName, Section, Key %OutPut...
by chinagreenelvis
24 Mar 2024, 21:14
Forum: Ask for Help (v2)
Topic: INIRead Error Topic is solved
Replies: 4
Views: 75

INIRead Error Topic is solved

In v1, I had a great function for setting unset or missing INI settings which I'm trying to convert to v2: SetINI(OutPutVar, FileName, Section, Key, DefaultSetting := 0) { %OutPutVar% := IniRead(FileName, Section, Key) If not %OutPutVar% { IniWrite DefaultSetting, FileName, Section, Key %OutPutVar% ...
by chinagreenelvis
23 Mar 2024, 14:24
Forum: Ask for Help (v2)
Topic: Migrating custom compiler to v2 Topic is solved
Replies: 9
Views: 220

Re: Migrating custom compiler to v2 Topic is solved

Your variable is used, but Windows needs to know where the file name starts and ends. This can be addressed by adding quotation marks around the path. The documentation provides additional tips about quoting the parameter for Run. Unfortunately, the documentation doesn't seem to include an example ...
by chinagreenelvis
23 Mar 2024, 13:47
Forum: Ask for Help (v2)
Topic: Migrating custom compiler to v2 Topic is solved
Replies: 9
Views: 220

Re: Migrating custom compiler to v2 Topic is solved

Thanks, that's what I was looking for. Turns out my script does have some issues though, which I'm sorting out. Namely: For N, FileFullPath in A_Args { SplitPath FileFullPath, &FileName, &Dir, &Extension, &NameNoExt, &Drive SetWorkingDir Dir Run "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe /in ...
by chinagreenelvis
22 Mar 2024, 13:39
Forum: Ask for Help (v2)
Topic: Migrating custom compiler to v2 Topic is solved
Replies: 9
Views: 220

Re: Migrating custom compiler to v2 Topic is solved

I just need to know how to force "C:\Program Files\AutoHotkey\Compiler\Ahk2Exe.exe" to use the v2 base file and add that command into this script.
by chinagreenelvis
21 Mar 2024, 18:33
Forum: Ask for Help (v2)
Topic: Migrating custom compiler to v2 Topic is solved
Replies: 9
Views: 220

Migrating custom compiler to v2 Topic is solved

What is the command line to force the ahk compiler to use a specific base file? I'm migrating to v2 and I get errors that I'm only running v1. Here is my custom compiler code reworked for v2 language as far as I know (I assume nothing is wrong with the code, I'm just lacking a way to force the compi...
by chinagreenelvis
19 Mar 2024, 11:39
Forum: Ask for Help (v2)
Topic: Variables in WinGetList not working? Topic is solved
Replies: 2
Views: 72

Re: Variables in WinGetList not working? Topic is solved

I don't know what's more derpy, the fact that it's like that in the first place or that I anticipated needing spaces but didn't think about the one before the second ahk_class... thanks!
by chinagreenelvis
19 Mar 2024, 11:19
Forum: Ask for Help (v2)
Topic: Variables in WinGetList not working? Topic is solved
Replies: 2
Views: 72

Variables in WinGetList not working? Topic is solved

Okay, what am I doing wrong this time? As always, help is beyond appreciated. ;; A Windows Explorer window must be open #Requires AutoHotkey v2 ;; THIS ONE DOESN'T WORK: WinProcess := "explorer.exe" WinClass := "CabinetWClass" WindowList := WinGetList("ahk_exe " WinProcess "ahk_class " WinClass) For...
by chinagreenelvis
19 Mar 2024, 09:14
Forum: Ask for Help (v2)
Topic: Hooking window events?
Replies: 2
Views: 137

Re: Hooking window events?

I was able to get this working at least: HSHELL_WINDOWCREATED := 1 HSHELL_WINDOWDESTROYED := 2 Detector := Gui() DllCall("RegisterShellHookWindow", "UInt", Detector.Hwnd) Messenger := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK") OnMessage(Messenger, Recipient) Recipient(Message, ID, *) { If ...
by chinagreenelvis
18 Mar 2024, 21:27
Forum: Scripts and Functions (v1)
Topic: [Class] WinHook
Replies: 53
Views: 23438

Re: [Class] WinHook

Has anyone gotten this working in AHK 2?
by chinagreenelvis
18 Mar 2024, 20:36
Forum: Ask for Help (v2)
Topic: Hooking window events?
Replies: 2
Views: 137

Hooking window events?

Not sure why WM_CREATE and WM_DESTROY aren't working, but WM_DISPLAYCHANGE is? I just need a simple way to hook the following events from any program: new window opened/created, window closed, window maximized, minimized, restored. I'd like to avoid running a timer. #Requires AutoHotkey v2 Persisten...
by chinagreenelvis
15 Mar 2024, 04:25
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Reformatting my script from v1 to v2

@chinagreenelvis, depending on what the rest of your code does, it might be easier to use indeed. One downside is that it's more difficult to change the number of columns, as both monitor AND column info are tied together. Whether that matters to you depends on your code. I opted to change Maps to ...
by chinagreenelvis
14 Mar 2024, 19:23
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Dynamic Variable Creation

Depending on your intended use case, lots of nesting is not always the best answer. Having to create intermediate maps or arrays for every level of nesting can really complicate your code. Instead, you can merge multiple data into a single string the same way you would have generated a variable nam...
by chinagreenelvis
14 Mar 2024, 13:16
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Dynamic Variable Creation

In actuality you'd write some Loops to read monitor/column info and push them in the array. Starting on a simpler part first - what am I doing wrong here? I'm told MonRight is an invalid index for the MsgBox. Mon := [] Mon.Push([]) NumMonitors := SysGet(80) Loop NumMonitors { ActualN := MonitorGet(...
by chinagreenelvis
14 Mar 2024, 12:43
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Dynamic Variable Creation

Instead of

Code: Select all

Global Mon1Col1 := Map()
Mon%MonNum%Col%ColNumber%["X"] := WhateverVal
Would I just use

Code: Select all

MonCol := [[Map()]]
MonCol[MonNum][ColNumber]["X"] := WhateverVal
by chinagreenelvis
14 Mar 2024, 12:38
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Dynamic Variable Creation

Here's a link to the original code posted in a help thread:

viewtopic.php?p=563009#p563009
by chinagreenelvis
14 Mar 2024, 12:35
Forum: Ask for Help (v2)
Topic: Reformatting my script from v1 to v2
Replies: 26
Views: 768

Re: Dynamic Variable Creation

@chinagreenelvis, you can nest objects as much as you want: var := [[Map("Key", "someVariable")]] MsgBox var[1][1]["Key"] Perhaps you could show a certain scenario which you want to convert to v2? There might be even better alternatives available. Thanks, this might be what I'm looking for. Basical...

Go to advanced search