Set 0px or 1px width for a window

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
afshindavoudy
Posts: 44
Joined: 10 Jan 2024, 13:25

Set 0px or 1px width for a window

Post by afshindavoudy » 10 Mar 2024, 03:54

Is it possible in Autohotkey to set a 0px or a 1px width for a window?
In the following script, I intended to create a simple slider, but it cant set the window width less than 334px.

Code: Select all

F1:: {
    hwnd := WinExist('Notepad')
    WinGetPos(, , &width, , hwnd)
    Step := 10
    Loop width / Step {
        WinMove( , ,width - (Step * A_index), , hwnd)
    }
}

just me
Posts: 9575
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Set 0px or 1px width for a window

Post by just me » 10 Mar 2024, 04:02

afshindavoudy wrote:In the following script, I intended to create a simple slider, ...
Why don't you want to use an AHK window to create a slider?

afshindavoudy
Posts: 44
Joined: 10 Jan 2024, 13:25

Re: Set 0px or 1px width for a window

Post by afshindavoudy » 10 Mar 2024, 05:41

@just me
I didn't get your point, but for more clarification, I am intended to create a slider to slide some apps (eg. chatGPT chrome app), just like Copilot which slides in/out with Win+C in windows 11.
I've already written a script to simulates sliding by moving the window out of the screen (By moving x pos to the edge of the screen).
But on multiple monitors setup, I can't use it on both sides of the main screen.
So, I think reducing width to 1px or 0px is a better solution than moving x pos to the screen edge.

Post Reply

Return to “Ask for Help (v2)”