Search found 1756 matches

by Albireo
22 Apr 2024, 17:23
Forum: Ask for Help (v2)
Topic: Error handling - ahk-v2
Replies: 1
Views: 59

Error handling - ahk-v2

Have questions regarding how error handling of instructions can/should be handled. If I use the instruction PixelGetColor . What different problems can arise? The Error information for this instruction is (" An OSError is thrown on failure. ") When the link, which leads to the Error information, is ...
by Albireo
22 Apr 2024, 06:36
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

You have right! (thank you)
this works!

Code: Select all

#Requires Autohotkey 2.0
inpVar := "TestLeTTeR"
If inpVar = "testletter"
	MsgBox "Yes! " inpVar "`nis found."
else
	MsgBox "No! " inpVar "`nis nor found."
by Albireo
19 Apr 2024, 19:01
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

Thank you! 0x is the key. (FFFFFF is not enough) But I think it's easier to know/check what color a hex number is. ( eg. I find it easier to know that 0xFFFFFF is white, than 16777215 ) Is there any good way to compare e.g. LightGreen with lightgreen ? This somehow works. (attempt to answer my secon...
by Albireo
19 Apr 2024, 16:24
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

OK the color is saved as an integer in the object. The hidden script below give the folowing result black = 0 darkred = 8388608 lightgreen = 8898002 red = 16711680 white = 16777215 #Requires Autohotkey 2.0 #SingleInstance Force cValues := Map( '' , , 'white' , 0xFFFFFF , 'black' , 0x000000 , 'lightg...
by Albireo
18 Apr 2024, 17:52
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

This code work! (with Sleep 1000 ) #Requires Autohotkey 2.0 #SingleInstance Force CoordMode 'Pixel', 'Window' Run 'notepad.exe',,, &tstPID WinWaitActive 'ahk_pid ' tstPID Sleep 1000 Color := PixelGetColor( 40, 20 ) MsgBox '(0x87C5D2) => ' Color This code doesn't work (without Sleep ) #Requires Autoh...
by Albireo
18 Apr 2024, 14:54
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

I find it difficult to know when a window has been opened. I haven't found the right solution. This doesn't work. 1) Run 'notepad.exe',,, &tstPID 2) if !WinWaitActive(WinName,, actMin) 3) if PixelSearch(&Px, &Py, xPos1, yPos1, xPos2, yPos2, hexColor, cDiff ) This works! 1) Run 'notepad.exe',,, &tstP...
by Albireo
18 Apr 2024, 10:31
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

Re: CheckColor / WaitColor - Color names of HEX color Topic is solved

I try to understand...

If I add this instructions .:

Code: Select all

