Jump to content

Recommended Posts

Posted (edited)

Hi, Below is the piece of script.

1. The intention here is load a image full screen on selecting the combination of shift+d  hotkey.

2. Ensure that script runs always on the machine.

3. Exit full screen, when pressed ESC button.

I am new and learning the art of autoit, please take a look and help me correct it.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

HotKeySet("+d", "_BlackMute") ;If you press SHIFT + d, the script activates _BlackMute()
#HotKeySet ("(ESC)", "Terminate")

While 1
    sleep(100)
WEnd

Func _BlackMute()
    HotKeySet("+d")

GUICreate('MyGUI', @DesktopWidth, @DesktopHeight, 0, 0, BitOR($WS_POPUP, $WS_EX_TOPMOST))

    Local $idPic = GUICtrlCreatePic("C:\Users\ADMIN\Pictures\4KBlack.JPG", 0, 0, @DesktopWidth, @DesktopHeight)

    GUISetState(@SW_SHOW)

    ; Loop until the user exits.
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop

        EndSwitch
    WEnd
    Local $idMsg
    ; Loop until the user exits
    While 1
        $idMsg = GUIGetMsg()

        If $idMsg = $GUI_EVENT_CLOSE Then ExitLoop
    WEnd

   GUIDelete()
EndFunc   ;==>Blackmute

 

Edited by Jos
added codebox
  • Developers
Posted (edited)
11 minutes ago, WindIt said:

I am new and learning the art of autoit, please take a look and help me correct it.

Don't you think it would be handy when you also define what isn't working yet or do you want us to figure that out ourselves? ;)  
Why do you have 2 message loop in the Func?

PS: Please post your questions in the Support forum and use codebox for you script....thanks.

Jos 

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted
2 minutes ago, Jos said:

Don't you think it would be handy when you also define what isn't working yet or do you want us to figure that out ourselves? ;)  

Hey sorry, Very new here. so the exit is not clean it does not work. I am unable figure it out.

  • Developers
Posted
1 minute ago, WindIt said:

Hey sorry, Very new here. so the exit is not clean it does not work. I am unable figure it out.

Sorry, but still vague and did you see the other comment about the 2 message loops?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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
×
×
  • Create New...