Jump to content

slbmeh

Members
  • Posts

    12
  • Joined

  • Last visited

slbmeh's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. I'm not sure if this is a little too close to the realm of keyloggers which are not allowed to be discussed. If it is I apologize in advanced. What I want to do is create a productivity tracking application. I want to create an application that will monitor window changes track activity duration on each window, and break it down by number of mouse moves, clicks, and keystrokes. My end application will most likely be developed in Java to be ported on Mac and Linux, but I think Auto-It can give me a nice proof of concept as it has a multitude of UDFs that can assist me with screenshots every 10 min, timers, and networking. How can I go about intercepting these events to increment a variable? The documentation for GUIRegisterMsg says: Some controls consume internally specific Windows Message ID, so registrating them will have no effect, e.g; WM_CHAR, WM_KEYDOWN, WM_KEYUP are consumed by an edit control.
  2. I wasn't familiar with the functionality of _Singleton until now, the name threw me off. I assumed that it would either only allow one instance of the application or queue execution of an application until the previous had completed. The documentation says Mutex. The purpose of a mutex is to restrict the same piece of code or data from being used at the same time, whereas a binary semaphore would be more applicable in this situation because it ensures singular access to a specific resource. In a threaded application, or multiple instances of an application running parallel one would assume that the task can be executed on multiple resources simultaneously. Usage of a Mutex would limit execution of a function until the previous process has completed its task. A binary semaphore would instead allow for an application to execute the segment of code as long as the resource it is attempting to access were a different resource.
  3. My mention of added complexity was not of the function itself, but in applied use cases. Adding a ByRef parameter isn't difficult, but it would add a mandatory parameter that would not be necessary in many cases adding unnecessary complexity to the third party code using this function.
  4. The array return would work, I wanted to try to remain with just the $oIE return to refrain from straying too far from the functionality of IE.au3. I'm uncertain as to how much benefit a ByRef would be, generally the same downside as a Global with added complexity. Edit: @JohnOne I use GUIRegisterMsg instead of GUIGetMessage or OnEventMode, so I'm not sure why the difference there.
  5. I think the most effective solution would be to work with Semaphores and IPC. As far as I have seen does great IPC IMO.
  6. Beyond the definition of scope, a global variable remains in your memory space until it is explicitly released. The memory space consumed by local variables is released by the garbage collector when it cycles after your function has executed. That is the main purpose of separate declarations. Having a lot of Global declarations will impact your memory consumption. A variable is essentially a pointer to a memory address, the amount of memory it takes to store the address space of a variable is determined by the size of the address and your descriptor table. If you were to explicitly flag each variable for a scope resolution it would take even more memory. Lets consider how the GC handles variables for each scope, Local variables are flagged for garbage collection once the function has completed execution, and Global variables are held until they are explicitly released or the application has terminated. In compiler theory you have lexers, parsers, interpreters, and compilers. The lexer defines specific tokens within the language such as Func, Local, Dim, Global, etc... The parser then takes the tokens generated by the lexer to pass it on to the interpreter or compiler. If the purpose of a Local variable is to be released upon execution of the function, Local variables cannot sensibly exist in the Global scope (outside of a function) because it cannot determine when it can safely be released. The parser is then smart enough to pick up on the fact that a Local or Dim token is outside of Func and EndFunc tokens and converts it to Global to eliminate overhead on the GC and memory tables. This is all educated speculation of course.
  7. I like that. Duplicate windows was a concern for me, it wouldn't affect me, because I know what could screw it up... But if others were to use it, I couldn't think of how to prevent that. One thing I have encountered with this method is that if you use _IEPropertyGet for hwnd after you set parent it will give the parent handle and not that of the actual IE window. Do you know if there is a better way to get the handle? I currently have this piece of code that I do not like, because I have multiple child windows and if one is open it doesn't always give expected results. Func IEGetHandle($oIE) Local $hWND = _IEPropertyGet($oIE, "hwnd") $hWND = _WinAPI_GetWindow($hWND, $GW_CHILD) Return $hWND EndFunc
  8. Inspired by I took a more simplified approach that is more reliant on IE.au3. #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <IE.au3> Func IECreatePseudoEmbedded($iLeft, $iTop, $iWidth, $iHeight, $hParent, $sURL = "about:blank", $bShowWin = False) Local $iPID = Run(@ProgramFilesDir & "\Internet Explorer\iexplore.exe -k " & $sURL, "", @SW_HIDE) Sleep(2000) Local $oIE = _IEAttach($sURL, "URL", 1) Local $hWND = _IEPropertyGet($oIE, "hwnd") _WinAPI_SetParent($hWND, $hParent) _WinAPI_MoveWindow($hWND, $iLeft, $iTop, $iWidth, $iHeight, True) _WinAPI_SetWindowLong($hWND, $GWL_STYLE, $WS_POPUP + $WS_VISIBLE) If $bShowWin == True Then WinSetState($hWND, "", @SW_SHOW) EndIf Return $oIE EndFunc With this function it runs IE in kiosk mode defaulting to hidden. It will make the window a child window, resize, relocate, and redraw. It will then show the window if the ShowWin flag is set to true. It does not handle killing the process I would like to register a cleanup function if there is a way to call a function before application close. I wan't able to find a simple way to handle this just yet, so for the time being your application should call _IEQuit on application close.
  9. I'm not sure you got the GUICtrlSetData function to work properly, I assumed not based on the line you had previously commented out. Here is an example of how it should work to select. Global $items, $msg, $comb, $bot1, $bot2 GUICreate("GUI combo", 180, 110) $items = "|item1|item2|item3" $comb = GUICtrlCreateCombo("", 10, 10, 160) GUICtrlSetData(-1, $items, "item3") $bot1 = GuiCtrlCreateButton('Selecciona "item1"', 10, 40) $bot2 = GuiCtrlCreateButton("Selecciona segundo elemento", 10, 70) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg case $GUI_EVENT_CLOSE ExitLoop case $bot1 GUICtrlSetData($comb, "item1") case $bot2 GUICtrlSendMsg($comb, $CB_SETCURSEL, 1, 0) ; Selecciona por posición (0 = primer elemento) EndSwitch WEnd
  10. I have code that I can use to send mouse click signals to a window while it is minimized. Func __SendMessageCall($WinHandle, $iAction, $iParam, $lCoords) DllCall("user32.dll", "int", "SendMessage", _ "hwnd", $WinHandle, _ "int", $iAction, _ "int", $iParam, _ "long", $lCoords) EndFunc Func __MouseClickValue($sButton) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $Primary, $Secondary, $RealButton Local $ButtonVal[3] $RealButton = $Button If $Button = "" OR _ $Button = "primary" OR _ $Button = "main" OR _ $Button = "secondary" OR _ $Button = "menu" Then $RegSetting = RegRead("HKEY_CURRENT_USERControl PanelMouse", "SwapMouseButtons") If $RegSetting = 1 Then $Primary = "right" $Secondary = "left" Else $Primary = "left" $Secondary = "right" EndIf Select Case $Button = "" OR $Button = "primary" OR $Button = "main" $RealButton = $Primary Case $Button = "secondary" OR $Button = "menu" $RealButton = $Secondary EndSelect EndIf Switch $RealButton Case "left" $ButtonID = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case "right" $ButtonID = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSwitch $ButtonVal[0] = $ButtonID $ButtonVal[1] = $ButtonDown $ButtonVal[2] = $ButtonUp Return $ButtonVal EndFunc Func _SendMouseMove($Window, $X = "", $Y = "", $Speed = 10) Local $WM_MOUSEMOVE = 0x0200 Local $WinHandle = WinGetHandle($Window) Local $i = 0 Local $MouseCoord = MouseGetPos() $StartX = $MouseCoord[0] $StartY = $MouseCoord[1] If $X = "" OR $Y = "" Then $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf $StopX = $X $StopY = $Y If $Speed > 0 Then $JumpX = ($StopX - $StartX) / $Speed $JumpY = ($StopY - $StartY) / $Speed For $i = 1 to $Speed $X = $X + $JumpX $Y = $Y + $JumpY $lCoords = __MakeLong($X, $Y) __SendMessageCall($WinHandle, $WM_MOUSEMOVE, 0, $lCoords) Sleep(10) Next EndIf $lCoords = __MakeLong($StopX, $StopY) __SendMessageCall($WinHandle, $WM_MOUSEMOVE, 0, $lCoords) EndFunc Func _SendClick($Window, $Button = "primary", $X = "", $Y = "", $Clicks = 1) Local $i = 0 Local $ButtonVal = __MouseClickValue($Button) Local $WinHandle = WinGetHandle($Window) If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf Local $lCoords = _MakeLong($X, $Y) For $i = 1 to $Clicks _SendMouseMove($Window, $X, $Y) __SendMessageCall($WinHandle, $ButtonVal[1], $ButtonVal[0], $lCoords) __SendMessageCall($WinHandle, $ButtonVal[2], $ButtonVal[0], $lCoords) Next EndFunc Func _SendClickDrag($Window, $Button = "primary", $X1 = "", $Y1 = "", $X2 = "", $Y2 = "", $Speed = 10) Local $MK_LBUTTON = 0x0001 Local $WM_LBUTTONDOWN = 0x0201 Local $WM_LBUTTONUP = 0x0202 Local $MK_RBUTTON = 0x0002 Local $WM_RBUTTONDOWN = 0x0204 Local $WM_RBUTTONUP = 0x0205 Local $WM_MOUSEMOVE = 0x0200 Local $i = 0 Local $WinHandle = WinGetHandle($Window) Local $Primary, $Secondary, $RealButton $RealButton = $Button If $Button = "" OR _ $Button = "primary" OR _ $Button = "main" OR _ $Button = "secondary" OR _ $Button = "menu" Then $RegSetting = RegRead("HKEY_CURRENT_USERControl PanelMouse", "SwapMouseButtons") If $RegSetting = 1 Then $Primary = "right" $Secondary = "left" Else $Primary = "left" $Secondary = "right" EndIf Select Case $Button = "" OR $Button = "primary" OR $Button = "main" $RealButton = $Primary Case $Button = "secondary" OR $Button = "menu" $RealButton = $Secondary EndSelect EndIf Switch $RealButton Case "left" $Button = $MK_LBUTTON $ButtonDown = $WM_LBUTTONDOWN $ButtonUp = $WM_LBUTTONUP Case "right" $Button = $MK_RBUTTON $ButtonDown = $WM_RBUTTONDOWN $ButtonUp = $WM_RBUTTONUP EndSwitch If $X = "" OR $Y = "" Then $MouseCoord = MouseGetPos() $X = $MouseCoord[0] $Y = $MouseCoord[1] EndIf $CoordsLong = _MakeLong($X, $Y) For $i = 1 to $Clicks _SendMessageCall($WinHandle, $WM_MOUSEMOVE, 0, $CoordsLong) _SendMessageCall($WinHandle, $ButtonDown, $Button, $CoordsLong) _SendMessageCall($WinHandle, $ButtonUp, $Button, $CoordsLong) Next EndFunc I am curious if it is possible to create an embedded instance of IE on a tab and send clicks to it (not html interaction, but java, flash, silverlight, etc) without the tab being currently active. Has anyone done anything similar? Is there an easier or better way to do this other than sending clicks to my own interface? Edit: Can a moderator please move this post to General Support? I misunderstood the subforum descriptions and posted here because I was thinking about COM in my application.
  11. I found this looking for the answer myself. I've found this under GUICtrlSetData() For Combo or List control : If the "data" corresponds to an already existing entry it is set as the default. If the "data" starts with GUIDataSeparatorChar or is an empty string "" the previous list is destroyed.
  12. This sounds like something you could do with curl in either a shell script or a php script for a lot cheaper than with a vps... To run an exe you are looking at paying for a windows vps... not very practical to run a single application with the little amount of bandwith consumption that would generate... You can get a hosting plan for $1/mo... I've yet to find a vps for under $50/mo that isn't an introductory price. You just need to make sure the host has curl support with their php... It shouldn't take much to reproduce the functionality you mentioned in your script...
×
×
  • Create New...