For key, value in ColorValues
      res .= key`t' = `t' value '`n'
MsgBox res
The HEX values have been converted to decimal numbers (which was a surprise)
Does it always happen?

Is it easy to know if a variable contains a HEX number?
by Albireo
11 Apr 2024, 10:42
Forum: Ask for Help (v2)
Topic: Open a website and log in with username and password
Replies: 0
Views: 41

Open a website and log in with username and password

Hi! My wish is to be able to open a web page, and then fill in the user and password in the correct fields. And confirm this by AHK pressing a button. Wait until the login is completed. All this should be done by running an AHK script. Now it is not possible to test this on the desired web page with...
by Albireo
26 Mar 2024, 11:57
Forum: Tutorials (v2)
Topic: Detect window open and close
Replies: 15
Views: 5306

Re: Detect window open and close

@Albireo the purpose of this library is to replace Win... functions with non-blocking ones: while WinWaitActive and such block script execution until the window is in the desired state, WinEvent.Active lets the program do other stuff in the meanwhile and responds only when the window reaches the de...
by Albireo
26 Mar 2024, 09:10
Forum: Ask for Help (v2)
Topic: CheckColor / WaitColor - Color names of HEX color Topic is solved
Replies: 13
Views: 245

CheckColor / WaitColor - Color names of HEX color Topic is solved

Hi! I want two functions() to handle colors. Check Color() - Reads a color on one dot. and WaitColor() - Waits until a certain color occurs at the specified coordinate. At the same time, I want to be able to name certain colors (estimated 10-20 pcs) in the call of the function(). eg. #FF0000 = Red a...
by Albireo
26 Mar 2024, 07:40
Forum: Tutorials (v2)
Topic: Detect window open and close
Replies: 15
Views: 5306

Re: Detect window open and close

Thank you Descolada ! It works (in some way.) But if I add the instruction MsgBox "Next!" (after the structure above) #requires AutoHotkey v2 #include WinEvent.ahk WinEvent.Show(AIMS_Showed, "AIMS ahk_exe !!!!.exe ahk_class TShellForm", 1) Try Run aProg.file, aProg.path, "Max", &AimsPID catch as e {...
by Albireo
25 Mar 2024, 10:03
Forum: Tutorials (v2)
Topic: Detect window open and close
Replies: 15
Views: 5306

Re: Detect window open and close

Many good examples (of a rather difficult problem) One question is .: When has a program started? In order to control the program I am currently working on, the window must be visible on the screen. Now I do it in this way .: ... Try Run aProg.file, aProg.path, "Max", &AimsPID catch as e { MsgBox "E...
by Albireo
15 Mar 2024, 17:26
Forum: Ask for Help (v2)
Topic: Manage dual GUIs
Replies: 9
Views: 239

Re: Manage dual GUIs

Yes, but... Summary 1) Transferring information between Gui functions? (Without making GUIs Global) 2) Gray out a Gui that is disabled - Possible? - How? Description If I use one of your example scripts, which is slightly modified, you might understand my problem. #Requires AutoHotkey v2.0 #SingleIn...
by Albireo
14 Mar 2024, 17:03
Forum: Ask for Help (v2)
Topic: UseErrorLevel -> try / catch Topic is solved
Replies: 1
Views: 101

UseErrorLevel -> try / catch Topic is solved

Hello! In AHK v1 I used UseErrorLevel in the Run instruction. Now I thought I'd try using try / catch Something similar to this .: try Run C:\Program Files (x86)\...ABC.exe, C:\Program Files (x86)\...\bin, Max, AimsPID catch as e ; Handles the first error thrown by the block above. { MsgBox "An erro...
by Albireo
14 Mar 2024, 15:47
Forum: Ask for Help (v2)
Topic: Manage dual GUIs
Replies: 9
Views: 239

Re: Manage dual GUIs

#Requires AutoHotkey v2.0 #SingleInstance force init ExitApp init() { Static fontSize := 10, width := 330, height := 200 gui_Close := (gui) => (main.Opt('-Disabled'), gui.Hide()) main := Gui('-DPIScale', 'Main'), main.SetFont('s' fontSize) main.AddButton('w' width, 'Help').OnEvent('Click', btn_Clic...
by Albireo
14 Mar 2024, 13:17
Forum: Ask for Help (v2)
Topic: Manage dual GUIs
Replies: 9
Views: 239

Re: Manage dual GUIs

You like to create short programs :? (but I'm getting better and better at reading these) One of my objections this time is that the function init() is executed, and the program code "runs" on. if the code lock like this #Requires AutoHotkey v2.0 init(), ExitApp init(){ } I got the same result In th...
by Albireo
14 Mar 2024, 11:36
Forum: Ask for Help (v2)
Topic: Manage dual GUIs
Replies: 9
Views: 239

Re: Manage dual GUIs

Thanks! It doesn't quite work the way I want it to. a) the main gui is not in a function() b) the help gui is not (always) placed ovet the main gui #Requires AutoHotkey v2.0 #SingleInstance Force funcGui("Main") ExitApp funcGui(Title) { ; Main GUI aSize := {} aSize.x := 150 aSize.y := 150 aSize.w :=...
by Albireo
14 Mar 2024, 06:34
Forum: Ask for Help (v2)
Topic: Manage dual GUIs
Replies: 9
Views: 239

Manage dual GUIs

Hi! My desire is to create a main-GUI in a function() (no problem) The main-GUI have a Button, and when the Button is pressed, a second Gui in another function() is opened. (now the second Gui (as function()) is inside the first Gui (function()) - maybe it's better to place the second Gui-function o...
by Albireo
29 Feb 2024, 12:43
Forum: Ask for Help (v2)
Topic: Change icon in the toolbar - Windows
Replies: 0
Views: 174

Change icon in the toolbar - Windows

Hi! I have written an AHK program that starts another program. Deciding which icon to display on the desktop is easy. But when the other program is launched, it has got a different / unknown icon in the taskbar (at the bottom of the screen). Is it possible to get the same icon/symbol on the desktop ...

Go to advanced search