Jump to content

ahmet

Active Members
  • Posts

    264
  • Joined

  • Last visited

  • Days Won

    1

ahmet last won the day on May 6 2012

ahmet had the most liked content!

About ahmet

  • Birthday 08/18/1992

Profile Information

  • Location
    Bosnia and Herzegovina

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

ahmet's Achievements

  1. Here is modified example from help file #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WinAPIGdi.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a combobox control. Local $idComboBox = GUICtrlCreateCombo("", 10, 10, 185, 20) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Add additional items to the combobox. GUICtrlSetData($idComboBox, "1|2|3|4|5|6|7|8|9|10", "") ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $sComboRead = "" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idComboBox ;here are actions that will be done when user choses value from combobox GUICtrlSetBkColor($idComboBox,0x00FF00) _WinAPI_RedrawWindow($hGUI) ;$sComboRead = GUICtrlRead($idComboBox) ;MsgBox($MB_SYSTEMMODAL, "", "The combobox is currently displaying: " & $sComboRead, 0, $hGUI) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example When asking for help usually it is best practice to post entire code.
  2. It looks like you are confusing return value of function with @error value. RegDelete can return 3 possible values: 1, 0 and 2 (your variable $iRegDelete). If a key is deleted then the value of $iRegDelete will be 1. If there is no key then the value of $iRegDelete will be 0. If there is an error deleting a key then the value of $iRegDelete will be 2 and value of @ error will tell you what kind of error happened in this particular case for value of 2. So for this function if the key does not exists it is when the function executes it is considered as a success - no @error code is set.
  3. Well, of course 1 is a success, and of course @error=0 means there were not any errors and @error=1 means there was some error. You are referring to the return value of the function. If that particular function succeeds then the value of $iRegWrite will be equal to 1. If that function fails then the value of $iRegWrite will be 0. You could write your code like this If $iRegWrite=1 Then ;what to do if RegWrite succeeds Else ;what to do if $iRegWrite has any other value (only zero possible) EndIf Inside "Else" statement you could check for specific error using values of @error.
  4. No, I did not. When everything goes well then @error has value of 0 - it means there was no error.
  5. I hope that I have not misunderstood your question.
  6. If you look in the help file for RegWrite there are following lines: Return Value Success: 1. Failure: 0 and sets the @error flag to non-zero if error writing registry key or value. @error: 1 = unable to open requested key 2 = unable to open requested main key 3 = unable to remote connect to the registry -1 = unable to open requested value -2 = value type not supported. So if @error=1 then if for any reason RegWrite files to open key you will get that first splash message "NOTICE!!", "The Reg String " & $sString & " was not succesfully updated!" If you want that message to be shown for each error that is listed above then you should write: "If @error Then" which means "if @error is anything except 0 then". When there is not an error, when everything goes well, then @error has value of 0.
  7. Does ObjaCreateInterface do something similar?
  8. Under remarks for GUICtrlSetData() there is this line: "If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed. A trailing GUIDataSeparatorChar is ignored." So your "later" line should be Local $t = "|Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday"
  9. Hi, Based on this here is modified example from help file: #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui, $iMsg, $idBtnNext, $iStep = 0, $idLblMsg, $hRichEdit $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 320, 350, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "This is a test.", 10, 10, 300, 220, _ BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) $idLblMsg = GUICtrlCreateLabel("", 10, 235, 300, 60) $idBtnNext = GUICtrlCreateButton("Next", 270, 310, 40, 30) GUISetState(@SW_SHOW) _GUICtrlRichEdit_SetText($hRichEdit, "First paragraph") While True $iMsg = GUIGetMsg() Select Case $iMsg = $GUI_EVENT_CLOSE _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes ; GUIDelete() ; is OK too Exit Case $iMsg = $idBtnNext $iStep += 1 Switch $iStep Case 1 _GUICtrlRichEdit_SetUndoLimit($hRichEdit, 200) GUICtrlSetData($idLblMsg, "Increased the number of actions that can stored in the undo queue from 100 to 200") Case 2 _GUICtrlRichEdit_SetUndoLimit($hRichEdit, 0) GUICtrlSetData($idLblMsg, "Undo is disabled") GUICtrlSetState($idBtnNext, $GUI_DISABLE) EndSwitch EndSelect WEnd EndFunc ;==>Example There is also message EM_SETTEXTEX.
  10. When you catch error on FileOpen then try with _WinAPI_GetLastErrorMessage. If it fails show your code with _WinAPI_GetLastErrorMessage.
  11. What about this Global Const $HKM_SETHOTKEY = $WM_USER + 1 Global Const $HKM_GETHOTKEY = $WM_USER + 2 Global Const $HOTKEYF_SHIFT=0x01, $HOTKEYF_CONTROL=0x02, $HOTKEYF_ALT=0x04;https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-sethotkey Global $KeyPressed ... func onChange() $key=SendMessage($hInput, $HKM_GETHOTKEY) ConsoleWrite("onChange: " & $key & @CRLF) $loword=_WinAPI_LoWord($key) $lobyte=_WinAPI_LoByte($loword);key $hibyte=_WinAPI_HiByte($loword);modifier key ConsoleWrite("LOBYTE=" & $lobyte & @CRLF) ConsoleWrite("HIBYTE=" & $hibyte & @CRLF) If ($lobyte<>0 And BitAND($hibyte,$HOTKEYF_SHIFT)=$HOTKEYF_SHIFT And BitAND($hibyte,$HOTKEYF_CONTROL)=$HOTKEYF_CONTROL ) Then ConsoleWrite("hotkey changed" & @CRLF) ElseIf ($KeyPressed<>0 And (BitAND($hibyte,$HOTKEYF_SHIFT)=$HOTKEYF_SHIFT Or BitAND($hibyte,$HOTKEYF_CONTROL)=$HOTKEYF_CONTROL)) Then ;any key with shift or control pressed ConsoleWrite("!Key with either shift or ctrl" & @CRLF) $KeyCombo=_WinAPI_MakeWord($KeyPressed,$hibyte);key, modifier key $KeyCombo2=_WinAPI_MakeLong($KeyCombo,0) SendMessage($hInput, $HKM_SETHOTKEY, $KeyCombo2, 0) ElseIf $lobyte<>0 Then ConsoleWrite("+LoByte<>0" & @CRLF) $KeyPressed=$lobyte EndIf EndFunc This is still not working, but the idea is to check if there is a key pressed alongside CTRL or SHIFT. If there is store it to $KeyPressed variable. Then if user presses one of the other keys, CTRL or SHIFT, add that key to the combo. I can not test any more as I am going to bed.
  12. It should be possible to look for specific key combinations (using BitAnd on HiByte and LoByte) in onChnage function and if you encounter them then reset the input. You will have to find a way to reset hot key control programatically.
  13. What about following Global Const $HKM_GETHOTKEY = $WM_USER + 2 Global Const $HOTKEYF_SHIFT=0x01;https://learn.microsoft.com/en-us/windows/win32/inputdev/wm-sethotkey .... func onChange() $key=SendMessage($hInput, $HKM_GETHOTKEY) ConsoleWrite("onChange: " & $key & @CRLF) $loword=_WinAPI_LoWord($key) $lobyte=_WinAPI_LoByte($loword) $hibyte=_WinAPI_HiByte($loword) ConsoleWrite("LOBYTE=" & $lobyte & @CRLF) ConsoleWrite("HIBYTE=" & $hibyte & @CRLF) If ($lobyte<>0 And $hibyte=$HOTKEYF_SHIFT) Then ConsoleWrite("hotkey changed" & @CRLF) EndIf EndFunc HKM_GETHOTKEY has valuable information about how to get what keys are pressed. If you need further help feel free to ask.
  14. Post all the code you have. There is a better chance that somebody takes a look at it. .
×
×
  • Create New...