Search found 59 matches

by madsounds
31 May 2020, 11:01
Forum: Ask for Help (v2)
Topic: Is "new" removed from AHK2? Topic is solved
Replies: 4
Views: 1232

Is "new" removed from AHK2? Topic is solved

I've just launched this code on AHK2 class MyClass { __New( important_variable ) { this.important_variable := important_variable } } myobj := new MyClass( 'test' ) MsgBox myobj.important_variable And it says, "Call to nonexisting function", on the line myobj := new MyClass( 'test' ) . So is "new" re...
by madsounds
23 May 2020, 01:56
Forum: Ask for Help (v1)
Topic: Is there way to get .NET checkbox state?
Replies: 1
Views: 245

Is there way to get .NET checkbox state?

When I run

Code: Select all

ControlGet, var, Checked,, control_class_here, ahk_exe SomeExeHere.exe
for a .NET application, var is always set to 0 (unchecked). Is there any method to get such ckeckbox state?
by madsounds
21 May 2020, 06:28
Forum: Ask for Help (v2)
Topic: "For" is not working properly in AHK 2 Topic is solved
Replies: 4
Views: 1260

Re: "For" is not working properly in AHK 2 Topic is solved

Oh I've just discovered that this is a feature of DefineMethod described here: https lexikos.github.io /v2/docs/objects/Object.htm#DefineMethod The function must accept at least one parameter, which receives a reference to the target object of the method call. This parameter is defined automatically...
by madsounds
21 May 2020, 04:19
Forum: Ask for Help (v2)
Topic: "For" is not working properly in AHK 2 Topic is solved
Replies: 4
Views: 1260

Re: "For" is not working properly in AHK 2 Topic is solved

Thank you man! Number 3 is the best one. I know that this solution is kinda dirty, but anything is better than writing Map( aa, bb, cc, dd ) instead of old good { aa: bb, cc: dd } . But still I don't understand how do work parameters in that line: Object.Prototype.DefineMethod( "__Enum", (this, Numb...
by madsounds
17 May 2020, 21:58
Forum: Ask for Help (v2)
Topic: "For" is not working properly in AHK 2 Topic is solved
Replies: 4
Views: 1260

"For" is not working properly in AHK 2 Topic is solved

In new AutoHotkey 2, I'm not able to use "for" :| Look at this code: aaa := { a: 1, b: 2 } for k, v in aaa { MsgBox k } This throws an error! It says, "Type mismatch". Error: Type mismatch. Specifically: __Enum Line# 001: aaa := { a: 1, b: 2 } 006: For k,v in aaa 007: { 008: MsgBox(k) 009: } 010: Ex...
by madsounds
10 Nov 2019, 19:22
Forum: Ask for Help (v1)
Topic: How to SendInput without triggering hotkeys Topic is solved
Replies: 3
Views: 2833

Re: How to SendInput without triggering hotkeys Topic is solved

gregster wrote:
10 Nov 2019, 16:59
Usually, the $ modifier should suffice:
https://www.autohotkey.com/docs/Hotkeys.htm#Symbols wrote:$
This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself. [...]
Thank you, $ is another option!
by madsounds
10 Nov 2019, 16:44
Forum: Ask for Help (v1)
Topic: How to SendInput without triggering hotkeys Topic is solved
Replies: 3
Views: 2833

Re: How to SendInput without triggering hotkeys Topic is solved

I just solved it by adding the #InputLevel 1 directive!

Code: Select all

#InputLevel 1

^r::

	if( ! WinActive( "ahk_exe WINWORD.EXE" ) )
	{
		SendInput, ^r
		return
	}
	
	Run, ...

	return
by madsounds
10 Nov 2019, 16:16
Forum: Ask for Help (v1)
Topic: How to SendInput without triggering hotkeys Topic is solved
Replies: 3
Views: 2833

How to SendInput without triggering hotkeys Topic is solved

When I use the following code, the script goes into recursion. ^r:: if( ! WinActive( "ahk_exe WINWORD.EXE" ) ) { SendInput, ^r return } Run, ... return How can I pass key presses invisibly to AutoHotkey, i.e. without false triggering? I tried to set different SendLevel values, but it did not affect.
by madsounds
10 Nov 2019, 15:42
Forum: Ask for Help (v1)
Topic: The is operator does not count 0 as an integer Topic is solved
Replies: 6
Views: 1140

Re: The is operator does not count 0 as an integer Topic is solved

Oh I see now :o It turns out that it is the "if ... is integer", without brackets. Because brackets (or anything else like MsgBox) form an expression. And this example will work: IsInteger( var ) { if var is integer { return true } else { return false } } MsgBox, % IsInteger( 0 ) But that one will n...
by madsounds
09 Nov 2019, 21:18
Forum: Ask for Help (v1)
Topic: The is operator does not count 0 as an integer Topic is solved
Replies: 6
Views: 1140

