Search found 76 matches

by niczoom
29 Jul 2019, 22:05
Forum: Ask For Help
Topic: Hotkey repeating after key is released Topic is solved
Replies: 8
Views: 1425

Re: Hotkey repeating after key is released Topic is solved

I was having this issue again and stumbled on my own old thread I'd forgotten about, glad it helped me again :lol: :lol: !
by niczoom
06 Jul 2019, 02:17
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

Thanks Odlanir, I understand what you mean. What are your thoughts on my last post? Using log(-1) after each function to reset the log tab position? Also a base (tab of 0) would be indicated by log5(,A_ThisLabel "()") which would be used in user input areas eg: hot keys. This gets rid of z:=0 in eac...
by niczoom
05 Jul 2019, 21:28
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

; Alternate log style 2 ;{ #j:: log5(,A_ThisLabel "()") red() log5(-1) ; Reset log tab pos. back to 1 red() log5(-1) ; Reset log tab pos. back to 1 black() return #k:: log5(,A_ThisLabel "()") black() return red() { log5(0,A_ThisFunc "()") log5(1,"message1") log5(2,"message2") log5(2,"message2") log...
by niczoom
05 Jul 2019, 19:30
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

I ended up with this, which works: ; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ; ; Alternate log style #i:: red() red(-1) black(-1) return red(z := 0) { log5(z,A_ThisFunc "()") log5(1,"message1") log5(1,"message2") log5(0...
by niczoom
05 Jul 2019, 19:26
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

#i:: red() red(z:=-1) return red(z := 0) { log5(z,A_ThisFunc "()") log5(1,"message1") log5(1,"message2") log5(0,"message2") log5(1,"message3") log5(0,"message3") blue(1) } blue(z := 0) { log5(z,A_ThisFunc "()") log5(1,"message1") green(1) } green(z := 0) { log5(z, A_ThisFunc "()") log5(1,"message1"...
by niczoom
05 Jul 2019, 18:44
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

Thanks, Odlanir. I was trying to get away from using var z in every function, I do like your idea though which I will implement. There was another method that I linked to above ( here ), I don't know if you had a quick? It says: IndentedLoggerAdapter.push() and IndentedLoggerAdapter.pop() allow you ...
by niczoom
05 Jul 2019, 08:59
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Re: Logging Indentation

global fname := "C:\Users\Hardings\Documents\AutoHotkey\HTPC\log.txt" red() blue() run , %fname% ExitApp red() { log(A_ThisFunc "()") log("message", 1) log("message", 2) green() } blue() { log(A_ThisFunc "()") red() } green() { log(A_ThisFunc "()", 0) log("message", 0) log("message", 1) log("messag...
by niczoom
05 Jul 2019, 07:28
Forum: Ask For Help
Topic: Logging Indentation
Replies: 11
Views: 688

Logging Indentation

I log events in my program using the following method: global z:=0 red(z:=0) { log(z,A_ThisFunc "()") log(z+1,"message") log(z+2,"message") } blue(z:=0) { log(z,A_ThisFunc "()") red(z+1) } log(tabs,msg) { FormatTime vTimeStamp,, HH:mm:ss`.%A_MSec% ddd`, dd MMM yyyy vTimeStamp .= " :: " loop % numTab...
by niczoom
28 Jun 2019, 21:44
Forum: Ask For Help
Topic: Is there a simple and reliable way to process JSON data? Topic is solved
Replies: 48
Views: 3501

Re: Is there a simple and reliable way to process JSON data? Topic is solved

How about this: json= ( { "data":[ { "Name": "John", "phone": [ { "type": "home", "number": "212 555-1234" }, { "type": "mobile", "number": "123 456-7890" } ] }, { "Name": "Mike", "phone": [ { "type": "home", "number": "212 555-5678" }, { "type": "mobile", "number": "123 456-1234" } ] }] } ) #q:: ob...
by niczoom
28 Jun 2019, 18:38
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Thanks for the help. The last few comments have explained the A/W business well and I have a much better understanding of how AHK handles it and Ansii/Unicode in general.
by niczoom
28 Jun 2019, 08:29
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Thanks for the response, that's good to know. Process32First and Process32Next are some of the rare special cases. The Kernel32.dll exports two function names, one without a suffix for ANSI and one with the suffix W for Unicode. I suppose this knowledge comes with experience! As you mentioned this i...
by niczoom
28 Jun 2019, 05:59
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Im running v1.1.30.03 32-bit Unicode. At least, you are calling the ANSI versions of the functions (the names without the suffix W) That was the problem, I was oblivious to using Process32First & Process32Next when I should of been using the W - Unicode versions. I choose them because they were firs...
by niczoom
28 Jun 2019, 04:08
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

In saying that Lexikos when I use UTF-16 in my code below I get garbage returned in exeName := StrGet(&PE32+(A_PtrSize=4?36:44),"UTF-16") , is there something I need to change in relation to the zero-terminated string ? I'm missing something but its not obvious to me. ProcessSnapshot(ByRef ProcessIn...
by niczoom
28 Jun 2019, 00:36
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Thought I'd finished :) To get the filename I am returning the szExeFile member. I found out I needed to use StrGet so I typed in StrGet(&PE32,A_PtrSize=4?36:44,"Str") without looking it up in the help guide, I assumed it was to be in the same format as NumGet but turns out it wasnt .. Anyway I got ...
by niczoom
27 Jun 2019, 21:43
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Ahh, the penny has dropped ... finally :dance:. I don't know why I just didn't get it for a while :lol: ! Slow learner ...

Thanks for your help and patience.
by niczoom
27 Jun 2019, 04:53
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

ProcessSnapshot(pid) { log(tab(z)A_ThisFunc "()") TH32CS_SNAPPROCESS := "0x00000002" ;Includes all processes in the system in the snapshot. Static sizeofPE32 := A_PtrSize = 8 ? 568 : A_IsUnicode ? 556 : 296 if !(hSnapshot:=DllCall("CreateToolhelp32Snapshot","uint",TH32CS_SNAPPROCESS,"uint",th32Proc...
by niczoom
27 Jun 2019, 00:47
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

Thanks for the help! I have it working now. GetProcessThreadCount(ProcessID) { Static sizeofPE32 := A_PtrSize = 8 ? 568 : A_IsUnicode ? 556 : 296 threadCount := 0 hSnapshot := DLLCall("CreateToolhelp32Snapshot", "UInt", 2, "UInt", 0, "Ptr") ; TH32CS_SNAPPROCESS = 2 If (hSnapshot >= 0) { VarSetCapaci...
by niczoom
26 Jun 2019, 07:32
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

Re: VarSetCapacity & Struct size

A bit offtopic, but if you want to know the Process ThreadCount you can also use Thread32First / Thread32Next What I'm looking to do is find what child processes my AHK script had running. I found the Process32First function returned a PROCESSENTRY32W structure which contained the th32ParentProcess...
by niczoom
26 Jun 2019, 01:10
Forum: Ask For Help
Topic: VarSetCapacity & Struct size
Replies: 24
Views: 1673

VarSetCapacity & Struct size

I'm looking at using CreateToolhelp32Snapshot and found an example here GetProcessThreadCount(ProcessID) { Static sizeofPE32 := A_PtrSize = 8 ? 568 : A_IsUnicode ? 556 : 296 threadCount := 0 hSnapshot := DLLCall("CreateToolhelp32Snapshot", "UInt", 2, "UInt", 0, "Ptr") ; TH32CS_SNAPPROCESS = 2 If (hS...
by niczoom
23 Jun 2019, 01:58
Forum: Ask For Help
Topic: Problems with a Singleton class Topic is solved
Replies: 13
Views: 718

Re: Problems with a Singleton class Topic is solved

Thanks for the help! I have got it working now and have a better understanding of how classes/objects work. The below code is my working sample: class staticSingleton2 { static init := new staticSingleton2() __New() { static big if staticSingleton2.init { FileAppend __New return single instance`n,* ...

Go to advanced search