Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/02/2020 in all areas

  1. @argumentum Except that you're storing an integer in a variable that begins with a "b". I'm seeing red right now despite understanding why
    3 points
  2. How do you run the script at startup? Compiled or with the AutoIT exe? When the latter: What is the commandline you run at startup? Care the share what the error is that is thrown or do you like us to guess? Jos
    2 points
  3. water

    OutlookEX

    Version 1.7.0.1

    10,051 downloads

    Extensive library to control and manipulate Microsoft Outlook. This UDF holds the functions to automate items (folders, mails, contacts ...) in the background. Can be seen like an API. There are other UDFs available to automate Outlook: OutlookEX_GUI: This UDF holds the functions to automate the Outlook GUI. OutlookTools: Allows to import/export contacts and events to VCF/ICS files and much more. Threads: Development - General Help & Support - Example Scripts - Wiki BTW: If you like this UDF please click the "I like this" button. This tells me where to next put my development effort KNOWN BUGS (last changed: 2020-02-09) None
    1 point
  4. Enabling DST (the summertime and wintertime schedules across the globe) within your time zone might cause an unexpected shift in datetimes by 1 hour when you're trying to set filetimes with FileSetTime or read them with FileGetTime. This behaviour frequently causes bugreports like #3139 at https://www.autoitscript.com/trac/autoit/ticket/3139 'FileGetTime out by exactly one hour.', where it was classified as 'No bug'. Now this isn't considered a bug when you're referring to the datetime as shown by the command prompt (DOS prompt, even in Windows 7+) or Windows Explorer XP, as these programs use 'old style' DST behaviour. But it definitely can be considered a bug when you're using Windows Explorer 7+, which adopts the 'new style' behaviour. 'Old style' (currently implemented, v3.3.14.2 and previous) calculates datetimes as follows: FileSetTime = local time - time zone - DST currently in effect FileGetTime = file datetime + time zone + DST currently in effect whereas 'new style' calculation of datetimes would require: FileSetTime = local time - time zone - DST in effect at the time of the file's datetime (Dynamic Time Zones) FileGetTime = file datetime + time zone + DST in effect at the time of the file's datetime (Dynamic Time Zones) This 'new style' behaviour will leave your timestamps unaltered in Windows Explorer 7+ whenever a transition to summertime or wintertime occurs, but requires detailed records of all DST schedules worldwide. Fortunately all these records are readily available in Windows 7+! You can read more about this in Raymond Chen insider blogs at https://blogs.msdn.microsoft.com/oldnewthing/20130308-00/?p=5023 and https://technet.microsoft.com/en-us/magazine/ff394358.aspx To have FileSetFile and FileGetFile adopt the 'new style' DST behaviour, I've written FileSetFileExt and FileGetFileExt. As part of FileSetFileExt, which has an option to recurse into the given path, the function FindFiles was created. It's included separately and you can easily apply it as a stand-alone function to recurse a given path and process all files that match a specified pattern. I think it's a useful function that AutoIt unfortunately still lacks. FileSetTimeExt (FileSetTime voor DST en Win7+): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <File.au3> #include <Date.au3> #include <WinAPIFiles.au3> #include <WinAPI.au3> ConsoleWrite("Set Modified datetime of this script to Jan 12th 2016 at 15:16:17" & @CRLF) FileSetTimeExt(@ScriptFullPath, "20160123151617", 0, 0) Func FileSetTimeExt($filename, $time, $type = 0, $recurse = 0) ; v1.0 ; Extended FileSetTime function to properly deal with DST (Daylight Saving Time (summertime/wintertime)) on Windows 7+ ; Usage is identical to the FileSetTime function with full wildcard support, including multiple * and ? usage. ; ; AutoIt Version: 3.3.14.2 ; This function requires Windows 7 or later. ; ; Requirements to include in your main program: ; #include <File.au3> ; #include <Date.au3> ; #include <WinAPIFiles.au3> ; #include <WinAPI.au3> If $type = Default Then $type = 0 If $recurse = Default Then $recurse = 0 If $time = "" Then $time = StringRegExpReplace(_NowCalc(), "[^0-9]", "") Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $ssDir = "", $sDummy1 = "", $sDummy2 = "" _PathSplit($filename, $sDrive, $sDir, $sFileName, $sExtension) ; extend path to full path if filename has no path or a path relative to ScriptDir If $sDrive = "" Then _PathSplit(@ScriptFullPath, $sDrive, $ssDir, $sDummy1, $sDummy2) $sDir = $ssDir & $sDir $filename = _PathMake($sDrive, $sDir, $sFileName, $sExtension) EndIf ; FileSetTime makes no difference between * and *.*, whereas_WinAPI_IsNameInExpression does, so make adjustments If $sExtension = ".*" Then $sFileName = $sFileName & "*" $sExtension = "" EndIf Local $hSearch $hSearch = FileFindFirstFile(_PathMake($sDrive, $sDir, "*", ".*")) ; searches for every file and directory If $hSearch = -1 Then Return 1 Local $pattern, $eExt, $tSystem, $tFile, $hFile, $pFileName ; get correct local time $tSystem = _Date_Time_EncodeSystemTime(StringMid($time, 5, 2), StringMid($time, 7, 2), StringLeft($time, 4), _ StringMid($time, 9, 2), StringMid($time, 11, 2), StringMid($time, 13, 2)) $tSystem = _Date_Time_TzSpecificLocalTimeToSystemTime($tSystem) $tFile = _Date_Time_SystemTimeToFileTime($tSystem) $pattern = StringMid(_PathMake("", "", $sFileName, $sExtension), 2) ; StringMid skips leading \ While 1 $sFileName = FileFindNextFile($hSearch) If @error = 1 Then ; no more files or directories match the pattern ExitLoop Else $eExt = @extended $pFileName = _PathMake($sDrive, $sDir, $sFileName, "") ; _WinAPI_IsNameInExpression supports full wildcard matching, including multiple * and ? usage. If _WinAPI_IsNameInExpression($sFileName, $pattern) Then ; set correct local time for matching file or directory ; try the usual function first to catch errors beforehand If FileSetTime($pFileName, $time, $type) = 0 Then FileClose($hSearch) Return 0 ; abort on error EndIf ; use _WinAPI_CreateFileEx instead of _WinAPI_CreateFile to include directory renaming without an 'Access is denied' error $hFile = _WinAPI_CreateFileEx($pFileName, $OPEN_EXISTING, $GENERIC_WRITE, $FILE_SHARE_WRITE, $FILE_FLAG_BACKUP_SEMANTICS) Switch $type Case 0 _Date_Time_SetFileTime($hFile, 0, 0, $tFile) ; set time Last modified (= Last written) (default) Case 1 _Date_Time_SetFileTime($hFile, $tFile, 0, 0) ; set time Created Case 2 _Date_Time_SetFileTime($hFile, 0, $tFile, 0) ; set time Last accessed EndSwitch _WinAPI_CloseHandle($hFile) EndIf ; perform a full recursive search if need be If $eExt = 1 And $recurse = 1 Then If FileSetTimeExt($pFileName & '\' & $pattern, $time, $type, $recurse) = 0 Then FileClose($hSearch) Return 0 ; abort on error EndIf EndIf EndIf WEnd FileClose($hSearch) Return 1 ; no error occurred EndFunc ;==>FileSetTimeExt FileGetTimeExt (FileGetTime voor DST en Win7+): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <File.au3> #include <Date.au3> #include <WinAPIFiles.au3> #include <WinAPI.au3> ConsoleWrite("Modified datetime of this script is " & FileGetTimeExt(@ScriptFullPath, 0, 1) & @CRLF) ConsoleWrite("Created datetime of this script is " & FileGetTimeExt(@ScriptFullPath, 1, 1) & @CRLF) ConsoleWrite("Last accessed datetime of this script is " & FileGetTimeExt(@ScriptFullPath, 2, 1) & @CRLF) Func FileGetTimeExt($filename, $option = 0, $format = 0) ; v1.0 ; Extended FileGetTime function to properly deal with DST (Daylight Saving Time (summertime/wintertime)) on Windows 7+ ; Usage is identical to the FileGetTime. ; ; AutoIt Version: 3.3.14.2 ; This function requires Windows 7 or later. ; ; Requirements to include in your main program: ; #include <File.au3> ; #include <Date.au3> ; #include <WinAPIFiles.au3> ; #include <WinAPI.au3> If $option = Default Then $option = 0 If $format = Default Then $format = 0 Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $ssDir = "", $sDummy1 = "", $sDummy2 = "" _PathSplit($filename, $sDrive, $sDir, $sFileName, $sExtension) ; extend path to full path if filename has no path or a path relative to ScriptDir If $sDrive = "" Then _PathSplit(@ScriptFullPath, $sDrive, $ssDir, $sDummy1, $sDummy2) $sDir = $ssDir & $sDir $filename = _PathMake($sDrive, $sDir, $sFileName, $sExtension) EndIf Local $aTime, $tDate, $tOut[6], $hFile, $tSystem, $tLocal, $tFile FileGetTime($filename, $option, $format) ; test if no error occurs If @error Then Return SetError(@error, 0, "") ; use _WinAPI_CreateFileEx instead of _WinAPI_CreateFile to include directory access without an 'Access is denied' error $hFile = _WinAPI_CreateFileEx($filename, $OPEN_EXISTING, $GENERIC_READ, $FILE_SHARE_READ, $FILE_FLAG_BACKUP_SEMANTICS) Switch $option ; convert FileGetTime option 0 to _Date_Time_GetFileTime option 2, 1 to 0 and 2 to 1 Case 0 $option = 2 ; Last modified (default) Case 1 $option = 0 ; Created Case 2 $option = 1 ; Last accessed EndSwitch $aTime = _Date_Time_GetFileTime($hFile) _WinAPI_CloseHandle($hFile) $aTime = $aTime[$option] $tSystem = _Date_Time_FileTimeToSystemTime($aTime) $tLocal = _Date_Time_SystemTimeToTzSpecificLocalTime($tSystem) $tFile = _Date_Time_SystemTimeToFileTime($tLocal) $tDate = _Date_Time_FileTimeToArray($tFile) $tOut[0] = StringFormat("%04i", $tDate[2]) ; Year $tOut[1] = StringFormat("%02i", $tDate[0]) ; Month $tOut[2] = StringFormat("%02i", $tDate[1]) ; Day $tOut[3] = StringFormat("%02i", $tDate[3]) ; Hour $tOut[4] = StringFormat("%02i", $tDate[4]) ; Minutes $tOut[5] = StringFormat("%02i", $tDate[5]) ; Seconds If $format = 0 Then Return SetError(0, 0, $tOut) Return SetError(0, 0, $tOut[0] & $tOut[1] & $tOut[2] & $tOut[3] & $tOut[4] & $tOut[5]) EndFunc ;==>FileGetTimeExt FindFiles (full recursive file search voor Win7+): #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7 #include <File.au3> #include <Date.au3> #include <WinAPIShPath.au3> ; Find all files (with or without an extension) in ScriptDir with recursion FindFiles("*", 1, False) Func FindFiles($filename, $recurse = 0, $CaseSensitive = False); ; v1.0 ; Find all files matching $filename with full wildcard support, including multiple * and ? usage. ; Set $recurse to 1 to include searching all subdirectories. ; Set $CaseSensitive to True to include case sensitive searching. ; Filenames without extension demand a $filename without an extension, ; e.g. abc* matches abc.txt and abc, whereas abc*.* matches abc.txt but not abc. ; ; Use Func FoundFileProcessing($filename) to process a single found file. ; FoundFileProcessing($filename) receives filenames with full path. ; ; AutoIt Version: 3.3.14.2 ; This function requires Windows 7 or later. ; ; Requirements to include in your main program: ; #include <File.au3> ; #include <Date.au3> ; #include <WinAPIShPath.au3> If $recurse = Default Then $recurse = 0 If $CaseSensitive = Default Then $CaseSensitive = False Local $sDrive = "", $sDir = "", $sFileName = "", $sExtension = "", $ssDir = "", $sDummy1 = "", $sDummy2 = "" _PathSplit($filename, $sDrive, $sDir, $sFileName, $sExtension) ; extend path to full path if filename has no path or a path relative to ScriptDir If $sDrive = "" Then _PathSplit(@ScriptFullPath, $sDrive, $ssDir, $sDummy1, $sDummy2) $sDir = $ssDir & $sDir $filename = _PathMake($sDrive, $sDir, $sFileName, $sExtension) EndIf Local $hSearch $hSearch = FileFindFirstFile(_PathMake($sDrive, $sDir, "*", ".*")) ; searches for every file and directory If $hSearch = -1 Then Return 1 Local $pattern, $eExt, $pFileName $pattern = StringMid(_PathMake("", "", $sFileName, $sExtension), 2) ; StringMid skips leading \ While 1 $sFileName = FileFindNextFile($hSearch) If @error = 1 Then ; no more files or directories match the pattern ExitLoop Else $eExt = @extended $pFileName = _PathMake($sDrive, $sDir, $sFileName, "") ; _WinAPI_IsNameInExpression supports full wildcard matching, including multiple * and ? usage. If _WinAPI_IsNameInExpression($sFileName, $pattern, $CaseSensitive) Then FoundFileProcessing($pFileName) If $eExt = 1 And $recurse = 1 Then FindFiles($pFileName & '\' & $pattern, $recurse, $CaseSensitive) EndIf WEnd FileClose($hSearch) Return 1 ; no error EndFunc ;==>FindFiles Func FoundFileProcessing($filename) ConsoleWrite('processing ' & $filename & @CRLF) EndFunc ;==>FoundFileProcessing FileSetTimeEx (FileSetTime voor DST en Win7+).au3 FileGetTimeEx (FileGetTime voor DST en Win7+).au3 FindFiles (full recursive file search voor Win7+).au3
    1 point
  5. TheXman, That is fixed in the latest Beta from Jos - promise! https://www.autoitscript.com/autoit3/scite/download/beta_SciTE4AutoIt3/ M23
    1 point
  6. @TheSaint Thanks for sharing bud. The script that I provided was a simplified example of what I was trying to do in C. Right now I am working on porting one of my programs (ProxAllium) to Linux, essentially re-writing it to work across platforms. I encountered this dilemma when I was writing the code for GUI, in C these kind of duplications have a bit more impact on future modification on code as it is a naturally low-level language, so it is best to write "clean" code from the start, as to avoid doing that in the future. Also, as no doubt most of you would have gotten the gist, I do not like redundancy in my code. I actually tackled this problem in my AutoIt code as well, when working on the same program. At that time I came up with another solution: Using a dummy value and artificially trigger the toggle code so that it can properly populate the correct value, I even found a "hack" in AutoIt which lets me kind of simulate GUI events (when using OnEvent mode): Also containing a code example, which practically does the same thing as the previous examples: @argumentum An interesting and out-of-the-box solution, kudos, I may even find an use for it
    1 point
  7. HurleyShanabarger, As you have the full SciTE4AutoIt3 package installed , why not use the Abbreviation Manager you can find under <SciTEConfig - Other Tools> to create your abbreviations. This is after all why I wrote it! M23
    1 point
  8. Danp2

    Multiple AutoLogins

    If the logins are occurring sequentially, then I don't see why you need to use multiple profiles. Just do one of the following -- Logout from the website before continuing with the next user id Call _WD_Startup() again, which will close the existing webdriver instance and launch a new one (thus giving you a new profile to work from). You would then need to start a new session with _WD_CreateSession
    1 point
  9. Melba23

    Multiple AutoLogins

    argumentum, As I have yet to clear the thread, why are you barging in despite my asking earlier for people to stay out? However, as I am just about to permit it, we will say no more this time. matecki, Good enough - please take argumentum's advice. M23
    1 point
  10. Let me guess: The .au3 file extension defaults to AutoIt3.exe in stead of the required AutoIt3_x64.exe? A Shortcut does contain a commandline, which in this case should point to the proper AutoIt3 version executable. Jos
    1 point
  11. This is what I've used in the past to detect the element below the mouse cursor whenever a hotkey is pressed -- Func _IEGetMouseElement($oIE, $aPoint = MouseGetPos()) Local $hWindow = _IEPropertyGet($oIE, "hwnd") Local $aIEPos = _ScreenToClient($hWindow, $aPoint[0], $aPoint[1]) Local $nScreenY = _IEPropertyGet($oIE, "screeny") Local $nScreenTop = $oIE.document.parentWindow.screenTop ; Adjust Y value for height of Tabs, Toolbars, etc $aIEPos[1] -= ($nScreenTop - $nScreenY) $oElement = $oIE.document.elementFromPoint($aIEPos[0], $aIEPos[1]) Return $oElement EndFunc Maybe you can find a way to use it in this scenario.
    1 point
  12. There are many ways to skin a cat You could set up an event that fires before you navigate to a new page in IE using the IE UDF. There's an example of this in the help file under ObjEvent
    1 point
  13. It is, and whether this is a general support question or a "technical discussion" could be open to interpretation. However, as it appears to be a problem you are having and want assistance with, and as moving it here will put many more sets of eyes on it, I think it makes sense.
    1 point
  14. You can use _WinAPI_SetWindowTheme ... Local $MonthCal_FROM = GUICtrlCreateMonthCal($data_od, 10, 144, 190, 190) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) _WinAPI_SetWindowTheme(GUICtrlGetHandle($MonthCal_FROM), "", "") ... as a workaround.
    1 point
  15. @Owendon You can find more about PDFCreator COM interface here. By the way, @mLipok has written an UDF to use PDFCreator 1.x.x with AutoIt, which you can find here
    1 point
  16. Okay, you doubting Thomases (male, female, etc). If the following doesn't convince you that TheDcoder is the man for the job (this topic's idea), then nothing will. Today, he came to me on HexChat with an issue. It is not an issue I had ever come across before, and even afterward I still did not see the issue ... clearly I'm not nerdy enough. He was upset or bothered (plagued was his word) by the fact he was using the text "Start" twice in a script. Here is the example code he gave me to illustrate the issue I was just not getting. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted GUICtrlSetData($idButton, $bStarted ? "Stop" : "Start") EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example He sent that to me in a PM to try and make things clearer. He also said the following in the PM. Now I like to keep things simple, even if it takes more code and text. So I don't code like he does, and so rarely rely on False and True etc. I've certainly never been guilty of using a line like the following. In fact I had to run it after he assured me it worked, to indeed see it does. GUICtrlSetData($idButton, $bStarted ? "Stop" : "Start") While I was checking that out, he thought I may have needed a simpler version, so he provided the following variant, but I had already sussed it out by then. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted If $bStarted Then GUICtrlSetData($idButton, "Stop") Else GUICtrlSetData($idButton, "Start") EndIf EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Anyway, I was perplexed that he really found this an issue, so offered up the following solution, which worked, but did not satisfy him, and I am not surprised why ... I was just swapping one thing for another. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) Local $starttxt = "Start" Local $stoptxt = "Stop" ; Create a button control. Local $idButton = GUICtrlCreateButton($starttxt, 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) Local $bStarted = False ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton $bStarted = Not $bStarted GUICtrlSetData($idButton, $bStarted ? $stoptxt : $starttxt) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example He then had a moment of genius, and came up with this. #include <GUIConstantsEx.au3> Example() Func Example() ; Create a GUI with various controls. Local $hGUI = GUICreate("Example", 300, 200) ; Create a button control. Local $idButton = GUICtrlCreateButton("Start", 120, 170, 85, 25) Local $idButton_Close = GUICtrlCreateButton("Close", 210, 170, 85, 25) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Stop Text Local $sText = "Stop" ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idButton_Close ExitLoop Case $idButton GUICtrlSwapData($idButton, $sText) EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example Func GUICtrlSwapData($idCtrl, ByRef $vSwapData) Local $vOldData = GUICtrlRead($idCtrl) GUICtrlSetData($idCtrl, $vSwapData) $vSwapData = $vOldData EndFunc To which I said the following. To which he said. To which I said. To which he said. To which I said. To which he said. To which I said. To which he said. To which I said. To which he laughed ... as I was doing. I then said. And he is.
    1 point
  17. Given all of the examples of looping in the help file, throughout this forum, and on the Internet in general, if you cannot find information on looping maybe you should work on your searching skills before you attempt to work on your scripting skills. I see no attempt at a loop in the image that you have provided. Is what you have provided the total extent of your efforts? There is a whole topic in the Help file called "Loop Statements" under "Language Reference". Each has one or more examples.
    1 point
  18. $aRow = _StringSplitRegExp($sRow, ',(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))') #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: WeaponX Script Function: Split string on regular expression Parameters: String = String to be split Pattern = Pattern to split on IncludeMatch = True / False - Indicates whether or not to include the match in the return (back-reference) Count = Number of splits to perform #ce ---------------------------------------------------------------------------- Func _StringSplitRegExp($sString, $sPattern, $sIncludeMatch = false, $iCount = 0) ;All matches will be replaced with this string Local $sReservedPattern = Chr(0) ;Local $sReservedPattern = "#" Local $sReplacePattern = $sReservedPattern ;Modify the reserve pattern to include back-reference If $sIncludeMatch Then $sReplacePattern = "$0" & $sReplacePattern ;Replace all occurences of the search pattern with a replace string $sTemp = StringRegExpReplace($sString, $sPattern, $sReplacePattern, $iCount) ;Consolewrite($sTemp & @CRLF) ;Strip trailing character if it matches the reserved pattern If StringRight($sTemp, 1) = $sReservedPattern Then $sTemp = StringTrimRight($sTemp, 1) ;Split string using entire reserved string $aResult = StringSplit($sTemp, $sReservedPattern, 1) Return $aResult EndFunc
    1 point
×
×
  • Create New...