The is operator does not count 0 as an integer Topic is solved

If you write

Code: Select all

MsgBox, % StrLen( "" ) is integer
or just

Code: Select all

MsgBox, % 0 is integer
, AHK will output false. In my opinion, this is an error. For other programming languages 0 is considered an integer number.
by madsounds
01 Oct 2019, 09:03
Forum: Ask for Help (v1)
Topic: Ctrl+W doesn't work after Chrome browser is focused Topic is solved
Replies: 5
Views: 1050

Re: Ctrl+W doesn't work after Chrome browser is focused Topic is solved

Getfree wrote:
01 Oct 2019, 08:10
I wish more people knew about Chrome extensions. They would save countless ours of tedious coding by using the right tools for the job.
To be honest, I rarely assume that Chrome extensions are able to operate outside the browser :) Thank you, I'll try it!
by madsounds
01 Oct 2019, 05:59
Forum: Ask for Help (v1)
Topic: Ctrl+W doesn't work after Chrome browser is focused Topic is solved
Replies: 5
Views: 1050

Re: Ctrl+W doesn't work after Chrome browser is focused Topic is solved

I have tested it, and now Chrome window is activated in 100% of cases. If anyone is interested, here is the full code (in the URL, replace underscores '_' with slashes '/'). This script launches Google search with the text you selected (in Word, Notepad, anywhere, even from the Chrome itself): #NoEn...
by madsounds
01 Oct 2019, 05:44
Forum: Ask for Help (v1)
Topic: Ctrl+W doesn't work after Chrome browser is focused Topic is solved
Replies: 5
Views: 1050

Re: Ctrl+W doesn't work after Chrome browser is focused Topic is solved

pid is a variable name in your code - to reference its contents with winwait or winActivate, you will have to put it between %s or force an expression. Yes, of course! I should have taken that into account. Also, if I see it correctly, your use of run doesn't correspond to the docs. Obviously, it i...
by madsounds
30 Sep 2019, 03:41
Forum: Ask for Help (v1)
Topic: Ctrl+W doesn't work after Chrome browser is focused Topic is solved
Replies: 5
Views: 1050

Ctrl+W doesn't work after Chrome browser is focused Topic is solved

I'm using this code: ^g:: Clipboard := "" SendInput, ^c ClipWait, 0.5 if( ErrorLevel ) { return } Run, % "https www.google.ru search?q=" . UriEncode( trim2( Clipboard ) ),, pid WinWait, ahk_pid pid WinActivate, ahk_pid pid It works fine, Chrome window is activated (even without WinWait+WinActivate)....
by madsounds
06 Aug 2019, 13:48
Forum: Scripts and Functions (v1)
Topic: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No IE!
Replies: 668
Views: 463067

Re: [Library] Chrome.ahk - Automate Google Chrome using native AutoHotkey. No Selenium!

Hi, I'm using some site that periodically opens new tab. But when new tab is opening, Chrome is stealing the focus. And even if Chrome is minimized, it restores the window. So is it possible to prevent Chrome from stealing focus? Or maybe there's way to launch Chrome hidden? I know there's AHK comma...
by madsounds
28 Jul 2019, 06:49
Forum: Ask for Help (v1)
Topic: Time substracting bug Topic is solved
Replies: 2
Views: 452

Re: Time substracting bug Topic is solved

Thank you alot, it works! :dance: :clap: :bravo:
by madsounds
28 Jul 2019, 04:54
Forum: Ask for Help (v1)
Topic: Time substracting bug Topic is solved
Replies: 2
Views: 452

Time substracting bug Topic is solved

This code was working today, but then I changed something (or not), and it started to show errors: https pastenow.ru /689RD This is current version: #NoEnv gmt_time := A_Now gmt_time -= 3, hours FormatTime, rss_time, gmt_time, ddd, dd MMM yyyy HH:mm:ss 'GMT' MsgBox, % rss_time The purpose is to form...
by madsounds
01 Jun 2019, 04:36
Forum: Ask for Help (v1)
Topic: Error using 'run' Topic is solved
Replies: 2
Views: 635

Re: Error using 'run' Topic is solved

tmplinshi wrote:
31 May 2019, 09:39
So you could try:

Code: Select all

RunWait C:\Windows\SysWOW64\wscript.exe D:\Downloads\create_script_control_obj.js
Yes, it works! Thank you very much! You saved my 1500 lines scripts :D
by madsounds
31 May 2019, 08:27
Forum: Ask for Help (v1)
Topic: Error using 'run' Topic is solved
Replies: 2
Views: 635

Error using 'run' Topic is solved

Hey there! When I start my main.ahk , it gives an error message. The main.ahk is just launching a Windows Script Control (WSH) script, the code is: RunWait C:\Windows\System32\WScript.exe D:\Downloads\create_script_control_obj.js Error message displays this: Script: D:\Downloads\create_script_contro...

Go to advanced search