Jump to content

SlimShady

Active Members
  • Posts

    2,276
  • Joined

  • Last visited

About SlimShady

  • Birthday 09/09/1986

Profile Information

  • Member Title
    AutoIt lover
  • Location
    The Netherlands

Recent Profile Visitors

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

SlimShady's Achievements

Universalist

Universalist (7/7)

1

Reputation

  1. Can you drop an executable on a button and trigger a function? I can't get $WS_EX_ACCEPTFILES to work AND trigger an event on a button. On a window it's fine, but I don't want that (+ icon in the window client area). Could anyone meddle with this test code and see if it's possible? Thanks. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= global $Form1 = GUICreate("Form1", 625, 443, 192, 124, -1, $WS_EX_ACCEPTFILES) global $input1 = GUICtrlCreateInput("", 120, 140, 120, 17, $WS_GROUP, $WS_EX_ACCEPTFILES) global $Button1 = GUICtrlCreateButton("Button1", 120, 88, 97, 41, $WS_GROUP, $WS_EX_ACCEPTFILES) GUICtrlSetState($input1, $GUI_DROPACCEPTED); GUICtrlSetState($Button1, $GUI_DROPACCEPTED); GUISetOnEvent($GUI_EVENT_CLOSE, '_onClose'); GUISetOnEvent($GUI_EVENT_DROPPED, "_evDroppedFiles2") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Const $WM_DROPFILES = 0x233; GUIRegisterMsg($WM_DROPFILES, "On_WM_DROPFILES") While 1 Sleep(100) WEnd Func _onClose() GUIDelete() Exit EndFunc Func _evDroppedFiles2() MsgBox(64, 'fun2', @GUI_DragFile) EndFunc Func _evDroppedFiles(ByRef $dFiles) local $x, $files; For $x = 0 To UBound($dFiles)-1 $files &= $dFiles[$x] & ', ' Next MsgBox(64, 'func1', StringTrimRight($dFiles, 2)); EndFunc Func On_WM_DROPFILES($hWnd, $Msg, $wParam, $lParam) Local $tDrop, $i, $aRet, $iCount; ;string buffer for file path $tDrop = DllStructCreate("char[260]") ;get file count $aRet = DllCall("shell32.dll", "int", "DragQueryFile", _ "hwnd", $wParam, _ "uint", -1, _ "ptr", DllStructGetPtr($tDrop), _ "int", DllStructGetSize($tDrop) _ ) $iCount = $aRet[0] ;get file paths local $aDraggedFiles[$iCount]; For $i = 0 To $iCount-1 $aRet = DllCall("shell32.dll", "int", "DragQueryFile", _ "hwnd", $wParam, _ "uint", $i, _ "ptr", DllStructGetPtr($tDrop), _ "int", DllStructGetSize($tDrop) _ ) $aDraggedFiles[$i] = DllStructGetData($tDrop, 1); Next ;finalize DllCall("shell32.dll", "int", "DragFinish", "hwnd", $wParam) Return _evDroppedFiles($aDraggedFiles); EndFunc
  2. Looks cool though!
  3. It had to be more simple than that. But thanks anyways. I got it fixed with _Sendmessage. #Include <GuiButton.au3> #include <SendMessage.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global Const $IMAGE_ICON = 0x0001; GUICreate("My GUI") ; will create a dialog box that when displayed is centered dim $btn1 = GUICtrlCreateButton("", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) dim $btn2 = GUICtrlCreateButton("Clear", 65, 20, 80, 50) GUISetState() ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $btn2 _SendMessage(GUICtrlGetHandle($btn1), $BM_SETIMAGE, $IMAGE_ICON, 0) Case $GUI_EVENT_CLOSE GUIDelete(); Exit EndSwitch WEnd
  4. I also discovered a bug related to buttons and icons. It crashed afterwards. I will minimize my script to reproducible code and add it to the bugtracker.
  5. How do you clear the icon after you've set it? Test code: #include <ButtonConstants.au3> #Include <GuiButton.au3> #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) GUICreate("My GUI") ; will create a dialog box that when displayed is centered dim $btn1 = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUICtrlSetImage(-1, "shell32.dll", 22) dim $btn2 = GUICtrlCreateButton("Clear", 65, 20, 80, 50) GUISetState() ; Run the GUI until the dialog is closed While 1 Switch GUIGetMsg() Case $btn2 GUICtrlSetImage($btn1, ''); Case $GUI_EVENT_CLOSE GUIDelete(); Exit EndSwitch WEnd
  6. Hi, I have a GUI with many buttons and all of them use a similar context menu. Because AutoIt doesn't support cloning controls, we need to create each button it's own context menu. I'm using OnEventmode for convenience. On clicking a menu item, a function is run. The function has a reference to @GUI_CtrlHandle, which is the clicked menuitem. But I need a reference to the button which was right clicked. How do I do that? Is there someway like getparent or something?
  7. You have made a decision which the majority agrees with. You can close it if you ask me.
  8. Sounds great! More scripting pleasure
  9. The old versions are still compatible you know.
  10. Be sure the Scehduler service is enabled&started.
  11. Does 'no support' also mean 'no bugfixes' for the legacy version?
  12. The archive is corrupt. You can see the size is 1MB while the previous was 5.6MB.
  13. The instance seems less important. We can put that one last, behind the other properties. What I was thinking; Don't put too many characters in the properties. Like the colon, semi-colon and the mandatory last bracket inline. Suggestions: - An array to have the options (eg. instance, future options?) seperate from the CLASS/TITLE/REGEXP Which also gives you the ability to store, reuse the array and update the option/instance. - Property name at the beginning eg. [CLASS] ARandomClassname Examples: ['[TITLE] Thunderbird', 3] ['[CLASS] MozillaUIWindowClass', 1] ['[REGEXP] [Tt]hunder[Bb]ird', 2] ;// OR [/[Tt]hunder[Bb]ird/, 2] ;// Combination ['[TITLE] Thunderbird', '[CLASS] MozillaUIWindowClass', 1] If WinExists(['[TITLE] Thunderbird']) Then WinActivate('[LAST]') And for compatibility allow string input. It's faster too.
  14. If the problem is with RegExp, you could add a specific format for that. An expression between slashes like Javascript has: /[Aa]uto[ii]t3/ And using it in for instance WinExists: If WinExists(/[Aa]uto[ii]t3/) Then WinFlash("[LAST]")
×
×
  • Create New...