Dire help needed with WinMove (Also a few smaller questions.)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
PochiPanda
Posts: 1
Joined: 22 Jun 2021, 17:44

Dire help needed with WinMove (Also a few smaller questions.)

22 Jun 2021, 18:29

Hello, today is my first day learning AHK. I am attempting to make a script that opens all the programs i use for streaming and then assembling them in the locations i want them to be.

Now i can get everything to open with the Run command, however when i attempt to use WinMove to move and resize them, they do not move(Or resize) at all. I then tried to isolate the problem by only starting a script with one run and move command and while it will still launch from run, it will never move.

Below is my initial code

Code: Select all

#NoTrayIcon
SetTitleMatchMode, 2
#SingleInstance Ignore
#WinActivateForce

F17::
Process,Close,obs64.exe
sleep, 200

	if !WinExist("ahk_exe obs64.exe")
		Run, "C:\Program Files\obs-studio\bin\64bit\obs64.exe" , C:\Program Files\obs-studio\bin\64bit
sleep, 20

	Run, "C:\Users\NovaB\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Discord Inc\Discord.lnk"
sleep, 500

	Run, vivaldi.exe --new-window https streamlabs.com /dashboard#/twitch  Broken Link for safety
sleep, 200

	Run, vivaldi.exe --new-window https twitch.tv /Vinstream  Broken Link for safety
sleep, 200

	Process,Close, ahk_exe Spotify.exe
sleep, 100

	Run, "C:\Users\NovaB\AppData\Roaming\Spotify\Spotify.exe"
sleep, 100

	if !WinExist("ahk_exe chatterino.exe")
		Run, "C:\Program Files\Chatterino\chatterino.exe"
sleep, 100

	if !WinExist("ahk_exe SndVol.exe")
		Run, "C:\Windows\System32\SndVol.exe"
sleep, 1000

WinActivate, obs64.exe
WinMove, obs64.exe, , 1063, -1543, 1284, 798

WinActivate, Discord.exe
WinMove, Discord.exe,,-1928,0,954,058

WinActivate, https streamlabs.com /dashboard#/twitch  Broken Link for safety
WinMove, https streamlabs.com /dashboard#/twitch  Broken Link for safety, ,240,-1544,836,795

WinActivate, https twitch.tv /Vinstream  Broken Link for safety
WinMove, https twitch.tv /Vinstream  Broken Link for safety, ,1038,-2160,1308,623

WinActivate, chatterino.exe
WinMove, chatterino.exe, ,-990,0,998,711

WinActivate, SndVol.exe
WinMove, SndVol.exe, , -675,704,681,353
return
If i'm not mistaken the syntax should be

Code: Select all

WinMove, name, ,x, y, w, h
Or in a single hotkey with the newly run process in the forefront simply:

Code: Select all

 Winmove, x, y
I then tried to isolate the code. To at least accomplish once the WinMove function, No dice.

Code: Select all

	F17::
		Run,"C:\Windows\System32\SndVol.exe"
	WinMove,0,0
return
What happens when i execute this, is that simply Volume mixer runs, but it just stays where it is. It isn't even close to 0,0.

(Additional issues)

I'm kind of at my wits end, especially with the addition of some newer issues.
Recently when i've started updating my code to test, and then executing the .ahk file from my desktop, it doesn't update at all until i manually go into my task manager and kill the AHK process inbetween goes. It isn't a serious issue i think, but it sure is annoying when i'm testing every 10 seconds.
Also i have an issue with the vivaldi browsers, they open up fullscreen and i think that makes them unable to be resized, does anyone have a way for them to be windowed when created?

Thank you for any help or direction you can point me, I'm pretty stuck.
User avatar
boiler
Posts: 16965
Joined: 21 Dec 2014, 02:44

Re: Dire help needed with WinMove (Also a few smaller questions.)

22 Jun 2021, 19:02

When you use the process name in a WinTitle parameter, you need to precede it with ahk_exe, like this:

Code: Select all

WinActivate, ahk_exe obs64.exe
WinMove, ahk_exe obs64.exe, , 1063, -1543, 1284, 798
That’s when you’re identifying a window in window-oriented commands. You used it correctly in the WinExist() function calls, but not in other places. Then you added ahk_exe incorrectly when using the Process command to close a process (in one place, but not another). Read the documentation on each carefully.

I didn’t follow everything in your script closely, but if you’re using Run to run a program. you should use WinWait to wait for its window to exist before you try moving it or otherwise acting on it.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot] and 187 guests