Jump to content

Newbie Question


 Share

Recommended Posts

hello everyone. i'm pretty much new to autoit and scripting altogether so please bear with me. i've been practicing by creating little simple scripts. my question is, is it possible to assign a hotkey to launch a script that was compiled to an .exe file?

...thanks

Link to comment
Share on other sites

maybe

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d
HotKeySet("{F9}", "Run_my_Program")

;;;; Body of program would go here ;;;;
While 1
    Sleep(100)
WEnd
;;;;;;;;

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func Terminate()
    Exit 0
EndFunc

Func ShowMessage()
    MsgBox(4096,"","This is a message.")
EndFunc

Func Run_my_Program()
    Run("notepad.exe")
EndFunc

based from "hotkeyset" in help

8)

NEWHeader1.png

Link to comment
Share on other sites

You can set a hotkey that will run a function in a script while it is running. That function might start another script or do whatever. Please explain further if that isn't enough information.

thank you for your time and help..to be more specific..for example.. i wrote a simple little script that would do a printscreen of the any active open app. on my desktop, paste it into wordpad, set it up as landscape and print it out.. Is it possible to setup a hotkey instead of doubleclicking on the .exe icon each time i want to run the script? from what im gathering from your response is that i would have to create another script that would setup a hotkey to launch that particular script?

Link to comment
Share on other sites

HI,

yes possible.

1. Have another script that checks whether the hotkey is pressed then start the screenshot script

2. Haveing a while 1 sleep(100) wend loop and check itself for a hotkey.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...