AutoHotkey:切换最小化/最大化窗口的脚本

时间:2017-03-21 04:35:23

标签: autohotkey

我只希望能够使用热键Minimize&最大化我一直使用的某个全屏应用程序。我想将它仅用于一个应用程序,而不是任何具有焦点的应用程序。

我已经在线阅读了几十种方法,其中没有一种方法可行。

我知道我可以使用一些命令:

WinMinimize, A
WinMaximize, A

但我不知道如何将它们串在一起。 在寻找示例时,我想到了这个地方:

^#n::
IfWinExist, ahk_class Notepad
{
WinGet,WinState,MinMax,ahk_class Notepad
If WinState = -1
   WinMaximize
else
   WinMinimize
}
; else
;   Run, Notepad
Return

然而,这只会最大化我的应用程序,而不是最小化它。也许这是因为应用程序是一个全屏应用程序,我不知道。

2 个答案:

答案 0 :(得分:0)

我能够从其他网站检索一些信息,这些信息帮助我找到了对其他用户有用的答案。与AutoHotKey一起使用时,此脚本将适用于全屏应用程序,使用以下代码:

Joy12::
WinGetPos, X, Y, Width, Height, WindowName
if (X == -32000)
WinMaximize, WindowName
else if (X == 0 and Y == 0 and Width == 1920 and Height == 1080)
WinMinimize, Resident Evil 4
return

用户可能必须对代码进行细微更改,将Joy12替换为他们希望使用的任何键,并将WindowName替换为他们希望使用的窗口名称。用户可能还必须更改以下值:

1920 and Height == 1080

无论他们的全屏分辨率如何。

答案 1 :(得分:0)

过一会儿,我对计算器也有相同的要求!实验的过程我想到了:

apply plugin: 'com.android.library'
apply plugin: 'org.jetbrains.kotlin.android.extensions'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'



android {
signingConfigs {
    config {
        storeFile file('E:/**.jks')
    }
}
compileSdkVersion 27

dataBinding {
    enabled = true
}

defaultConfig {
    minSdkVersion 15
    targetSdkVersion 27
    versionCode 1
    versionName "1.0" 
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        signingConfig signingConfigs.config

        zipAlignEnabled true

    }
    debug {
        debuggable true
        minifyEnabled false
        testCoverageEnabled false 
    }


}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
androidTestCompile 'junit:junit:4.12'
androidTestCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
testCompile 'org.powermock:powermock-module-junit4:1.6.4'
implementation project(':lib2')

//test
androidTestCompile 'com.android.support.test:runner:1.0.2'
androidTestCompile 'com.android.support.test:rules:1.0.2'

// Optional -- Hamcrest library
androidTestCompile 'org.hamcrest:hamcrest-library:1.3'

// Optional -- UI testing with Espresso
androidTestCompile 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation project(':PersianDateTimePicker')
implementation project(':crystalrangeseekbar-1.1.3')
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:cardview-v7:$support_version"
implementation "com.android.support:recyclerview-v7:$support_version"
implementation "com.android.support:support-v13:$support_version"
implementation "com.android.support:preference-v7:$support_version"
implementation "com.android.support:support-vector-drawable:$support_version"
implementation "com.android.support:animated-vector-drawable:$support_version"
implementation "com.android.support:mediarouter-v7:$support_version"
implementation 'com.esri.arcgis.android:arcgis-android:10.2.9'
implementation 'com.larswerkman:HoloColorPicker:1.5'
implementation 'ch.acra:acra:4.9.2'
implementation 'net.time4j:time4j-android:3.32-2017b'
implementation 'com.ibm.icu:icu4j:57.1'
implementation 'lib.kashif:folderpicker:2.2'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.6.0'
implementation('com.github.bumptech.glide:glide:4.6.1') {
    exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
implementation 'com.github.lecho:hellocharts-android:v1.5.8'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "android.arch.persistence.room:runtime:$archRoomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$archRoomVersion"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
implementation "android.arch.lifecycle:viewmodel:$lifecycle_version"
implementation "android.arch.lifecycle:livedata:$lifecycle_version"
implementation "android.arch.lifecycle:runtime:$lifecycle_version"
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
implementation "android.arch.lifecycle:common-java8:$lifecycle_version"
implementation "android.arch.lifecycle:reactivestreams:$lifecycle_version"
testImplementation "android.arch.core:core-testing:$lifecycle_version"
annotationProcessor 'android.arch.core:core-testing:1.1.1'
implementation 'com.github.angads25:filepicker:1.1.1'
}