Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/11/2022 in all areas

  1. Danp2 - you are divine! Thanks for the tip about _WD_GetTable , I used it, but because of the complex cell contents I need individual access to each cell. You have solved my problem. Thank you so much!
    1 point
  2. You must use a relative selector when using xpath with a starting node. You also need to obtain the element's text separately. Instead of this -- $sTd1 = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "/tr/td[1]/span/text()" , $idElem ) You need to do it like this -- $idElem = _WD_FindElement($WD_SESSION, $_WD_LOCATOR_ByXPath, "./td[1]/span" , $idElem) $sContents = _WD_ElementAction($WD_SESSION, $idElem, 'text') Another option would be to use _WD_GetTable to obtain an array containing the table's contents.
    1 point
  3. Nope, One should never use internal defined variables from an Include file as that could cause these type of issues! It is fixed in the current available Beta version.
    1 point
  4. Try this as an example : #include <Timers.au3> HotKeySet("{PAUSE}", _TogglePause) HotKeySet("{ESC}", _Terminate) Global $g_bPaused = False Global $hStarttime = _Timer_Init() ; *** just as an info While True ToolTip("Time : " & StringFormat("%.2f", _Timer_Diff($hStarttime) / 1000) & " sec") Sleep(100) WEnd Func _TogglePause() $g_bPaused = Not $g_bPaused While $g_bPaused Sleep(50) ToolTip('Script is paused', 10, 10, "Status :", 1, 1) WEnd ToolTip("") EndFunc ;==>_TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate
    1 point
  5. You have to check the tray menu item clicks in your pause function. Currently that function is started and never gets out of it. It is looping endlessly. use the TrayGetMsg() and check for the exit and pause menu's and do something in it. (either end the program or unpause it by exiting the while loop) Try out this function to see how it really works: Func pause() $e=0 while $e<100 $e=$e+1 ToolTip("the script has PAUSED") Sleep(50) WEnd ConsoleWrite ("Exit from the pause" & @crlf) EndFunc
    1 point
  6. Use the preprocessor directive #RequireAdmin See the helpfile for details on using this directive.
    1 point
  7. ...because it is wrong I guess? ... Maybe a \ missing in the executable path? ... Why run as the current user with RunAs() without any password? ... and check which errror code is returned!
    1 point
  8. argumentum

    AutoIt Snippets

    Center GUI on Monitor based on mouse position #include <AutoItConstants.au3> #include <GUIConstants.au3> #include <WinAPIGdi.au3> Func GuiCenterOnMonitorFromMousePosition($hForm, $sText = "") Local $aData, $hMonitor, $tPos = _WinAPI_GetMousePos() If Not @error Then $hMonitor = _WinAPI_MonitorFromPoint($tPos) If Not @error Then $aData = _WinAPI_GetMonitorInfo($hMonitor) If @error Then Return SetError(1, -1, 1) Local $iWinState = WinGetState($hForm, $sText) If @error Then Return SetError(2, $aData[2], 2) If BitAND($iWinState, $WIN_STATE_MINIMIZED) Or _ BitAND($iWinState, $WIN_STATE_MAXIMIZED) Then WinSetState($hForm, $sText, @SW_RESTORE) Local $aWinPos = WinGetPos($hForm, $sText) If @error Then Return SetError(3, $aData[2], 3) WinMove($hForm, _ $sText, _ Int((($aData[0].Right - $aData[0].Left - $aWinPos[2]) / 2) + $aData[0].Left), _ Int((($aData[0].Bottom - $aData[0].Top - $aWinPos[3]) / 2) + $aData[0].Top)) If @error Then Return SetError(4, $aData[2], 4) Return SetError(0, $aData[2], 0) EndFunc ;==>GuiCenterOnMonitorFromMousePosition Example() Func Example() Local $hGUI = GUICreate("GuiCenterOnMonitorFromMousePosition example", 600, 200) GuiCenterOnMonitorFromMousePosition($hGUI) GUICtrlCreateLabel("Primary display monitor = " & @extended, 20, 20, 160, 21) GUISetState() While GUIGetMsg() <> $GUI_EVENT_CLOSE WEnd GUIDelete() EndFunc ;==>Example
    1 point
×
×
  • Create New...