Sign in to follow this  
Followers 0
yousefsamy

@sw_disable isn't working with me !!

16 posts in this topic

here is my code :

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

FileInstall("mpos.ico",@TempDir & "\mpos.ico")

Opt("TrayMenuMode", 1)



Func _MouseGetPos()
$aPos = MouseGetPos()
MsgBox(0 ,"", $aPos[0] & ", " & $aPos[1])
EndFunc

HotKeySet("p","_MouseGetPos")

$Form1 = GUICreate("Mouse Position", 117, 47, 192, 124)
GUISetBkColor(0x99B4D1)
$Label1 = GUICtrlCreateLabel("Mpos", 40, 8, 50, 28)
GUICtrlSetFont(-1, 14, 400, 0, "Neo Tech Alt Medium")
TraySetIcon(@TempDir & "\mpos.ico",-1)
TraySetClick("1")
$Hello = TrayCreateMenu("Hello")
$GetPosition = TrayCreateItem("GetPosition[Hot-Key={p}]", $Hello)
$off = TrayCreateItem("turn off", $Hello)
$Start = TrayCreateItem("Start-With-Win", $Hello)
$About = TrayCreateItem("About", $Hello)
$Exit = TrayCreateItem("Exit", $Hello)
GUISetState(@SW_HIDE)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
    Switch TrayGetMsg()
        Case $GetPosition
            _MouseGetPos()

        Case $Start
            FileCreateShortcut(@WorkingDir & "\mpos.exe",@StartupCommonDir & "\mpos.exe",@WorkingDir & "\mpos.exe","","",@TempDir & "\mpos.ico")

        Case $About
            MsgBox(0,"Welcome Dear","الحمد لله[Wise-Hacker]Coder")

        Case $Exit
            ExitLoop
        Case $off ;Here i want to disable the effect of tool but it's working

            GUISetState(@SW_DISABLE)




            EndSwitch
WEnd

Share this post


Link to post
Share on other sites



yousefsamy,

You never display the GUI (GUISetState(@SW_HIDE)) so how do you know if it disabled or not? :huh:

If I change the code to show the GUI then it is indeed disabled when the menu item is selected. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

this tool has a hotkey [P] ,, i want to disable and enable this hotkey i think i can do that with @sw_disable 

do you understand what i want to do ?

Edited by yousefsamy

Share this post


Link to post
Share on other sites

No, you can't enable and disable the hotkey that way. 

Read the help file about hotkeys.

For once, you really need to start doing the reading because it's getting obvious that either reading or programming isn't something you should be doing.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

hay bro i am 15 years old and i am Arabian one it's hard to me to read all that i want simple ideas i think u can understand that right ?? !!! 

Share this post


Link to post
Share on other sites

hhhhhhh it's very bad -_-

Share this post


Link to post
Share on other sites

still dont know the answer  :

Share this post


Link to post
Share on other sites

Don't bump your posts in less than 24 hours, this isn't a 24/7 help desk, it's a group of people that know the language and like trying to help out.

You get the help when someone with the knowledge or desire to help comes along, not on your time frame but on theirs. Be patient, you posted that exactly 1 hour after your last post.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

i think you know the answer  :shifty:

Share this post


Link to post
Share on other sites

yousefsamy,

 

a hotkey [P] ,, i want to disable and enable this hotkey

From the Help file page for HotKey:

 

function : The name of the function to call when the key is pressed. Not specifying this parameter will unset a previous hotkey

So to activate a HotKey you specify a function:

HotKey("P", "_MouseGetPos")
and to deactivate it you do not:

HotKey("P")
You can see it working here:

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

HotKeySet("p", "_Test")

$hGUI = GUICreate("Test", 500, 500)

$cAct = GUICtrlCreateButton("Active", 10, 10, 80, 30)
GUICtrlSetState($cAct, $GUI_DISABLE)
$cDeAct = GUICtrlCreateButton("Deactivate", 10, 100, 80, 30)

GUISetState()

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $cAct
            HotKeySet("p", "_Test")
            GUICtrlSetState($cAct, $GUI_DisABLE)
            GUICtrlSetState($cDeAct, $GUI_ENABLE)
        Case $cDeAct
            HotKeySet("p")
            GUICtrlSetState($cDeAct, $GUI_DISABLE)
            GUICtrlSetState($cAct, $GUI_ENABLE)
    EndSwitch
WEnd

Func _Test()
    MsgBox($MB_SYSTEMMODAL, "Hi", "Active & Pressed")
EndFunc
Note I am using the lowercase character "p" to define the HotKey as this is more reliable with some keyboards - as is explained in the Help file. ;)


We all appreciate that you are young and that English is not your first language - we are also very happy to help you learn how to code in AutoIt. But you need to do some work as well - particularly when it comes to reading the Help file. You believed that SW_DISABLE disabled HotKeys - but if you search for that in the Help file you see:

 

@SW_DISABLE : Disables the window

No mention of HotKey there. And I have already posted above the extract from the HotKey page which explains exactly how to set and unset a HotKey. So please make sure that you read the relevant pages of the Help file carefully. We are very proud of that Help file as it is possibly the most comprehensive example out there and some of community spend (have spent) a great deal of time getting it to that state. ;)

You are beginning to alienate several of the long-term members by seemingly not making much effort to get the basics correct. So calm down and start helping yourself by trying to find some of the answers in the Help file and not just rushing to post in the forum whenever you have the smallest question. As I said before, we all understand that you are young and not a native anglophone - but you need to show that you are willing to make some effort as well. :)

حظا سعيدا والترميز جيدة

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Thnx

حظا سعيدا والترميز جيدة

this phrase from google i am sure ,, you have no grammar in Arabic  :P

Share this post


Link to post
Share on other sites

You post on his grammar, did you bother to take to heart what he is trying to tell you?

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

really i cant understand this word الترميز

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

The English translation of that word is coding. That word, as used in that phrase, means to write code.

Edited by somdcomputerguy
1 person likes this

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

yea i understand it now ^_^  coding in my language called البرمجة

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  
Followers 0