Jump to content

SagePourpre

Active Members
  • Posts

    27
  • Joined

  • Last visited

Everything posted by SagePourpre

  1. Oh. The solution you provide on that topic is exactly what I needed. Thank you ( a lot ). Problem is solved.
  2. Hi everybody. I'm turning around this little unsolved problem I got last week and still can't figure it out. So I thought maybe someone in here would have an idea of how exactly to cure my soul of this unanswered mystery of mine. The script below create a new menu in your scite window called "autoit". It have one item. I would need now to assign an event to the item when user click it ? Any idea how to listen for these events ? #include <WinAPI.au3> #include <WindowsConstants.au3> #include <Misc.au3> #include <GuiMenu.au3> #include <GuiConstantsEx.au3> Opt('GuiOnEventMode',1) ; '[CLASS:SciTEWindow]' $hWnd = WinGetHandle('[CLASS:SciTEWindow]') $hMain = _GUICtrlMenu_GetMenu($hWnd) Local Enum $iditem1 = 100000 $hMenu = _GUICtrlMenu_CreateMenu() _GUICtrlMenu_InsertMenuItem($hMenu,0,'Item 1',$iditem1) _GUICtrlMenu_InsertMenuItem($hMain, 9, "&AutoIt", 0, $hMenu) _GUICtrlMenu_DrawMenuBar($hWnd) $dll = DllOpen('user32.dll') While Not _IsPressed(23,$dll) ; Press end to terminate script and remove menu Sleep(100) WEnd DllClose($dll) _GUICtrlMenu_RemoveMenu($hMain,9)
  3. If...ElseIf...Else...EndIf -------------------------------------------------------------------------------- Conditionally run statements. If <expression> Then statements ... [ElseIf expression-n Then [elseif statements ... ]] ... [Else [else statements] ... EndIf Source : Autoit Helpfile ( F1 )
  4. I would have a question... Is it possible to get the "Handle to the RAWINPUT structure" that lparam provide in WM_INPUT but in the keyproc function. I need the 'hdevice' before WM_INPUT so I can decide accordingly to the HID keyboard that performed the action if : - I want to perform default action (ex : Typing letter 'q' will output 'q' - I want to perform something totally different (ex : Typing letter 'q' from second 'hdevice' actually perform a function) #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <RawInput.au3> #include <WinAPI.au3> #Include <WindowsConstants.au3> HotKeySet('{ESC}', '_EXIT') Global $tRID_KD, $pRID_KD, $iRID_KDj Global $tRIH, $iRIH Global $iNumDevices Global $hGUI Global $sHexKeys, $sMouse, $sString, $hHookKeyboard, $pStub_KeyProc $hGUI = GUICreate('Test', 100, 100) GUIRegisterMsg($WM_INPUT, 'OnInput') $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") $hHookKeyboard = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($pStub_KeyProc), _WinAPI_GetModuleHandle(0), 0) $tRID_KD = DllStructCreate($tagRAWINPUTDEVICE) $pRID_KD = DllStructGetPtr($tRID_KD) $iRID_KD = DllStructGetSize($tRID_KD) $tRIH = DllStructCreate($tagRAWINPUTHEADER) $iRIH = DllStructGetSize($tRIH) $iNumDevices = 1 DllStructSetData($tRID_KD, 'usUsagePage', 0x01) DllStructSetData($tRID_KD, 'usUsage', 0x06) DllStructSetData($tRID_KD, 'dwFlags', BitOR($RIDEV_NOLEGACY, $RIDEV_INPUTSINK)) DllStructSetData($tRID_KD, 'hwndTarget', $hGUI) _RegisterRawInputDevices($pRID_KD, $iNumDevices, $iRID_KD) While 1 Sleep(20) WEnd GUIDelete() Func _EXIT() GUIDelete() DllCallbackFree($pStub_KeyProc) _WinAPI_UnhookWindowsHookEx($hHookKeyboard) Exit EndFunc Func OnInput($hwnd, $iMsg, $iwParam, $ilParam) Local $tRI_KD, $pRI_KD, $iRI_KB Local $iSize $tRI_KD = DllStructCreate($tagRAWINPUT_KEYBOARD) $pRI_KD = DllStructGetPtr($tRI_KD) $iRI_KB = DllStructGetSize($tRI_KD) _GetRawInputData($ilParam, $RID_INPUT, $pRI_KD, $iRI_KB, $iRIH) If Not @error Then ConsoleWrite(DllStructGetData($tRI_KD, 'Message') & @LF) ConsoleWrite(DllStructGetData($tRI_KD, 'VKey') & @LF) ConsoleWrite(DllStructGetData($tRI_KD, 'hDevice') & @LF) EndIf $tRI_KD = 0 Return 'GUI_RUNDEFMSG' EndFunc Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, 'vkCode') ConsoleWrite($vkCode & @CRLF) Switch $wParam Case $WM_KEYDOWN, $WM_SYSKEYDOWN If $vkCode = 0x41 Then ;_keybd_event(0x61, 0) ; Return -1 EndIf EndSwitch Return _WinAPI_CallNextHookEx($hHookKeyboard, $nCode, $wParam, $lParam) EndFunc ;==>_KeyProc ;Func _keybd_event($vkCode, $Flag) ; DllCall('user32.dll', 'int', 'keybd_event', 'int', $vkCode, 'int', 0, 'int', $Flag, 'ptr', 0) ;EndFunc; _keybd_event I'll post back if I find something useful.
  5. Very interesting subject. I'm just beginning to figure out how to make it work but I love this piece of code enough to pop that subject up after 1 year of inactivity
  6. Thanks... that will be very useful !
  7. Maybe some dllcalls to SetSystemCursor of "thinking cursor" the same as the default one, acting as a makeup since "thinking" cursor now looks like "normal" cursor ( and of course, you restore the original "think cursor" back when leaving the script). Global Const $OCR_APPSTARTING = 32650 Global Const $OCR_NORMAL = 32512 Global Const $OCR_CROSS = 32515 Global Const $OCR_HAND = 32649 Global Const $OCR_IBEAM = 32513 Global Const $OCR_NO = 32648 Global Const $OCR_SIZEALL = 32646 Global Const $OCR_SIZENESW = 32643 Global Const $OCR_SIZENS = 32645 Global Const $OCR_SIZENWSE = 32642 Global Const $OCR_SIZEWE = 32644 Global Const $OCR_UP = 32516 Global Const $OCR_WAIT = 32514 ; _SetCursor(@WindowsDir & "\cursors\3dgarro.cur", $OCR_NORMAL) ;_SetCursor(@WindowsDir & "\cursors\3dwarro.cur", $OCR_NORMAL) ;_SetCursor(@WindowsDir & "\cursors\banana.ani", $OCR_NORMAL) ;================================================================== ; $s_file - file to load cursor from ; $i_cursor - system cursor to change ;================================================================== Func _SetCursor($s_file, $i_cursor) Local $newhcurs, $lResult $newhcurs = DllCall("user32.dll", "int", "LoadCursorFromFile", "str", $s_file) If Not @error Then $lResult = DllCall("user32.dll", "int", "SetSystemCursor", "int", $newhcurs[0], "int", $i_cursor) If Not @error Then $lResult = DllCall("user32.dll", "int", "DestroyCursor", "int", $newhcurs[0]) Else MsgBox(0, "Error", "Failed SetSystemCursor") EndIf Else MsgBox(0, "Error", "Failed LoadCursorFromFile") EndIf EndFunc That script, found earlier on the forum ( I don't have the link neither the author name ) would be a good start. The only thing I do not like is the "LoadCursorFromFile" that imply that we all use the default set of mouse cursor... I suppose that there is a way to get the handle of default cursor without getting it by the file but i'm not sure of how to do that... edit :WinAPIEx UDF seems to have some cursor ready-to-use functions...
  8. Hi. I'm trying to make the same display than on this image. Using treeview, here's what I accomplished. I'm trying to find a way to have bigger images to match the same size than for the first image. I searched over english and french forums + autoit help and treeviewconstants.au3 and didn't find what I was looking for. Is there such a way to have larger items images ? Also, if I want to push further and have multiline text for a control (with different color for the second line)... Is there a way known around here that I could have missed ? Thank you in advance. Here's the code of what I achieved to make #include <misc.au3> #include <ListViewConstants.au3> #include <GuiConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <TreeViewConstants.au3> $Gui = GuiCreate("Test",500,500,-1,-1,-1,$WS_EX_ACCEPTFILES) $tv = GUICtrlCreateTreeView(0,0,500,500,BitOR($TVS_FULLROWSELECT,$TVS_NONEVENHEIGHT)) GUICtrlSendMsg($tv,$TVM_SETITEMHEIGHT,110,0) GUICtrlCreateTreeViewItem("22ss" & @crlf & "s",$tv) GUICtrlSetImage(-1, "shell32.dll", 14) GUICtrlCreateTreeViewItem("22",$tv) GUICtrlSetImage(-1, "shell32.dll", 14) $22 = GUICtrlCreateTreeViewItem("22",$tv) GUICtrlSetImage(-1, "shell32.dll", 14) $22 = GUICtrlCreateTreeViewItem("22",$tv) GUICtrlSetImage(-1, "shell32.dll", 14) GUICtrlSetFont($22,20) GUICtrlSetImage(-1, "shell32.dll", 15) GUICtrlCreateTreeViewItem("22",$22) GUICtrlSetImage(-1, "shell32.dll", 16) GUISetState() While 1 If _IsPressed(01) Then While _IsPressed(01) GUICtrlSendMsg(-1,$TVM_CREATEDRAGIMAGE,0,0) WEnd EndIf $Msg = GUIGetMsg() Switch $Msg Case -3 Exit Case Else EndSwitch WEnd
  9. Nice. I was not sure how to make it work before your example of a valid settings.ini I'm currently trying it. (It will take a while before it has finished) I do not really have use for collecting everybody emails but I find this script very interesting. edit : Since the operation can take a while, it would be nice to not have the progressbar window with ontop attribute and possibly movable. (I would then put it on my second screen display to continue watching progress without blocking view in my first display )
  10. It still appears only by flash in the game window.
  11. I just need to see the gui in the background. However, if you know a way to show the gui and perform mouse actions, it would be an added bonus. (But just the gui showing it's nose in my game background would be amazing)
  12. I do not mind ... You're bringing ideas on the table Trying to use @SW_Maximize didn't work either... I tried also to set the game transparent, or use @SW_HIDE without success. ... And I didn't find anything on the subject anywhere else .
  13. My thinking about it ... I'm not sure of it at all but the way I imagine the problem is : There is some function in windows that set the Game OnTop and make sure it does stay this way while the game windows is active. I suppose there is probably a way to change the OnTop attribute windows give to this windows... Autoit WinSetOnTop seems to work for 100 ms (bringing the gui windows on top of the game) but whenever this is done, the game windows is brought back instantly to top. So... my supposition is that there is an inbuilt windows hook/function/whatever thing that react to any "parasite" windows trying to get on the way. Possibly... Such things could be disabled to enable any "parasite" windows to come on top of the fullscreen app. I do not have any idea of if my personal theory stand the way or not... but that how I mind mapped the problem.
  14. I tried your code too without success (adapted this way to trigger it in game) I can clearly see my other monitor workspace modified, but the first one (which is in game) stay unaffected while in game
  15. Tried them both... CODE#include <GUIConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 452, 193, 125,$WS_BORDER,$WS_EX_TOPMOST) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### HotKeySet("{HOME}","test") While 1 Sleep(100) WEnd Func test() $win = WinGetHandle("[ACTIVE]") WinSetOnTop($win,"",0) EndFunc Basically, this gui has topmost attribute. If I start a game, it got covered, In-game, pressing home perform the "test" function that set the game windows ontop attribute to 0, which briefly popup the gui through my game but then got covered again. I already tried those before without success (code is there if you want to see the result)
  16. That is exactly the problem... Speaking of a fullscreen app. or a game, they got the SetonTop attribute. So trying to give this attribute to my window using WinSetOnTop will flash my gui in-game but the Game seems to have priority and get over my gui in less than 500ms. So... I would need to do something to "remove" the onTop attribute of the game (or full screen-app) to override it with my gui . That's what i'm having trouble to figure out how to do it...
  17. Hi. I'd like to know if it's possible to make some gui to popup in a full-screen application or game ? I tried several ways to do it but nothing have succeed. The best result I have is the gui windows flashing in my game (like when you got a popup while in game ...) Is there a way to make the autoit gui on top of the fullscreen application ? Someone on another forum have pointed GuiRegistermsg to perform this but i'm not sure of how actually I would use it to perform that task. Any idea ? Thanks
  18. oh... Thank you. That'll do the trick
  19. Hi. I created a little search bar to search on most site and I wanted to add the autoit community but i'm facing this problem. Since the url is in php, where am I supposed to put my keywords on this url ? http://www.autoitscript.com/forum/index.php? Ex : For google, that's www.google.com/search?q=### ### = the keyword I entered in my inputbar But how am I doing this with this site since it's in php. Normally, i'm figuring it out but i'm clueless for this one.
  20. Got it.... Using GUICtrlSetOnEvent($BUTTON, "smiley") and Func Smiley() $a = ControlGetText($gui, "", @GUI_CtrlId) ... End Func
  21. Hi. I'm trying to do a script that open a msgbox when I click on a button. But, buttons are created by an array. CODE#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 625, 445, 193, 125) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Dim $button For $i = 1 to 24 $button = GUICtrlCreateButton($i,0+$i*12,0,10,10) GUICtrlSetData(-1,$i) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $button for $i = 1 to 24 if $i = $button Then MsgBox(0,"","") EndIf Next EndSwitch WEnd I want each buttons to display something different but i've done something wrong and right now, it don't react ... any idea ? thanks, Sage Pourpre
  22. Hi ! I would like to take off this expression all variables CODE$expression = 'MouseClick("left",$x,$Y,$click) I have thought of something like this. CODE$expression = stringsplit($expression,"$")it gives an array like that 1 = MouseClick("left", 2 = x, 3 = Y, 4 = $click) I want now that each string following array[2] to array[0] to be analysed and if symbols "+" "-" "=" ")" or " " to cut this string down again. Finally it would give me something like this 2 = x 3 = y 4 = click The names of my variables To recapitulate, here's the code I already made CODE$expression = 'MouseClick("left",$x,$Y,$click) $expression = stringsplit($expression,"$") Now I want to "read the string" stop at those symbols "+" "-" "=" ")" or " " and to return the result of what is between my stringsplit "$" and symbols, also known as ... variables names found in $expression
  23. Exactly what I was looking for . Thank you !
  24. Hi ! . I was trying to create a gui that would make X tabsitems (one tab per folder in the script directory) and also, in each tab, would list *.gif files located in that folder. I've tried to do it like that... CODE$t = "Recherche expérimentale du Pouf" $x = 400 $y = 600 $gui = GuiCreate($t, $x,$y,-1,-1,BitOR($WS_EX_TOOLWINDOW,$WS_TILEDWINDOW)) GUISetState (@SW_SHOW) $result=0 $tab = _FileListToArray(@ScriptDir,"*",2) GUICtrlCreateTab(0,0,$x,$y) for $i = 1 to $tab[0] $tab[$i] = GUICtrlCreateTabItem($tab[$i]) $emoticone = _FileListToArray($tab[$i],"*",1) For $j = 1 To $emoticone[0] Guictrlcreatebutton("",0,0,20,20) Next Next While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch Wend But had no success in it. It seems that my "nested array" can't work. Any idea to solve that ? ... Meanwhile, i'll continue to search everywhere a solution. Thanks for your help, if it comes
  25. oops... some problems not resolved but nearly fonctionnal
×
×
  • Create New...