Search found 404 matches

by SirRFI
21 Apr 2018, 03:36
Forum: AutoHotkey v2 Development
Topic: For-loops | Range object
Replies: 12
Views: 2685

Re: For-loops | Range object

Isn't that basically a for loop? (Didn't mean AHK's for loop, which is rather for-each)
JavaScript sample (can use it in browser's console):

Code: Select all

var arr = ['one', 'two', 'three', 'four'];
for (i=0; i<arr.length; i++)
	console.log(arr[i]);
by SirRFI
20 Apr 2018, 16:16
Forum: Ask For Help
Topic: How to append one variable to another? Topic is solved
Replies: 3
Views: 509

Re: How to append one variable to another? Topic is solved

Variable1 .= Variable2 or Variable1 := Variable1 Variable2.
by SirRFI
11 Apr 2018, 16:17
Forum: Ask For Help
Topic: Creating Constants Within a Class? Topic is solved
Replies: 3
Views: 652

Re: Creating Constants Within a Class? Topic is solved

Unsure if we have actual constants, but static does the trick.

Code: Select all

class MyClass
{
	static my_const := 5
	
	MyMethod()
	{
		return this.my_const
	}
}

one := new MyClass()
two := new MyClass()

MsgBox % one.my_const "`n" two.my_const "`n" one.MyMethod()
by SirRFI
08 Apr 2018, 04:47
Forum: AutoHotkey v2 Development
Topic: VarDump() function
Replies: 5
Views: 1479

Re: VarDump() function

Quick comparison - dumped object vs JSON: $obj = new DateTime(); var_dump($obj); object(DateTime)#1 (3) { ["date"]=> string(26) "2018-04-08 08:42:05.700165" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } // ... $json = json_encode($obj); var_dump($json); echo($json); string(72) "{"date"...
by SirRFI
07 Apr 2018, 17:47
Forum: AutoHotkey v2 Development
Topic: VarDump() function
Replies: 5
Views: 1479

Re: VarDump() function

There is a related thread here . That's basically this: https://autohotkey.com/boards/viewtopic.php?f=37&t=39309 JSON (as in string form) is usually minified by removing all unnecessary white symbols (new lines, tabs, spaces). Not only it lacks formatting, but also does not provide extra informatio...
by SirRFI
07 Apr 2018, 16:35
Forum: AutoHotkey v2 Development
Topic: VarDump() function
Replies: 5
Views: 1479

VarDump() function

Do we have a function to dump (print) entire variable, including arrays and objects? Normally one can MsgBox(variable) , as long it's simple type - such as string, integer, and so on (or rather transformed to string for displaying). It's not as simple for arrays and objects though, so I think we cou...
by SirRFI
07 Apr 2018, 16:17
Forum: AutoHotkey v2 Development
Topic: Continuation section & reserved words error priority
Replies: 1
Views: 655

Continuation section & reserved words error priority

Using reserved name elements, such as Break / While and likely others, within unclosed continuation section throws improper error message: MsgBox( break The following reserved word must not be used as a variable name: "break" Instead of: MsgBox( asd Error: Missing ")" This got me confused earlier to...
by SirRFI
31 Mar 2018, 15:36
Forum: AutoHotkey v2 Development
Topic: v2.. Scope Creep
Replies: 9
Views: 1984

Re: v2.. Scope Creep

Why not just rename v2-a90 to v2.0 and lets get rolling? Keeping v2 in alpha stage allows to make changes that would break scripts made for previous versions - syntax, parameter order or some base functionality. Official release would encourage some people to move over v2, including starters, where...
by SirRFI
14 Mar 2018, 15:47
Forum: Ask For Help
Topic: How to break out of loop immediately upon GUI button press? Topic is solved
Replies: 3
Views: 566

Re: How to break out of loop immediately upon GUI button press? Topic is solved

If there is nothing else in the code, perhaps Reload would do the trick?
by SirRFI
06 Mar 2018, 15:50
Forum: Ask For Help
Topic: Prevent a script crashing
Replies: 2
Views: 424

Re: Prevent a script crashing

It closes right away, because it reaches Return. Perhaps make a Loop or SetTimer with the if-run login?
Or paste your primary script to figure out why it stops in first place.
by SirRFI
06 Mar 2018, 14:28
Forum: Ask For Help
Topic: Loop thru Associative Array
Replies: 9
Views: 2428

Re: Loop thru Associative Array

SirRFI, quick question if I may - I know the C after the Join is for allowing comment lines, but what does the Q ? Unsure at this point, I believe it was Quotes or so. Originally came from my v2 question if I recall well, and I just use it ever since. Might doesn't exist in v1, but then is harmless...
by SirRFI
06 Mar 2018, 11:10
Forum: Ask For Help
Topic: Loop thru Associative Array
Replies: 9
Views: 2428

Re: Loop thru Associative Array

languages := ( join QC { ; KeyName: KeyContent "bg": "Bulgarian", "cs": "Czech", "da": "Danish", "el": "Greek", "eu": "Basque", "fi": "Finnish", "hr": "Hungarian", "ja": "Japanese", "ko": "Korean", "lt": "Lithuanian", "nb": "Norwegian", "nl": "Dutch", "pl": "Polish", "pt": "Portuguese", "ro": "Roma...
by SirRFI
18 Feb 2018, 09:10
Forum: Ask For Help
Topic: MButton event not recognized Topic is solved
Replies: 2
Views: 440

Re: MButton event not recognized Topic is solved

I just tested on 1.26 and on 1.28 (latest) - works just fine. Try running it as admin, and if doesn't help - check key history, if anything happens in first place? Or is there anything else in the script, that may affect the hotkey? #if perhaps?
by SirRFI
18 Feb 2018, 08:51
Forum: Ask For Help
Topic: Right hand control key...
Replies: 1
Views: 309

Re: Right hand control key...

Remapping keys is one is elementary AHK utilities. Even a single line in the script can do that:

Code: Select all

a::b
Anytime you press a, it behaves like b. See remap.

"the keys to the right of my touchpad" doesn't really tell me a thing. Do you need anything specific?
by SirRFI
18 Feb 2018, 07:36
Forum: Ask For Help
Topic: how to click beside a iamge Topic is solved
Replies: 1
Views: 365

Re: how to click beside a iamge Topic is solved

You can try force expression for this command, like this:

Code: Select all

mouseclick, left, % x+2, % y+2
If it doesn't work - simply overwrite the variables with your offset before the command:

Code: Select all

imagesearch, x, y, 0, 0, A_screenwidth, A_screenheight, file.png
x += 2
y += 2
mouseclick, left, %x%, %y%
by SirRFI
18 Feb 2018, 07:26
Forum: Ask For Help
Topic: Blocking Input Without Admin
Replies: 3
Views: 525

Re: Blocking Input Without Admin

I don't know if you can check if current user is admin, but you can check if the script was ran as one: A_IsAdmin
by SirRFI
18 Feb 2018, 07:24
Forum: Ask For Help
Topic: 2 sleeps on 1 hotkey
Replies: 1
Views: 411

Re: 2 sleeps on 1 hotkey

You can use MouseMove to move it from current position, or MouseGetPos and Click obtained value - pixels you want to move, having 0 at the end so it doesn't actually clicks. To move the cursor more frequently than click, perhaps A_TickCount would be in help. Perhaps you could replace the Loop and la...
by SirRFI
18 Feb 2018, 05:57
Forum: Ask For Help
Topic: How do I extract values from an array for use as option in a command? Topic is solved
Replies: 3
Views: 523

Re: How do I extract values from an array for use as option in a command? Topic is solved

Because normally you can't, unless you force expression as given above. AHK 2 are all functions, therefore expression by default.
by SirRFI
10 Feb 2018, 19:00
Forum: Ask For Help
Topic: Actions at Specific time
Replies: 3
Views: 559

Re: Actions at Specific time

See following:
SetTimer
A_Hour, A_Min
by SirRFI
05 Feb 2018, 16:53
Forum: Ask For Help
Topic: CountDown Clock not working properly
Replies: 2
Views: 393

Re: CountDown Clock not working properly

In both cases it's because of the loop. In first case the code flow (thread) is busy with endless loop, so it doesn't have a moment to read your button click. In second scenario it's also endless-loop, which is keep being called by SetTimer. While the above should be enough to fix it, I modified you...

Go to advanced search