Jump to content
Sign in to follow this  
Gawish

HotKeySet problem

Recommended Posts

Gawish

pls can anyone tell me what's wrong in this code

HotKeySet("2", "auto0")

While 1
    ;a loop
WEnd

Func auto0()
opt("SendKeyDelay",0)
 opt("SendKeyDownDelay",0)
 send("{F4}{1}")
 send("{F1}{1}")
 EndFunc
 
 HotKeySet("3", "auto1")

While 2
   ;a loop
WEnd

Func auto1()
opt("SendKeyDelay",0)
 opt("SendKeyDownDelay",0)
 send("{F4}{5}")
 send("{F1}{2}")
 EndFunc

Share this post


Link to post
Share on other sites
FireFox

Hi,

Welcome to the autoit forum :)

Your script is stuck at the first endless loop, the rest of the script outside your funcs won't be executed.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Gawish

when i add first part of the code it workfine

like this

HotKeySet("2", "auto0")

While 1
    ;a loop
WEnd

Func auto0()
opt("SendKeyDelay",0)
 opt("SendKeyDownDelay",0)
 send("{F4}{1}")
 send("{F1}{1}")
 EndFunc

i want to know how to add more HotKeySet event

Share this post


Link to post
Share on other sites
FireFox

Structure of the code:

HotKeySet( ...
HotKeySet( ...
 
Opt( ...
 
While 1
    ; endless loop
    Sleep(10) ; avoid high CPU usage
WEnd
 
Func _MyFunc1 ...
 
Func _MyFunc2 ...
 
;etc

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Gawish

sry man i got error again

HotKeySet ("2", "myfunce1")

opt("SendKeyDelay",0) 
 opt("SendKeyDownDelay",0) 
 
 While 1
    ; endless Loop
    Sleep(10) ; avoid high CPU usag
    WEnd
    
    Func myfunce1()
   send("{F4}{2}") 
   send("(F1)(3)")
   EndFunc

Share this post


Link to post
Share on other sites
FireFox

Your Send("{F4}{2}") sends the key 2 which is registered by your HotKeySet function so it calls myfunce1 and so on, hence the stack overflow error.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
Gawish

pls can u post full ex

Share this post


Link to post
Share on other sites
FireFox

There is no example to post as your script has no sense to me.

Tell us what you're trying to achieve and what for are you using this script.

Hence we will show you more reliable ways to automate that.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  

×