Search found 404 matches
- 03 May 2018, 18:07
- Forum: Ask for Help (v1)
- Topic: GUI Serial Number Lookup
- Replies: 1
- Views: 413
Re: GUI Serial Number Lookup
You have x2 gLabel , which I think is not allowed. Also, this is not how obtaining content from GUI works: clipboard = %SN% . Lastly, I suggest putting the variable's content directly into search link for reliability. See the code below - untested browser part: F2:: gosub, SNGUI return SNGUI: Gui, +...
- 03 May 2018, 18:01
- Forum: Ask for Help (v1)
- Topic: add and Alignment Buttons at Gui Topic is solved
- Replies: 9
- Views: 2328
Re: add and Alignment Buttons at Gui Topic is solved
How to dedicate the button 1 for event 1 Elaborate what you meant by "event". You likely want something to happen upon clicking it - gLabel option comes with help. However, since you are creating the buttons in a loop, you'll likely need to force expression to create this "dynamically". Same applie...
- 03 May 2018, 17:51
- Forum: Ask for Help (v1)
- Topic: Evaluating two variables 1 has a dollar sign Topic is solved
- Replies: 2
- Views: 642
Re: Evaluating two variables 1 has a dollar sign Topic is solved
remove the $ then compare. "$900" isn't a number, it's text. basically you're comparing if nothing (text aint a number) is less than 1000, which is true. More precisely: gold := $900 is not a text (or rather a string), because is not enclosed in quotes. It's improperly formatted number, due to the ...
- 03 May 2018, 17:43
- Forum: Ask for Help (v1)
- Topic: Image search with variable file path
- Replies: 8
- Views: 1650
Re: Image search with variable file path
Sorry for the newb question...How should I go about defining it? Basically, you are trying to use a function that doesn't exist - neither natively in AHK and in your script scope. This is how you define functions: YourFunctionName(coma, separated, arguments) { ; function's code goes here } But you ...
- 03 May 2018, 14:37
- Forum: Ask for Help (v1)
- Topic: I have two working scripts but I need to mix the two scripts. How do I do it?
- Replies: 9
- Views: 1380
Re: I have two working scripts but I need to mix the two scripts. How do I do it?
Untested: F10:: ;F10 starts script SetTimer, MyLabel1, ON SetTimer, MyLabel2, ON Return F11::reload ;F11 reloads the script, which stops the loops in the process F12::exitapp ;F12 closes the program MyLabel1: Count++ Send x Sleep 50 If Count < 580 ; Continue Count := 0 sleep 1500 send {right down} ...
- 03 May 2018, 07:21
- Forum: Ask for Help (v1)
- Topic: I have two working scripts but I need to mix the two scripts. How do I do it?
- Replies: 9
- Views: 1380
Re: I have two working scripts but I need to mix the two scripts. How do I do it?
Untested: F10:: ;F10 starts script SetTimer, MyLabel1, ON SetTimer, MyLabel2, ON Return F11::reload ;F11 reloads the script, which stops the loops in the process F12::exitapp ;F12 closes the program MyLabel1: Count++ Send x Sleep 50 If Count < 580 ; Continue Count := 0 sleep 1500 send {right down} s...
- 02 May 2018, 16:56
- Forum: Ask for Help (v1)
- Topic: windows key script
- Replies: 1
- Views: 379
Re: windows key script
And what is "so far" ?
This seems to do the trick:
This seems to do the trick:
Code: Select all
0::win_key_toggled := !win_key_toggled
#if (win_key_toggled)
LWin::
RWin::
Return
- 30 Apr 2018, 11:49
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
Exceptions : @lexikos I see. In that case I suppose throwing an exception to inform what and where is wrong should be enough anyway. Okay, how should I connect validation and exceptions for best result? Assuming this is the right way, of course. Class Test1 { __New(width) { this.setWidth(width) } g...
- 30 Apr 2018, 11:46
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
Setters : I am trying mentioned approaches, but there are problems as well. Class Testt { width[] { get { return this.width } set { if !(value is "integer") throw Exception(A_ThisFunc ": Expected integer, got " Type(value)) this.width := value return this ; or return this.width := value } } __New(w...
- 29 Apr 2018, 17:09
- Forum: Off-topic Discussion
- Topic: A Bit Baffling
- Replies: 35
- Views: 8401
Re: A Bit Baffling
@Era Nobody forces you do write your own classes and do other typical OOP stuff. Some "functions" are now OOP yes, but that's usually due to their complexity. Other than that, v2 is mostly about removing command syntax/behaviour and literal input, which fix v1 syntax inconsistency and related issues...
- 26 Apr 2018, 13:05
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
Apparently the topic is deeper/wider than I anticipated. I've read up on the getter/setters in PHP, but the discussions in StackOverflow quickly turned to cross-language. To summarize what was said: • Creating getter/setter methods (such as setWidth() ) came from Java and C++ due to their structure....
- 23 Apr 2018, 16:17
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
properties can define their own get/setters, so no need to mess with meta functions Can you elaborate? 5. What should I do if the argument doesn't meet requirements? (Sticking to doing this in setter) Sticking to the first code snippet - is throwing an exception there valid in first place? What is ...
- 23 Apr 2018, 15:33
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
Bringing this up for visibility.
- 22 Apr 2018, 15:57
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
Re: OOP AHK good practise - validation, setters, throw exception Topic is solved
Thanks for answer. Meanwhile I actually went deeper into the topic and decided to rewrite it whole.
Returning the class instance itself makes sense, because it allows to keep working on a one-liner.
Returning the class instance itself makes sense, because it allows to keep working on a one-liner.
- 22 Apr 2018, 14:48
- Forum: Ask for Help (v1)
- Topic: How to disable repeat? Topic is solved
- Replies: 3
- Views: 1795
Re: How to disable repeat? Topic is solved
Turns out someone just asked me similar thing, apparently with the code above. I modified it for the answer before getting here though: values := [] Loop 10 values.Push(RandomButNotLastNumber(1, 2)) output := "" for key, val in values output .= key " = " val "`n" MsgBox % output RandomButNotLastNumb...
- 22 Apr 2018, 14:32
- Forum: Ask for Help (v1)
- Topic: OOP AHK good practise - validation, setters, throw exception Topic is solved
- Replies: 17
- Views: 3725
OOP AHK good practise - validation, setters, throw exception Topic is solved
Recently I started rewriting some of my code to AHK v2, using Object Oriented Programming (OOP, as in classes, getters/setters etc.). While on it, I want to ensure that inserted values/content (the setter part) meets variable type (in example: integer only) and other custom conditions, so properties...
- 22 Apr 2018, 12:27
- Forum: Ask for Help (v1)
- Topic: Search for two images
- Replies: 3
- Views: 946
Re: Search for two images
Something like this?: CoordMode, Pixel, Window loop { ImageSearch, FoundX, FoundY, 855, 747, 914, 788, C:\image.png if (ErrorLevel == 0) ; Image found - search for another { ImageSearch, FoundX2, FoundY2, 855, 747, 914, 788, C:\image2.png if (ErrorLevel == 0) ; Second image found { ; do stuff } } }
- 22 Apr 2018, 09:46
- Forum: Ask for Help (v1)
- Topic: Hey there i'm trying to understand why does this script not work
- Replies: 5
- Views: 961
- 22 Apr 2018, 07:26
- Forum: Ask for Help (v1)
- Topic: Hey there i'm trying to understand why does this script not work
- Replies: 5
- Views: 961
Re: Hey there i'm trying to understand why does this script not work
::F2 - you reverted it, should be F2::.
{SPACE down}{A down} - this is invalid. See Send.
While(1==1) - this will cause infinite loop after pressing the hotkey for first time. You may want to do some kind of toggle.
Ps. true instead of 1==1 is more elegant.
{SPACE down}{A down} - this is invalid. See Send.
While(1==1) - this will cause infinite loop after pressing the hotkey for first time. You may want to do some kind of toggle.
Ps. true instead of 1==1 is more elegant.
- 21 Apr 2018, 12:30
- Forum: Ask for Help (v1)
- Topic: How can i change file exe of autohotkey to name PlayGame ?
- Replies: 4
- Views: 1061
Re: How can i change file exe of autohotkey to name PlayGame ?
Just rename the file by right-clicking it?