Windows   发布时间:2022-05-07  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了调整大小 – AutoHotKey – 调整Windows大小大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我目前有一个HTPC连接到我客厅的等离子,我有一些图像保留问题.在长时间浏览网页等时,我会遇到这个问题.但是,看起来使用AutoHotKey设置脚本以在计时器上自动调整窗口大小应该相对容易.任何人都可以帮我开始编写脚本来完成这项任务吗? (也对任何其他想法开放)

谢谢!

解决方法

很久以前我创建了一个脚本“标准化”窗口,即调整大小,移动,并执行其他操作以使窗口确认我的个人偏好.

每当窗口第一次显示时,它就会被标准化.如果它已关闭并重新打开,则会再次标准化.

下面是脚本的功能版本,应该满足原始问题的要求.

我使用的版本要复杂得多,因为它有更多功能,例如它支持多个监视器并调整窗口大小,同时虑Windows任务栏的高度.我使用脚本使打开/保存对话框更大(默认情况下它们太小).我还用它来自动登录某些网站和应用程序.

; This script "normalizes" windows,i.e. resizes,moves,and performs other
; actions to make a window confirm to my personal preference.

SettitleMatchMode,2

; Go into an infinite loop
loop
{
    ; Pause so other apps can execute. 250 milliseconds seems to work well.
    Sleep,250

    ; If hotkeys are suspended for this script,then suspend all functionality
    if A_IsSuspended
        conTinue

    ; We will build a unique window name using the window title and window handle.
    ; Store each unique name in an array.
    WinGet,HWND,ID,A
    WinGettitle,Windowtitle,A
    WinGetClass,WindowClass,A

    ; Remember the prevIoUs window we processed
    WindowtitleCleanPrevIoUs := WindowtitleClean

    ; Only normalize windows that we haven't seen before.
    ; If we haven't already normalized the window,we do
    ; the normalize,then set a flag so we don't normalize the same window again.

    ; Strip out all chars that may be invalid in an AHK variable name.
    WindowtitleCleanTemp := StringRemoveAllNonAlphaNum(WindowtitlE)
    ; Variable names can be at most 254 chars,so truncate to less than that.
    StringLeft,WindowtitleClean,WindowtitleCleanTemp,230

    ; Process the window if:
    ; (1) It wasn't prevIoUsly processed (i.e. not in our window-name list named WinList)
    ; (2) And we aren't sitTing on the same window during each loop.
    if (WinList%HWND%%WindowtitleClean% != 1 and WindowtitleClean != WindowtitleCleanPrevIoUs)
    {
        ; Get the window's position and size
        WinGetPos,WinX,WinY,WinWidth,WinHeight,A

        ; Is this an MS Word window?
        if (WindowClass == "OpusApp")
        {
            ; Center the window and resize so it is 80% of the monitor width and 90% of height.
            WinMove,A,(A_ScreenWidth/2)-(WinWidth/2),(A_ScreenHeight/2)-(WinHeight/2),A_ScreenWidth * .8,A_ScreenHeight * .9
        }
        ; Is this the Calculator window?
        else if (WindowClass == "SciCalc")
        {
            ; Center the window
            WinMove,(A_ScreenHeight/2)-(WinHeight/2) 
        }

        ; Set a flag inDicaTing this window has been processed so it is
        ; not processed again.
        WinList%HWND%%WindowtitleClean% = 1
    }
}


; --- Win+F5 will Reload this script ---
~#F5::reload

; --- Win+Escape will Pause this script ---
~#Escape::Suspend,Toggle

; --- Win+Alt+Escape will Exit this script ---
; Close this script
~#!Escape::ExitApp



; ===========================================================================
; Removes all non-alphabetic and non-numeric characters from the given
; String.  The resulTing String is returned.
; ===========================================================================
StringRemoveAllNonAlphaNum(sourceString)
{
    StringSplit,SplitsourceString,sourceString

    OutputString =
    Loop,%splitsourceString0%
    {
        Char := SplitsourceString%A_Index%
        if (Char >= "a") and (Char <= "z")
            OutputString := OutputString Char
        else if (Char >= "0") and (Char <= "9")
            OutputString := OutputString Char
    }

    return OutputString
}

大佬总结

以上是大佬教程为你收集整理的调整大小 – AutoHotKey – 调整Windows大小全部内容,希望文章能够帮你解决调整大小 – AutoHotKey – 调整Windows大小所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:移动