Jump to content
Sign in to follow this  
Hina

How Can I set Hot Key in this code?& where?

Recommended Posts

Hina

;#""""" This is option which is used to hide the trayicone""""#
OPt("TrayIconHide", 1)
; While loop is used because window was not changing start without using while loop;
While 1
    If Not FileExists(@DesktopDir&"\ciit.txt")Then
;.........:...:Get The Controll of a Window to Set Title:...:...:.......;
        ControlSetText("[Class:Shell_TrayWnd]", "", "[CLASS:Button; INSTANCE:1]", "MBA")
;.........;-;...:::Make the entries in Registry:::...;-;.......;
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Rename Start Button", "REG_SZ", @DesktopDir&"\Rename Start Button.exe")
;::Sleep in the code for a little rest to computer::...
        Sleep(5000)
    Else
;=========                                                                                                    ========;
;!!!        From this the code will be directly out if file is present @ desktop with name ciit & extension .txt      !!!
;=========                                                                                                    ========;
        MsgBox(16, "Error", "Cannot Run On Ur PC")
        Exit
    EndIf
    Sleep(5000)
WEnd

Also do find the mistake in this code if present. And If U have to write the same code how U write the same code??

Edited by COMSATS

Share this post


Link to post
Share on other sites
NBJ

Hi Comsats

a hot key can be set to call a function from the command

HotKeySet ( "key" , "function" ) it can be placed in your script anywhere to set the hotkey to be active at that point in the script.

It can be called HotKeySet ( "key" ) to disable the hotkey.

Depending on what you want it to do and when you want it active depends on where and how you format it in your script.

Hope that helps

NBJ

Share this post


Link to post
Share on other sites
Hina

Can u put the HotKeySet function in my above given code??

Share this post


Link to post
Share on other sites
NBJ

What do you want the hotkey to be?

What do you want the hotkey to do?

When do you want the hotkey to be active?

When do you want the hotkey to be de-activated?

Share this post


Link to post
Share on other sites
Hina

I want to exit my code with the help of HotKeySet option from loop

Share this post


Link to post
Share on other sites
NBJ

I want to exit my code with the help of HotKeySet option from loop

@COMSATS - what did you try? the HelpFile is quite detailed.

;#""""" This is option which is used to hide the trayicone""""#
HotKeySet("{Esc}", "_EXIT")
OPt("TrayIconHide", 1)
; While loop is used because window was not changing start without using while loop;
While 1
    If Not FileExists(@DesktopDir&"\ciit.txt")Then
;.........:...:Get The Controll of a Window to Set Title:...:...:.......;
        ControlSetText("[Class:Shell_TrayWnd]", "", "[CLASS:Button; INSTANCE:1]", "MBA")
;.........;-;...:::Make the entries in Registry:::...;-;.......;
        RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "Rename Start Button", "REG_SZ", @DesktopDir&"\Rename Start Button.exe")
;::Sleep in the code for a little rest to computer::...
        Sleep(5000)
    Else
;=========                                                                                                      ========;
;!!!        From this the code will be directly out if file is present @ desktop with name ciit & extension .txt      !!!
;=========                                                                                                      ========;
        MsgBox(16, "Error", "Cannot Run On Ur PC")
        Exit
    EndIf
    Sleep(5000)
WEnd



Func _EXIT()
    Exit
EndFunc

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.