Jump to content

How to start my script with a hotkey


Go to solution Solved by czardas,

Recommended Posts

Posted (edited)

Hi there,

I have made a script to toggle my two windows. It is working. But i need the functionality of a hot key to this script. Tell me what should i do fo this

Write a HotKeySet function inside my script

                   

                       OR

Complie my script as it is and make shortcut of that exe and set a hotkey for that exe to run.

Edited by kcvinu
  Reveal hidden contents

 

Posted

To start the Exe I would do the latter.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Personally, I've had less than satisfactory experience with Hotkeys, so I'd do neither, and would just use a Quick Launch facility or first section of the start menu ... or a floating toolbar ... perhaps accessed through the Tray.

In the end, it may be down to your version of Windows.

So there you have it, three recommendations ..... now which one will you choose?

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

  Reveal hidden contents

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

  • Moderators
Posted

kcvinu,

I have >already told you once - post general support questions in "General Help and Support", not "Dev Chat". Please do not do it again. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Moderators
Posted

kcvinu,

I have now merged the 2 threads you have started on this subject. Please stick to just the one from now on. :naughty:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

  • Solution
Posted (edited)

If the hotkey is created using AutoIt, clearly the script has to be running for it to work. Here's an example program which waits until the hotkey F2 is pressed.

;

#include <MsgBoxConstants.au3>

Global $g_Flag = False

HotKeySet("{F1}", "Quit")
HotKeySet("{F2}", "Resume")

While 1 ; Infinite loop
    Sleep(20) ; Prevents the CPU from overheating
    If $g_Flag Then ExitLoop
WEnd

Func Resume()
    $g_Flag = True
EndFunc

Func Quit()
    Exit
EndFunc

; The program starts here
MsgBox($MB_OK, "Test Script", "Hello World")

;

You could create a similar script to activate other programs. Look at ShellExecute() in the help file.

Edited by czardas

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
  • Recently Browsing   0 members

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