Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/09/2014 in all areas

  1. Hotkeyset() without error checking is very common. Even help file examples omit it sometimes. I've written code to set, check and process hotkeys in one function. See this example: _HotKey("{ESC}") ; hotkey to exit script. _HotKey("{F1}") ; hotkey to show AutoIt help. _HotKey("{F2}") ; hotkey with missing CASE code. _HotKey("#") ; invalid hotkey _HotKey("{F12}") ; F12 is reserved to the system. While Sleep(100) ; here should be your application. WEnd ; meanwhile, here is a dummy loop. Func _HotKey($hotkey = "") Switch @HotKeyPressed Case "{ESC}" Exit MsgBox(64 + 262144, Default, "Exit", 1) Case "{F1}" ShellExecute("http://www.autoitscript.com/autoit3/docs/functions/HotKeySet.htm") Case Else If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed) If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.") EndSwitch EndFunc ;==>_HotKey For ease of use, I've written an abbreviation script: #include <StringConstants.au3> #include <MsgBoxConstants.au3> While Sleep(100) If Not WinClose("[REGEXPTITLE:au3UserAbbrev.properties|au3.keywords.user.abbreviations.properties]") Then ExitLoop WEnd ShellExecute("NotePad.exe", @LocalAppDataDir & "\AutoIt v3\SciTE\au3UserAbbrev.properties", "", "", @SW_SHOW) ShellExecute("NotePad.exe", @LocalAppDataDir & "\AutoIt v3\SciTE\au3.keywords.user.abbreviations.properties", "", "", @SW_SHOW) $WinHandle1 = (WinWait("[REGEXPTITLE:au3UserAbbrev.properties]", "", 5) ? (WinActivate("[LAST]") ? WinWaitActive("[LAST]") : 0) : SetError(1, 0, 0)) $WinHandle2 = (WinWait("[REGEXPTITLE:au3.keywords.user.abbreviations.properties]", "", 5) ? (WinActivate("[LAST]") ? WinWaitActive("[LAST]") : 0) : SetError(1, 0, 0)) $Text1 = ControlGetText($WinHandle1, "", "Edit1") $Text2 = ControlGetText($WinHandle2, "", "Edit1") $Abbrev = @CRLF & 'hk=\n' & _ '_HotKey("{ESC}")\n' & _ '_HotKey("{|}")\n' & _ 'Func _HotKey($hotkey = "")\n' & _ ' Switch @HotKeyPressed\n' & _ ' Case "{ESC}"\n' & _ ' Exit MsgBox(64 + 262144, Default, "Exit", 1)\n' & _ ' Case "{???}"\n' & _ ' Beep()\n' & _ ' Case Else\n' & _ ' If Not IsDeclared("hotkey") Then Return MsgBox(16 + 262144, Default, "No CASE statement defined for hotkey " & @HotKeyPressed)\n' & _ ' If HotKeySet($hotkey, "_Hotkey") = 0 Then Return MsgBox(16 + 262144, Default, "Hotkey " & $hotkey & " invalid or set by another application.")\n' & _ ' EndSwitch\n' & _ 'EndFunc ;==>_HotKey\n\n' & _ 'While Sleep(100) ; here should be your application.\n' & _ 'WEnd ; meanwhile, here is a dummy loop.\n' & _ '\n' & @CRLF & @CRLF If Not (StringInStr($Text1, $Abbrev)) Then $Text1 = StringStripWS($Text1, $STR_STRIPTRAILING) ControlSetText($WinHandle1, "", "Edit1", $Text1 & @CRLF & $Abbrev & @CRLF) ControlSend($WinHandle1, "", "", "^s") EndIf If Not (StringInStr($Text2, " hk ")) Then $Text2 = StringStripWS($Text2, $STR_STRIPTRAILING) ControlSetText($WinHandle2, "", "Edit1", $Text2 & " hk ") ControlSend($WinHandle2, "", "", "^s") EndIf $aPos = WinGetPos($WinHandle1) WinActivate($WinHandle1) WinMove($WinHandle1, "", $aPos[0], $aPos[1] + 100) MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, " ", "Abbreviation ""hk "" is installed. ", 0) WinMove($WinHandle1, "", $aPos[0], $aPos[1]) WinClose($WinHandle1) WinClose($WinHandle2) Just run this script and restart the SciTE editor. Enter "hk " (without quotes). Please note the blank after hk . A skeleton code appears with the cursor at the convenient location. Enter your hotkey code and place a corresponding case statement some lines below. Enjoy.
    1 point
  2. Jos

    ControlGetText = NULL?

    The question at hand is not about something being bad or not but simply: Is this Patch or also called Hack in violation with Microsoft's EULA. Reading up about it, it seems it is which to me means this topic is in violation of our forum rules. Closing this topic as such unless somebody proves this is legitimate. Jos
    1 point
  3. The first parameter should contain the value of the handle returned by GUICtrlCreateIcon() So guess this should work: GUICtrlSetImage(Eval($Sites[$i][0]), "bullet_red.ico", -1) Jos
    1 point
  4. Yes yes, I glow in the dark. For example, every time that Einstain guy would came up with some new scheme first thing he'd do is consult my supreme(ness). I would say to him: "Ok Albert, this is fine, but wtf is this? Give me the chalk! Let me draw it for you, simple and ad hoc, you'll get nowhere just depending on our small talk. Learning, learning and nothing but learning, that's the only way to see what's good and what's, OMFG, concerning. Different things for you to be aware, ...doh see this, your "c" here misses square. The rest is more or less ok, so for you, something contemplative - Albert remember, everything is relative."
    1 point
  5. jchd

    Beginner

    You have been given several times the exact same answer to the exact same question you yourself posted previously on the French forum. And now you behave the same here: complain that you have "no solution" since «you don't know how to use it», while clearly displaying absolutely zero effort to even try the advice provided (quickly and for free, should I need to remind you). This behavior speaks volume about how you respect helpful, skilled and seasonned users from both fora. Are you now going to similarly annoy kind users of the German, Russian, Brazillian and Klingon† fora or can we expect that you start growing up someday? † humble apologies to those I omit to mention.
    1 point
  6. JackDinn, You were right - there is a better way. ;-) lafafmentvotre, Create your combo with the $CBS_SORT style. remember that you will need to BitOR this style with the default ones if you still want them. This is slightly modified from the Help file example for GUICtrlCreateCombo - you can see the muddled order when items are put in the combo, which are then sorted automatically when the GUI is displayed: #include <ComboConstants.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $msg GUICreate("My GUI combo", 500, 500) ; will create a dialog box that when displayed is centered GUICtrlCreateCombo("", 10, 10, 200, 20, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL, $WS_VSCROLL, $CBS_SORT) ); BitOr required styles GUICtrlSetData(-1, "item3|item1|item2", "item3"); add muddled item list and set a default GUISetState() ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example M23
    1 point
×
×
  • Create New...