Jump to content

Just A Little Help For A Very Simple Thing


Recommended Posts

I wrote a simple script that looks like this:

HotKeySet("^{SPACE}", "Window")
HotKeySet("^{BACKSPACE}", "Fullscr")

While 1
Sleep(500)
WEnd

Func Window()
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, 200, 200)
EndFunc

Func Fullscr()
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, @DesktopWidth, @DesktopHeight)
EndFunc

I just can't figure it out how to make a toggle hotkey... in this case i would just like to use ^{SPACE} to toggle between the 2 modes. I think its pretty simple for you guys to make this change.

Thx a lot.

Link to comment
Share on other sites

HotKeySet("^{SPACE}", "Window")
Dim $t = 0

While 1
Sleep(100)
WEnd

Func Window()
    If $t = 0 Then
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, 200, 200)
        $t = 1
    Else
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, @DesktopWidth, @DesktopHeight)
        $t = 0
    EndIf
EndFunc

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

OMG i fell sooooo stupid because its so simple !

Thank you !

Another way to do it:
HotKeySet("^{SPACE}", "Window")
Global $t

While 1
Sleep(100)
WEnd

Func Window()
    $t = Not $t
    If $t Then
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, 200, 200)
    Else
        WinActivate("Untitled - Notepad", "")
        WinMove("Untitled - Notepad", "", 0, 0, @DesktopWidth, @DesktopHeight)
    EndIf
EndFunc

P.S. - This is the scripts and scraps forum :):D

Edit:

Fixed Code Tags :(

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...