Jump to content

Linda

Members
  • Posts

    14
  • Joined

  • Last visited

Linda's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Tvern, That is brilliant! It works! Very clever to use that debug method,thank you thank you thank you ! I can solve the feedback thing (sound in this case) in a other way. Again,very very kind of you to actually do all this just ..solving my problem..! Have a nice day Tvern!
  2. Hi Tvern, Thanks for that. Yes your script seems to work as inteded.But when i add a screencap it simply cant keep up with the clicks. I am also adding some XML elements (_XMLDOMWrapper) inside the loop upon left click. Is this a cpu problem ? Since there are no callbacks from these function how am i suppose to know when they finish..somehow i need to simply prevent futher clicks until they have all finished. just add this for simplicty and see if it works for you.If like mine,you wont hear "ok" and the consolwrite. Cheers from Sweden! =) Global $counter Global $isActive=1 Global $dll = DllOpen("user32.dll") While 1 if ($isActive==1) Then If _IsPressed("01",$dll) Then $voice = ObjCreate("SAPI.SpVoice") $voice.Speak ("ok") $voice = "" $pos = MouseGetPos() ;Add mouse coord attr. ;_XMLCreateChildWAttr("parent/Item[1]", "mousex", "value", $pos[0]) ;_XMLCreateChildWAttr("parent/Item[1]", "mousey", "value", $pos[1]) ConsoleWrite($pos[0] & "," & $pos[1]) $counter=$counter+1 $hBmp = _ScreenCapture_Capture ("") _ScreenCapture_SaveImage (@ScriptDir&"\image\Image_seq"&$counter&".jpg", $hBmp) ;_XMLCreateChildWAttr("parent/Item[1]", "image", "value", @ScriptDir&"\image\Image_seq"&$counter&".jpg") ;_XMLCreateChildWAttr("parent/Item[1]", "imageZoom", "value", @ScriptDir&"\image\Image_seq_zoom"&$counter&".jpg") ;_XMLCreateChildWAttr("parent/Item[1]", "comment", "value", GUICtrlRead($edit2)) EndIf While _IsPressed("01") Sleep(10) WEnd EndIf Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $btn Case $button1 ;Parse the xml and play! Case $button2 Case $buttonclose ExitLoop GUIDelete() Case Else EndSwitch WEnd
  3. Hi, And no i am not producing an keylogger,but a simple recorder for taking some screenshots and make some steps fully automatically between language versions of a webpage (recording a base version and play the "click path" on the language versions meanwhile taking screenshots) Now, to my suprise _isPressed seems to be a bit so-so when it comes to actually fires upon click. I have to add that i have "a lot" on cpu things going on here. The _isPressed function is within a while loop and there are two screencapture ongoing...resize them with freeImage library etc so it might depend on that...but still..it miss some events. Dont know what to share..but the code is straightforwad..something like: if ($isActive==1) Then If _IsPressed("01",$dll) Then $voice = ObjCreate("SAPI.SpVoice") $voice.Speak ("ok") $voice = "" ToolTip("Now perform the Actions") $pos = MouseGetPos() _XMLCreateChildWAttr("parent/Item[1]", "mousex", "value", $pos[0]) _XMLCreateChildWAttr("parent/Item[1]", "mousey", "value", $pos[1]) ConsoleWrite($pos[0] & "," & $pos[1]) $counter=$counter+1 $hBMPs=_ScreenCapture_Capture("",$pos[0]-150, $pos[1]-150,$pos[0]+150,$pos[1]+150) $hBmp = _ScreenCapture_Capture ("") Any insights ? Thanks!
  4. well,if i dont want a gui..then dont create one.No need for making one just to turn it transparent. $Coordxy = MouseGetPos() it's simple as that..he...thank you.
  5. Hi again, Just wondering if it's even possible to capture any WM MSG when i set the top GUI to clickthrou/transparent ? _WinAPI_SetWindowLong($mainGUI, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($mainGUI, $GWL_EXSTYLE), $WS_EX_TRANSPARENT)) I need to captute the mouse clicks on anyGUI (word,excel,filezilla..etc) but i cant come up with one single idea on how to do that. I guess there are some workarounds toggle the clickthrou by dbClick and single ones but that's very nice. Thanks!
  6. Edit-oh no sorry for this rant..i found my own misstake..some codes below my problem was actually overriding my frame navigation and navigate the oIE..sorry ! Hi! Been a while since i was using AutoIT, but you know it never stops amaze me how good it really is. Now,i am having problem when trying to automate IE navigtion in a frame in a frameset. $oFrameSub = _IEFrameGetObjByName($oIE, "frame_sc") $oFrameSub2 =_IEFrameGetObjByName($oFrameSub, "pane_sc") _IENavigate ($oFrameSub2,"the frame URL") This partially works,it navigates to the given url but the frame now covers the entire browser window.It works like i have tried to navigate with using $oIE.So is it possible to target a specific frame src other than what i am trying to do ? Using DebugBar adnd looking at the specific frame you can see and change the src and it changes accordingly: <FRAME name=pane_sc src="url=" noResize> I guess i can always use _IEAction goBack but that introduce some new problems for me. Thanks in advance! /Linda
  7. Gary, Thanks for that! Much appreciated! The switching between $fClicked = True and false seems to save us here Frost..never stop posting in this forum
  8. Found this solution but still not a GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") case. But it works. GUISetOnEvent($GUI_EVENT_CLOSE, "TreeEvents") GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "TreeEvents") Func TreeEvents() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE _GUICtrlTreeView_Destroy($hTreeView) GUIDelete() Exit Case $GUI_EVENT_PRIMARYDOWN Local $tMPos = _WinAPI_GetMousePos(True, $hTreeView) Local $tHitTest = _GUICtrlTreeView_HitTestEx($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2)) Local $iFlags = DllStructGetData($tHitTest, "Flags") If BitAND($iFlags, $TVHT_ONITEMSTATEICON) <> 0 Then Local $iItem = _GUICtrlTreeView_HitTestItem($hTreeView, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2)) ConsoleWrite(_GUICtrlTreeView_GetText($hTreeView, $iItem) & " is checked = " & _GUICtrlTreeView_GetChecked($hTreeView, $iItem) & @LF) EndIf EndSwitch EndFunc
  9. Hi all I have been searching and i see that there are some post just below this one talking about how to control things dependent on the checkbox, but is it possible to get the control case for a embedded checkbox in a TreeView ?? I can only find $NM_CLICK but that is not even close to the situation that a user has used the checkbox. Something like this Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndTreeview $hWndTreeview = $hTreeView ;If Not IsHWnd($hTreeView) Then $hWndTreeview = GUICtrlGetHandle($hTreeView) global $varFile,$messageHint,$return_value,$oIEgoto Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld Local $tNMTOOLBAR, $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hWndTreeview Switch $code [b]case $NM_CLICK[/b] ??? Do something with the TreeItemID here.. To my second problem about getting the current TreeView Item when using HitTest method. $MousePos = MouseGetPos() $Hit = _GUICtrlTreeView_HitTestItem($hTreeView, $MousePos[0], $MousePos[1]) I always get focus problems, i.e _GUICtrlTreeView_SetSelected($hTreeView, $Hit) can actually select two items (just below the current selected) even if i only clicked one. Thanks in advance and have a nice day! /Linda
  10. George, I got it now and it works great. I will go for using one GUI in one script and then just like you did create "external" controls in other scripts. Thanks for taking your time to write it down, even if it is 04:20 Have a nice day!....and never stop visiting this forum /Linda
  11. Hi George, Kind of you to replay and include a code sample (good comments in it =))..and it make sense to me. However, i still have problem understanding how i can apply a toolbar from the helpfiles to my mainwindow. Lets say i have built a script like this that i want to be my main window (a GUI with a statusbar with some mysql records): #include <array.au3> #include "mysql.au3" #include "mytoolbar.au3" #include <GuiConstantsEx.au3> #include <GuiStatusBar.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <guiconstants.au3> #include <constants.au3> ;Opt('MustDeclareVars', 1) ;$Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work _MySQL_InitLibrary() If @error Then Exit MsgBox(0, '', "") MsgBox(0, "DLL Version:",_MySQL_Get_Client_Version()&@CRLF& _MySQL_Get_Client_Info()) $MysqlConn = _MySQL_Init() $connected = _MySQL_Real_Connect($MysqlConn, "localhost", "root", "", "exampledb") If $connected = 0 Then Exit MsgBox(16, 'Connection Error', _MySQL_Error($MysqlConn)) $query = "SELECT * FROM lag1" _MySQL_Real_Query($MysqlConn, $query) ;------------------------------------------------------ ;------------------------------------------------------ $res = _MySQL_Store_Result($MysqlConn) $fields = _MySQL_Num_Fields($res) $rows = _MySQL_Num_Rows($res) $array = _MySQL_Fetch_Result_StringArray($res) Opt('MustDeclareVars', 1) $Debug_SB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $iMemo Local $hGUI, $hIcons[2], $hStatus Local $aParts[4] = [75, 150, 300, 400] ; Create GUI $hGUI = GUICreate("MainWindow", 400, 300) $hStatus = _GUICtrlStatusBar_Create ($hGUI) ; Create memo control $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 274, $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; Set parts _GUICtrlStatusBar_SetParts ($hStatus, $aParts) _GUICtrlStatusBar_SetText ($hStatus, $array[2][0]) _GUICtrlStatusBar_SetText ($hStatus, "Part 2", 1) ; Set icons $hIcons[0] = _WinAPI_LoadShell32Icon (23) $hIcons[1] = _WinAPI_LoadShell32Icon (40) _GUICtrlStatusBar_SetIcon ($hStatus, 0, $hIcons[0]) _GUICtrlStatusBar_SetIcon ($hStatus, 1, $hIcons[1]) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Free icons _WinAPI_DestroyIcon ($hIcons[0]) _WinAPI_DestroyIcon ($hIcons[1]) GUIDelete() ;MsgBox(0, '', "this is the result:" & $array[2][0]) ;_ArrayDisplay($array) ;MsgBox(0, "", $rows & "-" & $fields) ;MsgBox(0, '', "Found " & $users & " user(s) with this yam and PW") ;~; Abfrage freigeben _MySQL_Free_Result($res) ;~; Verbindung beenden _MySQL_Close($MysqlConn) ;~; MYSQL beenden _MySQL_EndLibrary() Now, in the helpfiles there is a script i named mytoolbar. I would like to add this toolbar object to my mainwindow. #include-once #include <GuiToolbar.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <Constants.au3> Opt('MustDeclareVars', 1) $Debug_TB = False; Check ClassName being passed to functions, set to True and use a handle to another control to see it work Global $hToolbar, $iMemo Global $iItem; Command identifier of the button associated with the notification. Global Enum $idNew = 1000, $idOpen, $idSave, $idHelp _Main() Func _Main() Global $hGUI, $aSize ; Create GUI $hGUI = GUICreate("Toolbar", 600, 400) $hToolbar = _GUICtrlToolbar_Create ($hGUI) $aSize = _GUICtrlToolbar_GetMaxSize ($hToolbar) $iMemo = GUICtrlCreateEdit("", 2, $aSize[1] + 20, 596, 396 - ($aSize[1] + 20), $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") ; Add standard system bitmaps _GUICtrlToolbar_AddBitmap ($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons _GUICtrlToolbar_AddButton ($hToolbar, $idNew, $STD_FILENEW) _GUICtrlToolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN) _GUICtrlToolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE) _GUICtrlToolbar_AddButtonSep ($hToolbar) _GUICtrlToolbar_AddButton ($hToolbar, $idHelp, $STD_HELP) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write message to memo Func MemoWrite($sMessage = "") GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite ; WM_NOTIFY event handler Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam) #forceref $hWndGUI, $MsgID, $wParam Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld Local $tNMTOOLBAR, $tNMTBHOTITEM $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom") $idFrom = DllStructGetData($tNMHDR, "IDFrom") $code = DllStructGetData($tNMHDR, "Code") Switch $hwndFrom Case $hToolbar Switch $code Case $NM_LDOWN ;---------------------------------------------------------------------------------------------- MemoWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($hToolbar, $iItem)) ;---------------------------------------------------------------------------------------------- Case $TBN_HOTITEMCHANGE $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam) $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld") $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew") $iItem = $i_idNew $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags") If BitAND($dwFlags, $HICF_LEAVING) = $HICF_LEAVING Then MemoWrite("$HICF_LEAVING: " & $i_idOld) Else Switch $i_idNew Case $idNew ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idNew") ;---------------------------------------------------------------------------------------------- Case $idOpen ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idOpen") ;---------------------------------------------------------------------------------------------- Case $idSave ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idSave") ;---------------------------------------------------------------------------------------------- Case $idHelp ;---------------------------------------------------------------------------------------------- MemoWrite("$TBN_HOTITEMCHANGE: $idHelp") ;---------------------------------------------------------------------------------------------- EndSwitch EndIf EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>_WM_NOTIFY this part is what i dont understand $hGUI = GUICreate("Toolbar", 600, 400) $hToolbar = _GUICtrlToolbar_Create ($hGUI) That will create a new hGUI and the toolbar is not included into my mainwindow. BrettF
  12. Hi all, I am trying to understand how AutoIT really works. Is it possible to make part of the main GUI as multiple au3 files, like one for the toolbar,one for the statusbar,treeview etc instead of doing one single script with 10000 lines of code with 53624 cases for msgbox/GUI selections. I guess yes,but then can anyone point me to a tutorial or a topic in the forum on how to do that. Let say i build my main GUI window at mainwindow.au3 So then i would import all my UDF like #include "myToolBar.au3" and within this script _createMyToolBar() GuiSetState() where createMyToolBar() is a function in myToolBar.au3 which starts with the include-once import. But how do i make the GUICtrlCreateToolbar inside this script to points to THIS window(main) in the arguments and not a new parent GUI. I dont get it. thanks!
  13. Hi Authenticity Thanks a million for writing that and you are right it did work as expected! Have a nice day ! /Linda
  14. Hi! I am new to AutoIT so go gently on this one (and i have been searching for answers on the forum but no luck) When i include a menubar + a statusbar the statusbar disappears at the default window size when starting the script. It appears first if i include $WS_SIZEBOX and then manually resize the window one time. Also,it seems to work when i minimize and then maximaize the window. However,if i replace the manubar with another component,like a button,the statusbar and the button appears when i run the script.So it seems to be the combination menu+statusbar that is the problem. Here is the script (it also change the font on the statusbar) #include <GuiConstantsEx.au3> #include <GuiStatusBar.au3> #include <WindowsConstants.au3> #include <FontConstants.au3> #include <WinAPI.au3> Global $hFont Dim $aParts[3] = [100, 250] Dim $aPartsText[2] = ["System info", "Current directory"] $hGUI = GUICreate("StatusBar Resize", 400, 300, -1, -1,BitOR($WS_MAXIMIZEBOX,$WS_SIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUP,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER)) $hStatus = _GUICtrlStatusBar_Create($hGUI, $aParts, $aPartsText) _GUICtrlStatusBar_SetFont($hStatus, 16, 800, 2 + 4, "Tahoma") ;$Button1 = GUICtrlCreateButton("Button1", 96, 136, 75, 25, 0) ;GUISetState(@SW_SHOW) GUICtrlCreateMenu("menu") GUISetState() GUIRegisterMsg($WM_SIZE, "WM_SIZE") Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _WinAPI_DeleteObject($hFont) Func _GUICtrlStatusBar_SetFont($hWnd, $iHeight = 15, $iWeight = 400, $iFontAtrributes = 0, $sFontName = "Arial") $hFont = _WinAPI_CreateFont($iHeight, 0, 0, 0, $iWeight, BitAND($iFontAtrributes, 2), BitAND($iFontAtrributes, 4), _ BitAND($iFontAtrributes, 8), $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, _ $DEFAULT_QUALITY, 0, $sFontName) _SendMessage($hWnd, $WM_SETFONT, $hFont, 1) EndFunc ;==>_GUICtrlStatusBar_SetFont ; Resize the status bar when GUI size changes Func WM_SIZE($hWnd, $iMsg, $iwParam, $ilParam) _GUICtrlStatusBar_Resize ($hStatus) Return $GUI_RUNDEFMSG EndFunc ;==>WM_SIZE Anyone seen this before ? Thanks in advance! / Linda
×
×
  • Create New...