Search the Community
Showing results for tags 'delay'.
-
This is a personal project to log into several facebook accounts and send a message to a specific person on their birthday. I need to stop a script in a few different ways for several different reasons. For example, it might start sending the email to the wrong account, it might do something other than send a message, it might fail to logout of one account, etc. 1) Pause the script at it's exact location with a resume feature in case I need to put it on hold while I do another task. 2) Pause the script at it's current location with the option to start over or execute another part of the script (example in GUI with multiple buttons). Also, is there a way to interact with menus? If I log into facebook how can I force it to go straight to sending a message to the proper person? I tried automating a mouseclick but the window opens in different places. I also tried searching for specific text and I couldn't get any information from the windows info tool on the facebook page. Also, how do I get my code in here to show like it does in my editor? (scite) Thanks for looking at it, and any help/suggestions I sgreatly appreciated! <snip>
-
Hi, I do recognize bad behaviour at this snippet: #include <AutoItConstants.au3> Global $g_sSD = @ScriptDir & "\" Global $g_sBurstPath = $g_sSD & "Burst\" DirCreate($g_sBurstPath) Local $sFileName = "Test_mit_3_Seiten.pdf" ; any PDF with more than 1 page inside @ScriptDir FileCopy($g_sSD & $sFileName, $g_sBurstPath & $sFileName, 1) ;~ Sleep(13000) Local $hTimer = TimerInit() ConsoleWrite("Start" & @CRLF) _Burst($g_sBurstPath & $sFileName) ; bursts PDF into single pages ;~ While _FileInUse($g_sBurstPath & $sFileName) ;~ WEnd ConsoleWrite("End: " & Round(TimerDiff($hTimer)) & "ms" & @CRLF) Exit Func _quotePath($sPath) ; because of possible "spaces" inside pathes $sPath = '"' & $sPath & '"' Return $sPath EndFunc Func _Burst($sFile) Local $sPDFtk = $g_sSD & "pdftk.exe" ; path to pdftk.exe (and libiconv2.dll) Local $sCurrWorkingDir = @WorkingDir FileChangeDir($g_sBurstPath) ; it has to change for reasons Local $iPID = Run(_quotePath($sPDFtk) & ' ' & _quotePath($sFile) & ' burst', "", @SW_SHOW, $STDOUT_CHILD + $STDERR_CHILD) ; @SW_SHOW just to see "PDFtk is working" Local $sOutput, $sError While 1 $sOutput &= StdoutRead($iPID) $sError &= StderrRead($iPID) If @error Then ExitLoop Sleep(10) WEnd FileChangeDir($sCurrWorkingDir) ; back to normal EndFunc Func _FileInUse($sFilename) ; by Siao Local $aRet, $hFile $aRet = DllCall("Kernel32.dll", "hwnd", "CreateFile", _ "str", $sFilename, _ ;lpFileName "dword", 0x80000000, _ ;dwDesiredAccess = GENERIC_READ "dword", 0, _ ;dwShareMode = DO NOT SHARE "dword", 0, _ ;lpSecurityAttributes = NULL "dword", 3, _ ;dwCreationDisposition = OPEN_EXISTING "dword", 128, _ ;dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL "hwnd", 0) ;hTemplateFile = NULL $hFile = $aRet[0] If $hFile = -1 Then ;INVALID_HANDLE_VALUE = -1 $aRet = DllCall("Kernel32.dll", "int", "GetLastError") SetError($aRet[0]) Return 1 ; file in use (@error contains system error code) Else ;close file handle DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $hFile) Return 0 ; file not in use EndIf EndFunc This bursting took about 15000ms. If I activate line 8 "Sleep(13000)" then the bursting itself never needed more than 1000ms. Round about 13000ms delay is needed until bursting is acting very fast, otherwise needing about 15000ms. Then I tested _FileInUse() instead of _Burst() w/o Sleep(13000). This runs in 3ms. It seemes to me that FileCopy() and Burst() are interacting in a way I can't see. Any ideas? Regards, Conrad P.S. You need pdftk.exe and libiconv2.dll at @ScriptDir. This you can get free here: https://www.pdflabs.com/tools/pdftk-server/ (I'm not sure whether I'm allowed to attach it here).
-
Hi, i try to simulate the $LVS_EDITLABELS behaviour so by clicking twice the item can be edited but the second mouse click has to be a little bit delayed to trigger the editing. The editing has to be done in other columns too, so i can't use $LVS_EDITLABELS. So - one click selects an item - double click performs a specific function - one click + another 800ms delayed click performs an editing Does someone have an idea? #AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <GuiConstantsEx.au3> #include <GuiListView.au3> #include <GuiImageList.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Global $Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work Global $aClick_Info[2] Global $hListView, $hTmp_Edit Global $GUI, $hImage $GUI = GUICreate("(UDF Created) ListView Create", 400, 300) $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES)) GUISetState() GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") ; Load images $hImage = _GUIImageList_Create() _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16)) _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16)) _GUICtrlListView_SetImageList($hListView, $hImage, 1) ; Add columns _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100) _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100) _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100) ; Add items _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE GUIDelete() Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo $hWndListView = $hListView If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button Local $iIndex, $iSubItem, $sTmp_Text, $aRect, $aPos $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) $iIndex = DllStructGetData($tInfo, "Index") $iSubItem = DllStructGetData($tInfo, "SubItem") _DebugPrint("$NM_CLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) ; make sure user clicks on the listview & only the activate If $iIndex <> -1 Then GUICtrlDelete($hTmp_Edit) $aClick_Info[0] = $iIndex $aClick_Info[1] = $iSubItem ;~ GUISetAccelerators($aAccelKeys) $sTmp_Text = _GUICtrlListView_GetItemText($hWndListView, $iIndex, $iSubItem) ConsoleWrite("item: " & $iIndex & " subitem: " & $iSubItem & " text: " & $sTmp_Text & @CRLF) If $iSubItem = 0 Then $aRect = _GUICtrlListView_GetItemRect($hWndListView, $iIndex, 2) Else $aRect = _GUICtrlListView_GetSubItemRect($hWndListView, $iIndex, $iSubItem) EndIf $aPos = ControlGetPos("", "", $hWndListView) ConsoleWrite("Information :" & StringFormat("Item 2 Rectangle : [%d, %d, %d, %d]", $aRect[0]+ $aPos[0], $aRect[1]+ $aPos[1], $aRect[2], $aRect[3]) & @CRLF) $hTmp_Edit = GUICtrlCreateEdit($sTmp_Text, $aRect[0] + $aPos[0], $aRect[1] + $aPos[1], $aRect[2] - $aRect[0], $aRect[3] - $aRect[1], 0) GUICtrlSetState($hTmp_Edit, $GUI_FOCUS) EndIf Case $NM_DBLCLK ; Sent by a list-view control when the user clicks an item with the left mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) _DebugPrint("$NM_DBLCLK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) Case $NM_RCLICK ; Sent by a list-view control when the user clicks an item with the right mouse button $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam) _DebugPrint("$NM_RCLICK" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode & @LF & _ "-->Index:" & @TAB & DllStructGetData($tInfo, "Index") & @LF & _ "-->SubItem:" & @TAB & DllStructGetData($tInfo, "SubItem") & @LF & _ "-->NewState:" & @TAB & DllStructGetData($tInfo, "NewState") & @LF & _ "-->OldState:" & @TAB & DllStructGetData($tInfo, "OldState") & @LF & _ "-->Changed:" & @TAB & DllStructGetData($tInfo, "Changed") & @LF & _ "-->ActionX:" & @TAB & DllStructGetData($tInfo, "ActionX") & @LF & _ "-->ActionY:" & @TAB & DllStructGetData($tInfo, "ActionY") & @LF & _ "-->lParam:" & @TAB & DllStructGetData($tInfo, "lParam") & @LF & _ "-->KeyFlags:" & @TAB & DllStructGetData($tInfo, "KeyFlags")) Return 0 ; allow the default processing Case $NM_RETURN ; The control has the input focus and that the user has pressed the ENTER key _DebugPrint("$NM_RETURN" & @LF & "--> hWndFrom:" & @TAB & $hWndFrom & @LF & _ "-->IDFrom:" & @TAB & $iIDFrom & @LF & _ "-->Code:" & @TAB & $iCode) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func _DebugPrint($s_text, $line = @ScriptLineNumber) ConsoleWrite( _ "!===========================================================" & @LF & _ "+======================================================" & @LF & _ "-->Line(" & StringFormat("%04d", $line) & "):" & @TAB & $s_text & @LF & _ "+======================================================" & @LF) EndFunc ;==>_DebugPrint
-
Hey everyone, I have written a script which I want to start together with the booting operating system (Win7x64). Like proposed by wiki-FAQ (https://www.autoitscript.com/wiki/FAQ) I tried the following: MsgBox(0,"TellMe",RegWrite("HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "ATOSS-FavoritenManager", "REG_SZ", @ScriptFullPath)?"SUCCESS":"Error: " & @error)It worked, just like putting a link into the windows autostart directory. Thing is, every other program in there needs some seconds to start after booting. However, my script takes 3-5 minutes for no obvious reason, with the process visible in the task-manager. I tried a a smaller Autoit.exe script and it was way faster than mine. My script is 1.1MB in size and needs 17.6MB of RAM when running. (maybe that's the problem?) I set up a MsgBox at the start of my script to have something simple as first visible effect, so in my opinion it's nothing in my code causing the problem (like a loop). My includes are: That's quite some but I need those. Any ideas? (Here is some code, that my script starts with. Altogether it's about 3500 lines of code.) Thanks and have a great weekend! Natulux
-
Good day. I'm scripting Photoshop install. After the install is done, Photoshop may call for a system reboot. Problem is - there is still a bunch of stuff I'd like to do before that. So I need a UDF that would delay restart until the script finishes, or any advice on how to do it will work just as well. Tried OnAutoItExitRegister, but it delays reboot for XP only. I've searched the forum, but failed to find a really reliable UDF that'd work on Win7. I could have easily overlooked, I'm relatively new, thats why I'm asking for help. Thanks in advance.
-
How do I make the click delay in maybe 1 second? If I got a position I want the mouse to go (like in MouseClick("left",100,100) how can I make the click be pressed down in maybe 1 second? Is it possible? Thanks in advance!
- 4 replies
-
- Mouseclick
- Mouse
-
(and 2 more)
Tagged with: