Jump to content

Recommended Posts

Posted

Well here is my issue.. when I try to use space key to activate the section of the script its suppose to it doesnt, and whenI use a different key to do the same thing, it does.

I believe it is because the two keys interfere with each other, is there a way to fix this?

For example this doesnt work:

; 

Global $Paused
HotKeySet("{SPACE}", "TogglePause")
HotKeySet("{END}", "Terminate")



While 1
    Sleep(100)
WEnd


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(1)
Send("{SPACE}")
      
    WEnd
   
EndFunc

Func Terminate()
    Exit 0
EndFunc

This does work:

;

Global $Paused
HotKeySet("{INSERT}", "TogglePause")
HotKeySet("{END}", "Terminate")


While 1
    Sleep(100)
WEnd


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(1)
Send("{SPACE}")
      
    WEnd
   
EndFunc

Func Terminate()
    Exit 0
EndFunc
Posted (edited)

is there a way to fix this?

yes, use another key than SPACE for the hotkey! BTW: You should rethink your code. Once you are in the while loop, you will never get out again! Is that what you want?

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Posted

Hi,

you are calling the func in the func! Space --> leads to Send space which calls the func again!

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

Posted

Well you can do it like this

Global $Paused = True
HotKeySet("{SPACE}", "TogglePause")
HotKeySet("{END}", "Terminate")

While 1
    Sleep(100)
WEnd    

Func TogglePause()
    HotKeySet("{SPACE}")    
    While $Paused
        sleep(1)
        Send("{SPACE}")      
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc

Though you won't be able to pause it with space now :)

HotKeySet

Sets a hotkey that calls a user function.

HotKeySet ( "key" [, "function"])

Parameters

key The key(s) to use as the hotkey. Same format as Send().

function [optional] The name of the function to call when the key is pressed. Leave blank to unset a previous hotkey.

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

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