Search found 404 matches

by SirRFI
03 Jun 2018, 06:08
Forum: Ask for Help (v1)
Topic: Looping, scrolling or browsing through associative arrays Topic is solved
Replies: 9
Views: 2161

Re: Looping, scrolling or browsing through associative arrays Topic is solved

Difference between indexed-array ( [] ) and associated-array ( {} ) is that the first one sets integer key automatically to reflect "position", while in the second key can be string and has to be set manually. Since the keys are no longer numbers, you can't simply use Loop % array.length() to loop t...
by SirRFI
02 Jun 2018, 03:25
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

As said, it took a while before I checked ErrorLevel and realised options have to be before file path. As a general rule, the built-in functions should throw an exception if given invalid parameters , since it indicates a defect in the script rather than a condition that the script should handle. (...
by SirRFI
31 May 2018, 16:27
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

nnik 's latest code will display messages only in v1, because they weren't enclosed in quotes. Mentioning that just in case someone gets confused by empty MsgBox. I prepared another example: say our script logic has to move the file first, then edit or append something to it, then it's ready to sen...
by SirRFI
31 May 2018, 06:57
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

;try/catch Loop, 2 { vError := 0 try FileMove, % vPath1, % vPath%A_Index% catch { vError := 1 MsgBox, % "FileMove error" } if !vError MsgBox, % "FileMove success" } return This is v2 section and we are discussion changes for it. Overhauling that for v1 could possibly partially break backwards-compa...
by SirRFI
30 May 2018, 14:59
Forum: AutoHotkey Development
Topic: v2 docs contribution questions
Replies: 17
Views: 5098

Re: v2 docs contribution questions

Decent editor can find all occurrences in file tree, it's just that you need full list of things to change.
by SirRFI
30 May 2018, 13:42
Forum: AutoHotkey Development
Topic: Try/Catch instead of ErrorLevel Topic is solved
Replies: 7
Views: 5034

Re: Try/Catch instead of ErrorLevel Topic is solved

Apparently this function does not use throw on failure, which is why catch doesn't work. Correct me if I am wrong. Here's a working custom example: myFunc2(X, Y) { if !(X is "integer") throw Exception("Invalid argument type: expected integer, got " type(X)) else if !(Y is "integer") throw Exception(...
by SirRFI
30 May 2018, 13:30
Forum: AutoHotkey Development
Topic: Object.HasValue/Contains/KeyOf/FindValue
Replies: 56
Views: 18364

Re: Object.HasValue/Contains/KeyOf/FindValue

I haven't followed the discussion, but I think that has sounds like it expects "yes" or "no" answer, therefore true / false . In addition to that, You could make find , which returns array of key names containing the value. Unsure if they can be merged into one, because key can be 0 which equals fal...
by SirRFI
30 May 2018, 12:59
Forum: AutoHotkey Development
Topic: v2 docs contribution questions
Replies: 17
Views: 5098

Re: v2 docs contribution questions

You're using lower camelCase. I think starting since AHK v1.1 it would be nice to differ between Classes and variables by using upper for classes and lower for variables/functions. But thats just my personaly taste I guess. Such change would require to change all occurances for each variable / func...
by SirRFI
30 May 2018, 12:47
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

Did you experience the problem in AHK v1 or v2? In theory, you could turn an error mode on or off, people have asked for a no error message mode. Checking ErrorLevel should have revealed the problem, right? (Btw I had considered that ImageSearch could return a blank string if an error occurred.) I ...
by SirRFI
30 May 2018, 11:58
Forum: AutoHotkey Development
Topic: v2 docs contribution questions
Replies: 17
Views: 5098

Re: v2 docs contribution questions

Sounds fine to me, except for following: [*]Omit parentheses where possible. For example: if IsDone , MsgBox "This is a string." Since the "commands" are now functions, it would be better to use () 's for consistency and similarity with other languages. Consider someone falls onto one of following i...
by SirRFI
29 May 2018, 15:11
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

@jeeswg Think of the example I provided: I wasted at least half an hour before figured out ErrorLevel was returning 2 , as initially I based on function's true/false result. I thought image cannot be found for some reason and went all over the place rechecking everything. It could be avoided if the ...
by SirRFI
29 May 2018, 14:11
Forum: AutoHotkey Development
Topic: v2 docs contribution questions
Replies: 17
Views: 5098

Re: v2 docs contribution questions

Coding style is of course personal preference, unless there's a rule / convention in a team. Given this, I believe there's some sense of consistency for the docs.
by SirRFI
28 May 2018, 17:13
Forum: AutoHotkey Development
Topic: v2 docs contribution questions
Replies: 17
Views: 5098

v2 docs contribution questions

I am considering contributing v2 docs for a longer while, starting with renewed or additional code examples and small fixes. Actually I already have few things in mind. However, before making up mind / doing anything, I'd like to know if: • new examples are welcomed • there are some guidelines to fo...
by SirRFI
28 May 2018, 17:04
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

Re: ErrorLevel

What is "the" reason? 0 equals false, so if (ImageSearch... wouldn't work.
by SirRFI
28 May 2018, 16:15
Forum: AutoHotkey Development
Topic: ErrorLevel
Replies: 59
Views: 16864

ErrorLevel

I've used ImageSearch recently, which got me confused: functions now return something, and this particular one returns 0 on not found and 1 on match, which is opposite to ErrorLevel values. However, error is still shown only in ErrorLevel as 2 . Question is: do we still need ErrorLevel in such place...
by SirRFI
26 May 2018, 17:41
Forum: Ask for Help (v1)
Topic: adding an extra key
Replies: 11
Views: 2383

Re: adding an extra key

Try it like following:

Code: Select all

a & b::MsgBox % "yes"
Interesting enough, b isn't considered a hotkey on it's own like a is.

Alternatively, perhaps you could use following for slightly different outcome:

Code: Select all

#if GetKeyState()
by SirRFI
26 May 2018, 17:35
Forum: Ask for Help (v1)
Topic: Open a text file and go to the end
Replies: 5
Views: 1464

Re: Open a text file and go to the end

As said, the key is likely sent too early. Maybe WinWait would be in help.
by SirRFI
20 May 2018, 07:11
Forum: Ask for Help (v1)
Topic: Please help me with this code Topic is solved
Replies: 4
Views: 943

Re: Please help me with this code Topic is solved

ZOMBYSPIDER wrote:Where do I put the "L" in the toggle code
The L hotkey is already there, in the first line.
ZOMBYSPIDER wrote:also could you make the actual code please
The "hardest" part is already done - all you have to do is to use mentioned commands on your pseudo code and paste it in marked place.
by SirRFI
20 May 2018, 06:52
Forum: Ask for Help (v1)
Topic: Searching the right keys
Replies: 5
Views: 828

Re: Searching the right keys

Elaborate, because what you described mismatches provided code. To me it seems like XButton1 is changing modes of something.
by SirRFI
20 May 2018, 06:24
Forum: Ask for Help (v1)
Topic: Please help me with this code Topic is solved
Replies: 4
Views: 943

Re: Please help me with this code Topic is solved

Here's the toggle:

Code: Select all

l::SetTimer, YourLoop, % (toggle := !toggle) ? "ON" : "OFF"

YourLoop:
	; your code here...
	; as an exampe:
	ToolTip % " "
	Sleep 100
return
For the rest: MouseMove, Click, Sleep

Go to advanced search