Search found 23 matches

by lukeman3000
31 Aug 2018, 21:33
Forum: Ask For Help
Topic: How can I loop this specific part of my script?
Replies: 6
Views: 610

Re: How can I loop this specific part of my script?

In the loop add an if statement that checks the position (which is what you gave) and then say break like so StartTime := A_TickCount Loop { if ((A_ScreenWidth/2 = x1) && (A_ScreenHeight/2 = y1) break WinMove, ahk_exe throttle.exe,, 0, 0, Set_Width, Set_Height Sleep, 100 WinGetPos,,, winx, winy, %W...
by lukeman3000
31 Aug 2018, 08:50
Forum: Ask For Help
Topic: How can I loop this specific part of my script?
Replies: 6
Views: 610

Re: How can I loop this specific part of my script?

So this can be achieved fairly easily by starting with the loop with an until statement, in your case you want a maximum of 10 seconds. Since you have a sleep of 100 milliseconds between WinMove and WinGetPos this will change our number of loop slightly to adjust for the time spent in the sleep. We...
by lukeman3000
30 Aug 2018, 22:11
Forum: Ask For Help
Topic: How can I loop this specific part of my script?
Replies: 6
Views: 610

How can I loop this specific part of my script?

My script is working as intended (launches a game, checks to see if the window is centered, and centers it if it's not). However, after it centers the window, I'd like to check if the window is centered and keep trying to center it until it is centered (perhaps only trying for a maximum of 10 second...
by lukeman3000
21 Aug 2018, 13:09
Forum: Ask For Help
Topic: Any other ways to increase window size when winmove doesn't work?
Replies: 0
Views: 180

Any other ways to increase window size when winmove doesn't work?

There's a certain game that doesn't offer window size options (Thimbleweed Park), and the default window size is a bit too small. I've already tried winmove, but it doesn't seem to work. Any ideas here? One thing I've noticed is that winmove seems to work whenever I can click and drag the window and...
by lukeman3000
17 Aug 2018, 17:15
Forum: Ask For Help
Topic: How to check if a window is centered before centering?
Replies: 3
Views: 418

Re: How to check if a window is centered before centering?

It's because you'r code is little wrong. CenterWindow(WinTitle) { WinGetPos,xx,yy, Width, Height, %WinTitle% x1 := xx + Width/2 y1 := yy + Height/2 loop 2 { y1 := yy + Height/2 loop 2 { if ((A_ScreenWidth/2 == x1) && (A_ScreenHeight/2 == y1)) { msgbox all goto end } else y1 := y1 + 0.5 } x1 := x1 +...
by lukeman3000
17 Aug 2018, 00:42
Forum: Ask For Help
Topic: How to check if a window is centered before centering?
Replies: 3
Views: 418

How to check if a window is centered before centering?

So using the example code on the WinMove page, this is a function I've come up with: CenterWindow(WinTitle) { WinGetPos, X, Y, Width, Height, %WinTitle% if (X = (A_ScreenWidth/2)-(Width/2) and Y = (A_ScreenHeight/2)-(Height/2) and Width = 1616 and Height = 939) { return } else { WinMove, ahk_exe thr...
by lukeman3000
07 Oct 2017, 20:07
Forum: Ask For Help
Topic: How to detect a click on a specific window?
Replies: 9
Views: 957

Re: How to detect a click on a specific window?

I suggest you read about the auto -execute section. When understood, you can easily fix this code to demonstrate how you can use winWaitClose , #if lock = 0 && WinActive("ahk_class Notepad") F1::Msgbox Notepad is active winWaitClose ahk_class Notepad lock := 0 exitapp esc::exitapp Also, you should ...
by lukeman3000
04 Oct 2017, 03:16
Forum: Ask For Help
Topic: How to detect a click on a specific window?
Replies: 9
Views: 957

Re: How to detect a click on a specific window?

You can use winWaitClose . Also, I'd change #if ClickedOnWindow("ahk_exe scummvm.exe") && Lock = 0 to #if Lock = 0 && ClickedOnWindow("ahk_exe scummvm.exe") , see Short-circuit Boolean Evaluation . :wave: Forgive my ignorance, but how would I use winwaitclose? Where should it be placed in the code?
by lukeman3000
04 Oct 2017, 02:14
Forum: Ask For Help
Topic: How to detect a click on a specific window?
Replies: 9
Views: 957

Re: How to detect a click on a specific window?

You need to look in the documentation on #if and hotkeys. I don't know if this is what you want, but it is a cleaned up version of your last post, ; https://autohotkey.com/boards/viewtopic.php?f=5&t=37561 ; How to detect a click on a specific window? - AutoHotkey Community - Opera #NoTrayIcon #NoEn...
by lukeman3000
04 Oct 2017, 01:30
Forum: Ask For Help
Topic: Is it possible to detect if a cursor is locked to a window?
Replies: 2
Views: 317

Is it possible to detect if a cursor is locked to a window?

I need to be able to check if a cursor is locked to a window or not. There is a program called ScummVM (to emulate old games), and a keyboard shortcut (ctrl+m) will lock the cursor to the game window. I need to be able to check whether or not the cursor is locked to the window -- not just if it's ho...
by lukeman3000
03 Oct 2017, 23:11
Forum: Ask For Help
Topic: How to detect a click on a specific window?
Replies: 9
Views: 957

Re: How to detect a click on a specific window?

Ok, Here's what I've got so far: #NoTrayIcon #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir...
by lukeman3000
27 Sep 2017, 01:29
Forum: Ask For Help
Topic: How to detect a click on a specific window?
Replies: 9
Views: 957

How to detect a click on a specific window?

What code can I use that will detect if the mouse is clicked on a certain window? Something like... IfClickOnWindow, ahk_exe scummvm.exe ; I know that "IfClickOnWindow doesn't exist -- it's just to illustrate my thought process { MsgBox You clicked on the window } else { MsgBox You didn't click on t...
by lukeman3000
20 Sep 2017, 03:40
Forum: Ask For Help
Topic: Trying to get ctrl+m to work and other things..
Replies: 7
Views: 758

Re: Trying to get ctrl+m to work and other things..

I still don't quite understand, but maybe this is the behaviour you want ? SetTimer, Exists, 1000 ^F10::SetTimer, SomethingElse, 100 SomethingElse: Send, ^m return Exists: if(!WinExist("ahk_exe scummvm.exe")) { ExitApp } return So each time ^F10 is pressed, it sends ^m and it also checks to see if ...
by lukeman3000
20 Sep 2017, 02:42
Forum: Ask For Help
Topic: Trying to get ctrl+m to work and other things..
Replies: 7
Views: 758

Re: Trying to get ctrl+m to work and other things..

Try this, untested. #IfWinActive, ahk_exe scummvm.exe ^F10:: While(GetKeyState("F10", "P") && WinActive("ahk_exe scummvm.exe")) { Send, ^m Sleep, 100 } Return I don't think this will do what I'm needing. I don't want to execute the hotkey if F10 is pressed and if ahk_exe scummvm.exe is the active w...
by lukeman3000
13 Sep 2017, 05:05
Forum: Ask For Help
Topic: Trying to get ctrl+m to work and other things..
Replies: 7
Views: 758

Re: Trying to get ctrl+m to work and other things..

The problem is that the auto execute section ends at the first hotkey or return statement. I am unsure of what you want the hotkey ^F10:: to do, so I can't suggest an alternative. So basically, I want the script to constantly wait to see if ctrl+F10 is pressed (while ScummVM is still active). If th...
by lukeman3000
13 Sep 2017, 01:57
Forum: Ask For Help
Topic: Trying to get ctrl+m to work and other things..
Replies: 7
Views: 758

Trying to get ctrl+m to work and other things..

Here's my code, which does currently work: #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. SetWorkingDir %...
by lukeman3000
29 Aug 2017, 04:11
Forum: Ask For Help
Topic: Which of these scripts makes more sense?
Replies: 0
Views: 234

Which of these scripts makes more sense?

As far as I'm aware, both of these are accomplishing the same thing. What I'm wondering is, does one method hold any kind of advantages over the other? Is one inherently more stable than the other? The idea is that these scripts will be running in the background while I'm playing games with ScummVM....
by lukeman3000
25 Aug 2017, 00:17
Forum: Ask For Help
Topic: Why doesn't my script work?
Replies: 6
Views: 694

Re: Why doesn't my script work?

Works for me, you probably already have SDL_VIDEO_CENTERED environment variable, try with a different one that you definitely don't have. Lol, you're right. It does work. I was testing by deleting the environment variable and then running the script. But I didn't realize I had to hit "ok" in the en...
by lukeman3000
24 Aug 2017, 23:44
Forum: Ask For Help
Topic: Why doesn't my script work?
Replies: 6
Views: 694

Re: Why doesn't my script work?

see https://autohotkey.com/board/topic/96480-write-system-variables-in-environment-variables-window/ Thanks. I already stumbled across using comspec to do it. However, I still want to be able to check if the variable exists first and to only take action if it does not. Here's what I've got: ; NoEnv...
by lukeman3000
24 Aug 2017, 22:57
Forum: Ask For Help
Topic: Why doesn't my script work?
Replies: 6
Views: 694

Re: Why doesn't my script work?

Thanks wolf, got it to work. Another question - why is this not working for me? #NoTrayIcon #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. ; #Warn ; Enable warnings to assist with detecting common errors. SendMode Input ; Recommended for new scripts due to it...

Go to advanced search