Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/12/2023 in all areas

  1. Gianni

    AutoIt Snippets

    This function has the same functionality as the one in the above post, The only difference is that the one above counts the days in sequence until it reaches the required number of days (in a kind of brute force), while the latter calculates the target week and then only counts the last few days left. This way it is much faster especially for dates far from the initial one. (I also changed the function name from _WorkDay() to _DateAddWorkDay) I copied the calculation from <this post> by @Nine (thanks) if you find any bugs please report. #include <date.au3> ; #FUNCTION# ==================================================================================================================== ; Name ..........: _DateAddWorkDay ; Description ...: Calculates a new date by adding/subtracting a specified number of Days from an initial date, excluding from the count ; those days corresponding to specified weekdays. (By defaul Sundays and Saturdays are excluded from the count). ; You can freely choose the days of the week to be considered as non-working days. See the third parameter for this. ; Syntax ........: _DateAddWorkDay([$StartDate = _NowCalcDate([, $iDays = 0[, $sHolidays = "17"]]]) ; Parameters ....: $StartDate - Initial date in the format YYYY/MM/DD ; (no check is made on the correctness of the date provided) ; ; $iDays - Number of business days to add/subtract (use negative number to count back) ; a zero value indicates that the StartDate itself will be returned. ; (Indicating 0 the StartDate is returned even if this corresponds to a non-working day, ; but in this case the @error flag is set to 1. This can be useful if you need to check ; if a specified date is a working or not working day) ; ; $sHolidays - a string of digits indicating not working days of week. Default is "17". ; Indicate the days of the week to be considered as non-working days. ; (not to be considered in the count). $sHolidays represents a string with any combination ; of digits from 1 to 7 (the comma between the digits is optional). Digit correspond as follows: ; 1=Sunday, 2 =Monday , 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday. ; if you want to consider working all days of the week pass an empty string. ; (if, by contradiction, all seven days of the week are indicated as holidays, then the day ; pointed to by $Days is returned anyway, but the @error flag is also set to 1) ; ; Return values .: Target date in the "YYYY/MM/DD" format ; Author ........: Gianni ; Modified ......: ; ; Remarks .......: It is possible to force the function to return a date even if it belongs to a non-working day. ; This is possible by passing 0 as the second parameter and setting the start date to point to a non working day of the week. ; In this case, even if a holiday, that date is returned but the @error flag is set to 1. ; This could be used to check in one shot if a date belongs or not to a day of the week included in the third parameter. ; (also, by setting all seven days as holidays in the third parameter you will be rturned with the date pointed to by the ; second parameter, even if it's holiday, but also in this case the @error flag is set to 1) ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _DateAddWorkDay($StartDate = _NowCalcDate(), $iDays = 0, $sHolidays = "17") Local $iDirection = 1 * ($iDays < 0 ? -1 : $iDays > 0) Local $sWorkDays = StringRegExpReplace("1234567", "[" & StringRegExpReplace($sHolidays, "[^1234567]", "") & "]", "") Local $iWorkDays = StringLen($sWorkDays) If $iWorkDays = 7 Then Return SetError(1, 0, _DateAdd('D', $iDays, $StartDate)) Local $aYMD = StringSplit($StartDate, "/", 2) If Not $iDirection Then Return SetError(False = StringInStr($sWorkDays, _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]), 2), 0, $StartDate) Local $iNumWeek = Int(($iDays - $iDirection) / $iWorkDays) Local $iDaysRemainder = Mod($iDays - $iDirection, $iWorkDays) + $iDirection $iDays -= $iDaysRemainder $StartDate = _DateAdd("w", $iNumWeek, $StartDate) $aYMD = StringSplit($StartDate, "/", 2) Local $nJulianDate = _DateToDayValue($aYMD[0], $aYMD[1], $aYMD[2]) While $iDaysRemainder $nJulianDate += $iDirection _DayValueToDate($nJulianDate, $aYMD[0], $aYMD[1], $aYMD[2]) $iDaysRemainder -= (StringInStr($sWorkDays, _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]), 2) ? 1 : 0) * $iDirection WEnd Return SetError(0, 0, $aYMD[0] & '/' & $aYMD[1] & '/' & $aYMD[2]) EndFunc ;==>_DateAddWorkDay
    2 points
  2. Introduction JSON is a pure data exchange format. Basically you only have to deal with JSON in 2 places in a program: Once when reading JSON data and once when outputting data. In between it should not really matter that the data used to be JSON or should be converted to it. You should not need any special intermediate structures but only the elements that the respective programming language provides anyway. This is exactly the approach of this UDF: There is the function _JSON_Parse(), which converts an arbitrary JSON string into (nested) pure AutoIt data types (Arrays, Maps, Strings, Numbers, Null, True, False). And on the other side we have the function _JSON_Generate(), which generates a JSON string from arbitrary (nested) AutoIt data structures. Import and export JSON So how to use - let`s give an example: Handling nested data structures JSON is often very nested. The resulting AutoIt data is therefore naturally also nested, which makes it somewhat cumbersome to process with pure AutoIt on-board methods. For this reason, the UDF comes with a few helper functions that make life with this data easier. One of them is _JSON_Get(), which allows you to access deeply nested data with a simple query syntax. On the other hand there is the function _JSON_addChangeDelete() with which you can (the name already says it) change, add and delete data. You can even easily create deeply nested structures with a single call. Again, here is a small example of how to use it: Strictly speaking, these functions should not even have "JSON" in their names, since they are generally applied to data structures in AutoIt. However, since they are often used in the JSON environment, we allow ourselves this small inaccuracy. Why should i give it a try? Probably the most common method to deal with JSON in AutoIt is the variant via JSMN. My minor dissatisfactions with this approach led me to write this UDF in the first place a few years ago. So the incentives are quite JSMN related: Parsing and extraction of data is faster than in JSMN. (Only if the JSON string makes heavy use of JSON escapes should JSMN be a bit faster in parsing, since the escapes are resolved later.) Editing the data is easier, because you don't need special commands for the JSMN intermediate structure but deal directly with AutoIt structures. Generating JSON is also simple: build your structure in AutoIt as you like and then let it generate a JSON string for you with _JSON_Generate(). The UDF is smaller (28kb vs. 45kb) The UDF is in pure AutoIt. You can directly customize any behavior as you like. >>sourcecode and download on github<<
    1 point
  3. Generally, using Sleep to implement a pause to allow time for something specific to happen isn't the best option. While it may seem to always take x seconds for something to happen while you're testing your code, in real world operations your code may run on faster or slower hardware, the CPU or drive may be busy with something else, there may be a network bottleneck or interruption, or anything else to make your x second wait not work. If possible, it's best to find an event or trigger you can look for to tell you when to proceed. (For example, when you get ready to go somewhere with a friend, rather than wait an arbitrary 5 minutes for them to be in the car before you drive away, you wait as long as it takes until you see them in the seat. That's your event or trigger to know that it's safe to proceed.) The suggestion to watch for new windows to be created may provide you with just such an event.
    1 point
  4. I changed the StringSplit to the _ArrayFromString for a better fit in the cells with the | and the @CRLF #include <Array.au3> #include <Excel.au3> #include <File.au3> Global $OutFile = @ScriptDir & "\Yeni.xls" Local $oExcel = _Excel_Open() ; Excel uygulaması başarısız olduysa, hata mesajı yazdır ve kodu sonlandır If @error Then MsgBox(16, "Hata", "Excel uygulaması açılamadı.") Exit EndIf ; yeni dosya aç Global $oWorkbook = _Excel_BookNew($oExcel, 1) ; Okunacak dosyaların adlarını al Global $fileList = _FileListToArray(@ScriptDir, "*.txt") ConsoleWrite("$fileList[0]=" & $fileList[0] & @CRLF) Global $inputFileName, $fileContent, $dataArray, $oSheet, $iRow ; Her dosyayı oku ve excel dosyasına aktar For $i = 1 To $fileList[0] ; Okunacak dosyanın adı $inputFileName = $fileList[$i] ConsoleWrite("$inputFileName=" & $inputFileName & @CRLF) ; Dosyayı oku ve verileri diziye aktar $fileContent = FileRead(@ScriptDir & "\" & $inputFileName) $dataArray = _ArrayFromString($fileContent) ; Verileri excel dosyasına aktar $oSheet = _Excel_SheetAdd($oWorkbook, -1, True, 1, $inputFileName) If @error Then MsgBox(16, "Hata", "Sayfa eklenirken bir hata oluştu.") Exit EndIf _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $dataArray, "A1") If @error Then MsgBox(16, "Hata", "Çalışma sayfasına yazarken hata.") Exit EndIf Next ; Excel uygulamasını kapat $oWorkbook.SaveAs($OutFile) _Excel_BookClose($oWorkbook, 0) _Excel_Close($oExcel)
    1 point
  5. #include <Array.au3> #include <Excel.au3> #include <File.au3> Global $OutFile = @ScriptDir & "\Yeni.xls" Local $oExcel = _Excel_Open() ; Excel uygulaması başarısız olduysa, hata mesajı yazdır ve kodu sonlandır If @error Then MsgBox(16, "Hata", "Excel uygulaması açılamadı.") Exit EndIf ; Çıktı dosyasını aç ;~ Local $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\" & $OutFile) Global $oWorkbook = _Excel_BookNew($oExcel, 1) ; Çıktı dosyası açılamazsa, hata mesajı yazdır ve kodu sonlandır If @error Then MsgBox(16, "Hata", "Çıktı dosyası açılamadı.") _Excel_Close($oExcel) Exit EndIf ; Okunacak dosyaların adlarını al Global $fileList = _FileListToArray(@ScriptDir, "*.txt") ConsoleWrite("$fileList[0]=" & $fileList[0] & @CRLF) ;~ ; Okunacak dosya sayısı ;~ Local $fileCount = UBound($fileList) - 1 Global $inputFileName, $fileContent, $dataArray, $oSheet, $iRow ; Her dosyayı oku ve excel dosyasına aktar For $i = 1 To $fileList[0] ; Okunacak dosyanın adı $inputFileName = $fileList[$i] ConsoleWrite("$inputFileName=" & $inputFileName & @CRLF) ;~ ; Dosya okunamazsa, hata mesajı yazdır ve diğer dosyaya geç ;~ If Not FileExists(@ScriptDir & "\" & $inputFileName) Then ;~ MsgBox(16, "Hata", $inputFileName & " dosyası okunamadı.") ;~ ContinueLoop ;~ EndIf ; Dosyayı oku ve verileri diziye aktar $fileContent = FileRead(@ScriptDir & "\" & $inputFileName) $dataArray = StringSplit(StringStripCR($fileContent), @LF, 1) ; Verileri excel dosyasına aktar ;~ $oSheet = _Excel_BookNew($oWorkbook, 1) ;~ _Excel_RangeWrite($oSheet, $dataArray, "A1") $oSheet = _Excel_SheetAdd($oWorkbook, 1, True, 1, $inputFileName) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_SheetAdd", "Error adding sheet." & @CRLF & "@error = " & @error & ", @extended = " & @extended) For $r = 1 To $dataArray[0] $oSheet.Cells($r, 1).Value = $dataArray[$r] Next Next ; Excel uygulamasını kapat ;~ _Excel_BookSaveAs($oWorkbook, @ScriptDir & "\" & $OutFile, "xlsx") $oWorkbook.SaveAs($OutFile) _Excel_BookClose($oWorkbook, 0) _Excel_Close($oExcel) @mistersquirrle you got me
    1 point
  6. I was testing this out and was just about to suggest what @rsn did. It seems like it's a x64 thing. This worked for me: #AutoIt3Wrapper_UseX64=y #include <Constants.au3> Global $sCommandLine = ' "C:\Windows\System32\dsregcmd.exe" /status ' ; >C:\GlobalDocs\intune.txt Global $sWorkingDir = 'C:\WINDOWS\system32' ; @SystemDir Global $iPid = Run(@ComSpec & " /c " & $sCommandLine, $sWorkingDir, @SW_HIDE, BitOR($RUN_CREATE_NEW_CONSOLE, $STDERR_MERGED)) ProcessWaitClose($iPid) ConsoleWrite(StdoutRead($iPid) & @CRLF) Or: #AutoIt3Wrapper_UseX64=y #include <Constants.au3> Global $sOutputFile = 'c:\temp\intune.txt' Global $sCommandLine = 'c:\windows\system32\dsregcmd.exe /status>' & $sOutputFile Global $iPid = Run(@ComSpec & " /c " & $sCommandLine, @SystemDir, @SW_HIDE, BitOR($RUN_CREATE_NEW_CONSOLE, $STDERR_MERGED)) ProcessWaitClose($iPid) ConsoleWrite('StdoutRead: ' & @CRLF & StdoutRead($iPid) & @CRLF) ConsoleWrite('FileRead: ' & @CRLF & FileRead($sOutputFile) & @CRLF)
    1 point
  7. Try this, again I can't test it because I don't have Excel, however there were a few issues with what you had when I looked at the functions vs the helpfile: #include <Array.au3> #include <Excel.au3> #include <File.au3> Global $OutFile = "Yeni.xlsx" Global $oExcel = _Excel_Open() ; Excel uygulaması başarısız olduysa, hata mesajı yazdır ve kodu sonlandır If @error Then ConsoleWrite('Excel uygulaması açılamadı. Unable to _Excel_Open, @error: ' & @error & ', @extended: ' & @extended & @CRLF) Exit EndIf ; Çıktı dosyasını aç ; Try to open an existing book, if not it'll try to create a new one Global $oWorkbook = _Excel_BookOpen($oExcel, @ScriptDir & "\" & $OutFile) ; Çıktı dosyası açılamazsa, hata mesajı yazdır ve kodu sonlandır If @error Then ConsoleWrite('Çıktı dosyası açılamadı. Unable to do _Excel_BookOpen, @error: ' & @error & ', @extended: ' & @extended & @CRLF) ConsoleWrite('Trying to create a new book and save it...' & @CRLF) $oWorkbook = _Excel_BookNew($oExcel, 1) If @error Then ConsoleWrite('Unable to do _Excel_BookNew, @error: ' & @error & ', @extended: ' & @extended & @CRLF) Exit EndIf _Excel_BookSaveAs($oWorkbook, @ScriptDir & "\" & $OutFile, $xlWorkbookDefault, True) If @error Then ConsoleWrite('Unable to do _Excel_BookSaveAs, @error: ' & @error & ', @extended: ' & @extended & @CRLF) Exit EndIf EndIf ; Okunacak dosyaların adlarını al Global $fileList = _FileListToArray(@ScriptDir, "*.txt") ; Okunacak dosya sayısı Global $fileCount = UBound($fileList) - 1 Global $inputFileName Global $dataArray Global $oSheet ; Her dosyayı oku ve excel dosyasına aktar For $i = 1 To $fileCount Step 1 ; Okunacak dosyanın adı $inputFileName = $fileList[$i] ; Dosya okunamazsa, hata mesajı yazdır ve diğer dosyaya geç If Not FileExists(@ScriptDir & "\" & $inputFileName) Then MsgBox(16, "Hata", $inputFileName & " dosyası okunamadı.") ContinueLoop EndIf ; Dosyayı oku ve verileri diziye aktar ;~ Local $fileContent = FileRead(@ScriptDir & "\" & $inputFileName) ;~ Local $dataArray = StringSplit(StringStripCR($fileContent), @LF, 1) _FileReadToArray(@ScriptDir & "\" & $inputFileName, $dataArray, $FRTA_NOCOUNT, '|') ; _ArrayDisplay($dataArray) ; Verileri excel dosyasına aktar ;~ $oSheet = _Excel_BookNew($oExcel, 1) $oSheet = _Excel_SheetAdd($oWorkbook, -1, False, 1, $inputFileName) If @error Then ConsoleWrite('Unable to do _Excel_BookNew, @error: ' & @error & ', @extended: ' & @extended & @CRLF) ContinueLoop EndIf _Excel_RangeWrite($oWorkbook, $oSheet, $dataArray, "A1") If @error Then ConsoleWrite('Unable to do _Excel_RangeWrite, @error: ' & @error & ', @extended: ' & @extended & @CRLF) ContinueLoop EndIf Next ; Excel uygulamasını kapat _Excel_BookSaveAs($oWorkbook, @ScriptDir & "\" & $OutFile, $xlWorkbookDefault) If @error Then ConsoleWrite('Unable to do _Excel_BookSaveAs, @error: ' & @error & ', @extended: ' & @extended & @CRLF) EndIf _Excel_BookClose($oWorkbook, False) If @error Then ConsoleWrite('Unable to do _Excel_BookClose, @error: ' & @error & ', @extended: ' & @extended & @CRLF) EndIf _Excel_Close($oExcel) If @error Then ConsoleWrite('Unable to do _Excel_Close, @error: ' & @error & ', @extended: ' & @extended & @CRLF) EndIf I added some more logging, so that you can see what/where a problem exists. If you can, try this and then copy/paste the output in the console here so that I can see what messages come up. As for the issues that you had, I don't think that _Excel_BookNew is what you wanted before you wrote data. When writing data, _Excel_RangeWrite using the wrong parameters, and needed $oWorkbook first. The third parameter of _Excel_BookSaveAs was also incorrect, it should be something from: https://learn.microsoft.com/en-us/office/vba/api/excel.xlfileformat
    1 point
  8. Gianni

    AutoIt Snippets

    _WorkDay() Returns the date that is the specified number of working days before or after the start date This is a variation of a function from this post that implements more features, namely, the function allows 3 parameters: $StartDate: Date representing the start date of the count. (no check is made on the correctness of the date provided) $iDays: Number of working days before or after the start_date. A positive value indicates a future date; a negative value indicates a past date; a zero value indicates the start_date itself. (Indicating 0 the departure date is returned even if this corresponds to a non-working day, but in this case the @error flag is set to 1) $sHolidays: Optional (default 1,7). Indicate the days of the week considered non-working (not to be considered in the count). $sHolidays represents a string with any combination of digits from 1 to 7 (the comma between the digits is optional) which indicates the days of the week to be considered holidays which correspond as follows: 1=Sunday, 2 =Monday , 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday. if you want to consider working all days of the week pass an empty string then. (if, by contradiction, all seven days of the week are indicated as holidays, the day pointed to by $Days is returned anyway, but the @error flag is also set to 1) I hope there are no bugs. Have fun. #include <date.au3> _Example() ; 1=Sunday, 2 =Monday , 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday, 7=Saturday Func _Example() Local $Start = _NowCalcDate() Local $count = 25 MsgBox(0, 'example 1', "The " & $count & "th working days past " & $Start & " is " & _WorkDay($Start, $count)) $count = -9 MsgBox(0, 'example 2', $count & " workdays ago: " & _WorkDay($Start, $count)) $Start = "2022/12/31" $count = 33 $NoCountWeekDays = '234567' ; <-- all holidays except Sunday (count only the Sunday) MsgBox(0, 'example 3', "The " & $count & "th Sunday of the 2023 is on " & _WorkDay($Start, $count, $NoCountWeekDays)) $Start = _NowCalcDate() $count = -15 ; negative $NoCountWeekDays = '134567' ; <-- all holidays except Monday (count only the Monday) MsgBox(0, 'example 4', $count & " Mondays ago was " & _WorkDay($Start, $count, $NoCountWeekDays)) EndFunc ;==>_Example ; #FUNCTION# ==================================================================================================================== ; Name ..........: _WorkDay ; Description ...: ; Syntax ........: _WorkDay([$StartDate = _NowCalcDate([, $iDays = 0[, $sHolidays = "17"]]]) ; Parameters ....: $StartDate - Start day. ; $iDays - number of WorkDays to count (positive or negative) ; $sHolidays - a string of digits indicating not working days of week. Default is "17". ; Return values .: Target date ; Author ........: Gianni ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _WorkDay($StartDate = _NowCalcDate(), $iDays = 0, $sHolidays = "17") Local $iDirection = 1 * ($iDays < 0 ? -1 : $iDays > 0), $iWeekdays = 0 Local $iWorkDays = StringRegExpReplace("1234567", "[" & StringRegExpReplace($sHolidays, "[^1234567]", "") & "]", "") Local $aYMD = StringSplit($StartDate, "/", 2) Local $nJulianDate = _DateToDayValue($aYMD[0], $aYMD[1], $aYMD[2]) If Not $iDirection Then Return SetError(False = StringInStr($iWorkDays, _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]), 2), 0, $StartDate) If $iWorkDays = '' Then Return SetError(1, 0, _DateAdd('D', $iDays, $StartDate)) $iDays = Abs($iDays) Do $nJulianDate += $iDirection _DayValueToDate($nJulianDate, $aYMD[0], $aYMD[1], $aYMD[2]) $iWeekdays += (StringInStr($iWorkDays, _DateToDayOfWeek($aYMD[0], $aYMD[1], $aYMD[2]), 2) ? 1 : 0) Until $iWeekdays = $iDays Return SetError(0, 0, $aYMD[0] & '/' & $aYMD[1] & '/' & $aYMD[2]) EndFunc ;==>_WorkDay
    1 point
  9. argumentum

    Opt(SetExitCode,0/1)

    We get new features but the awareness does not propagate and become common knowledge fast enough so, here is an example of use: Opt("SetExitCode", 1) OnAutoItExitRegister("__OnAutoItExit") Example() Func Example() Local $n, $a[6] = [5, 5, 4, 3, 2, 1] For $n = 1 To 100 ToolTip('..crashing in ' & $a[$n], 50, 50, "CrashTest") ConsoleWrite('..crashing in ' & $a[$n] & @CRLF) Sleep(500) Next EndFunc ;==>Example Func __OnAutoItExit() Local $sExitMethod Switch @exitMethod Case 0 $sExitMethod = "closed by natural closing." Case 1 $sExitMethod = "closed by Exit function." Case 2 $sExitMethod = "closed by clicking on exit of the systray." Case 3 $sExitMethod = "closed by user logoff." Case 4 $sExitMethod = "closed by Windows shutdown." Case Else $sExitMethod = "closed by no clue." EndSwitch ;~ If @exitCode Then MsgBox(262144, @ScriptName, "I could do something with the error from here", 2) MsgBox(262144, @ScriptName, "Oh !, wait, we now can =)" & @CR & _ @CR & "The error was: " & Hex(@exitCode) & _ @CR & "Meaning: """ & FatalErrormessageFromExitCode(@exitCode) & """" & _ @CR & "and the ExitMethod was """ & $sExitMethod & """" & _ @CR & @CR & " =)", 60) EndFunc ;==>__OnAutoItExit Func FatalErrormessageFromExitCode($iExitCode) ; from the help file Local $sExitCode = 'uncatalogued event' Switch $iExitCode Case 0x7FFFF068 $sExitCode = '"EndWith" missing "With". ' Case 0x7FFFF069 $sExitCode = 'Badly formatted "Func" statement. ' Case 0x7FFFF06A $sExitCode = '"With" missing "EndWith". ' Case 0x7FFFF06B $sExitCode = 'Missing right bracket '') '' in expression. ' Case 0x7FFFF06C $sExitCode = 'Missing operator in expression. ' Case 0x7FFFF06D $sExitCode = 'Unbalanced brackets in expression. ' Case 0x7FFFF06E $sExitCode = 'Error in expression. ' Case 0x7FFFF06F $sExitCode = 'Error parsing function call. ' Case 0x7FFFF070 $sExitCode = 'Incorrect number of parameters in function call. ' Case 0x7FFFF071 $sExitCode = '"ReDim" used without an array variable. ' Case 0x7FFFF072 $sExitCode = 'Illegal text at the end of statement (one statement per line). ' Case 0x7FFFF073 $sExitCode = '"If" statement has no matching "EndIf" statement. ' Case 0x7FFFF074 $sExitCode = '"Else" statement with no matching "If" statement. ' Case 0x7FFFF075 $sExitCode = '"EndIf" statement with no matching "If" statement. ' Case 0x7FFFF076 $sExitCode = 'Too many "Else" statements for matching "If" statement. ' Case 0x7FFFF077 $sExitCode = '"While" statement has no matching "WEnd" statement. ' Case 0x7FFFF078 $sExitCode = '"WEnd" statement with no matching "While" statement. ' Case 0x7FFFF079 $sExitCode = 'Variable used without being declared. ' Case 0x7FFFF07A $sExitCode = 'Array variable has incorrect number of subscripts or subscript dimension range exceeded. ' Case 0x7FFFF07B $sExitCode = 'Variable subscript badly formatted. ' Case 0x7FFFF07C $sExitCode = 'Subscript used on non-accessible variable. ' Case 0x7FFFF07D $sExitCode = 'Too many subscripts used for an array. ' Case 0x7FFFF07E $sExitCode = 'Missing subscript dimensions in "Dim" statement. ' Case 0x7FFFF07F $sExitCode = 'No variable given for "Dim", "Local", "Global", "Static" or "Const" statement. ' Case 0x7FFFF080 $sExitCode = 'Expected a "=" operator in assignment statement. ' Case 0x7FFFF081 $sExitCode = 'Invalid keyword at the start of this line. ' Case 0x7FFFF082 $sExitCode = 'Array maximum size exceeded. ' Case 0x7FFFF083 $sExitCode = '"Func" statement has no matching "EndFunc". ' Case 0x7FFFF084 $sExitCode = 'Duplicate function name. ' Case 0x7FFFF085 $sExitCode = 'Unknown function name. ' Case 0x7FFFF086 $sExitCode = 'Unknown macro. ' Case 0x7FFFF088 $sExitCode = 'Unable to get a list of running processes. ' Case 0x7FFFF08A $sExitCode = 'Invalid element in a DllStruct. ' Case 0x7FFFF08B $sExitCode = 'Unknown option or bad parameter specified. ' Case 0x7FFFF08C $sExitCode = 'Unable to load the internet libraries. ' Case 0x7FFFF08D $sExitCode = '"Struct" statement has no matching "EndStruct". ' Case 0x7FFFF08E $sExitCode = 'Unable to open file, the maximum number of open files has been exceeded. ' Case 0x7FFFF08F $sExitCode = '"ContinueLoop" statement with no matching "While", "Do" or "For" statement. ' Case 0x7FFFF090 $sExitCode = 'Invalid file filter given. ' Case 0x7FFFF091 $sExitCode = 'Expected a variable in user function call. ' Case 0x7FFFF092 $sExitCode = '"Do" statement has no matching "Until" statement. ' Case 0x7FFFF093 $sExitCode = '"Until" statement with no matching "Do" statement. ' Case 0x7FFFF094 $sExitCode = '"For" statement is badly formatted. ' Case 0x7FFFF095 $sExitCode = '"Next" statement with no matching "For" statement. ' Case 0x7FFFF096 $sExitCode = '"ExitLoop/ContinueLoop" statements only valid from inside a For/Do/While loop. ' Case 0x7FFFF097 $sExitCode = '"For" statement has no matching "Next" statement. ' Case 0x7FFFF098 $sExitCode = '"Case" statement with no matching "Select" Or "Switch" statement. ' Case 0x7FFFF099 $sExitCode = '"EndSelect" statement with no matching "Select" statement. ' Case 0x7FFFF09A $sExitCode = 'Recursion level has been exceeded - AutoIt will quit to prevent stack overflow. ' Case 0x7FFFF09B $sExitCode = 'Cannot make existing variables static. ' Case 0x7FFFF09C $sExitCode = 'Cannot make static variables into regular variables. ' Case 0x7FFFF09D $sExitCode = 'Badly formated Enum statement ' Case 0x7FFFF09F $sExitCode = 'This keyword cannot be used after a "Then" keyword. ' Case 0x7FFFF0A0 $sExitCode = '"Select" statement is missing "EndSelect" or "Case" statement. ' Case 0x7FFFF0A1 $sExitCode = '"If" statements must have a "Then" keyword. ' Case 0x7FFFF0A2 $sExitCode = 'Badly formated Struct statement. ' Case 0x7FFFF0A3 $sExitCode = 'Cannot assign values to constants. ' Case 0x7FFFF0A4 $sExitCode = 'Cannot make existing variables into constants. ' Case 0x7FFFF0A5 $sExitCode = 'Only Object-type variables allowed in a "With" statement. ' Case 0x7FFFF0A6 $sExitCode = '"long_ptr", "int_ptr" and "short_ptr" DllCall() types have been deprecated. Use "long*", "int*" and "short*" instead. ' Case 0x7FFFF0A7 $sExitCode = 'Object referenced outside a "With" statement. ' Case 0x7FFFF0A8 $sExitCode = 'Nested "With" statements are not allowed. ' Case 0x7FFFF0A9 $sExitCode = 'Variable must be of type "Object". ' Case 0x7FFFF0AA $sExitCode = 'The requested action with this object has failed. ' Case 0x7FFFF0AB $sExitCode = 'Variable appears more than once in function declaration. ' Case 0x7FFFF0AC $sExitCode = 'ReDim array can not be initialized in this manner. ' Case 0x7FFFF0AD $sExitCode = 'An array variable can not be used in this manner. ' Case 0x7FFFF0AE $sExitCode = 'Can not redeclare a constant. ' Case 0x7FFFF0AF $sExitCode = 'Can not redeclare a parameter inside a user function. ' Case 0x7FFFF0B0 $sExitCode = 'Can pass constants by reference only to parameters with "Const" keyword. ' Case 0x7FFFF0B1 $sExitCode = 'Can not initialize a variable with itself. ' Case 0x7FFFF0B2 $sExitCode = 'Incorrect way to use this parameter. ' Case 0x7FFFF0B3 $sExitCode = '"EndSwitch" statement with no matching "Switch" statement. ' Case 0x7FFFF0B4 $sExitCode = '"Switch" statement is missing "EndSwitch" or "Case" statement. ' Case 0x7FFFF0B5 $sExitCode = '"ContinueCase" statement with no matching "Select" Or "Switch" statement. ' Case 0x7FFFF0B6 $sExitCode = 'Assert Failed! ' Case 0x7FFFF0B8 $sExitCode = 'Obsolete function/parameter. ' Case 0x7FFFF0B9 $sExitCode = 'Invalid Exitcode (reserved for AutoIt internal use). ' Case 0x7FFFF0BA $sExitCode = 'Variable cannot be accessed in this manner. ' Case 0x7FFFF0BB $sExitCode = 'Func reassign not allowed. ' Case 0x7FFFF0BC $sExitCode = 'Func reassign on global level not allowed. ' EndSwitch Return SetError(0, $iExitCode, $sExitCode) EndFunc ;==>FatalErrormessageFromExitCode #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/mo #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.16.1 #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Opt("SetExitCode", 1) If $CmdLine[0] = 0 Then ; https://www.autoitscript.com/autoit3/docs/appendix/Exitcodes.htm ; for CUI compile, adding "/ErrorStdOut" will write out the line number and error description" ; "(8) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:" MsgBox(262144, "ExitCode:", "0x" & Hex(RunWait('"' & @AutoItExe & '" /ErrorStdOut ' & (@Compiled ? '' : '"' & @ScriptFullPath & '" ') & '/crash')), 8) ElseIf $CmdLine[1] = "/crash" Then $CmdLine[100] = "hmmm" EndIf Edit: There are wrapper functions in v3.3.16.1 but did not know, otherwise I'd have saved me the coding. These func. are _FormatAutoItExitCode() and _FormatAutoItExitMethod() . I created the post after reviewing my tracs and decided to bla, bla, bla ... , and posted
    1 point
  10. mesale0077 asked me whether I could code some CSS loading animations from different web sites. These are the results using GDI+ (AutoIt v3.3.12.0+ required!): _GDIPlus_MonochromaticBlinker.au3 / _GDIPlus_RotatingBokeh.au3 _GDIPlus_SpinningCandy.au3 / _GDIPlus_SteamPunkLoading.au3 _GDIPlus_IncreasingBalls.au3 / _GDIPlus_PacmanProgressbar.au3 _GDIPlus_StripProgressbar.au3 / _GDIPlus_RingProgressbar.au3 _GDIPlus_LineProgressbar.au3 / _GDIPlus_SimpleLoadingAnim.au3 _GDIPlus_TextFillingWithWater.au3 / _GDIPlus_MultiColorLoader.au3 _GDIPlus_LoadingSpinner.au3 / _GDIPlus_SpinningAndPulsing.au3 _GDIPlus_TogglingSphere.au3 / _GDIPlus_CloudySpiral.au3 _GDIPlus_GlowingText.au3 (thanks to Eukalyptus) / _GDIPlus_HypnoticLoader.au3 _GDIPlus_RotatingRectangles.au3 / _GDIPlus_TRONSpinner.au3 _GDIPlus_RotatingBars.au3 / _GDIPlus_AnotherText.au3 (thanks to Eukalyptus) _GDIPlus_CogWheels.au3 (thanks to Eukalyptus) / _GDIPlus_DrawingText.au3 (thanks to Eukalyptus) _GDIPlus_GearsAnim.au3 / _GDIPlus_LEDAnim.au3 _GDIPlus_LoadingTextAnim.au3 / _GDIPlus_MovingRectangles.au3 _GDIPlus_SpinningAndGlowing.au3 (thanks to Eukalyptus) / _GDIPlus_YetAnotherLoadingAnim.au3 _GDIPlus_AnimatedTypeLoader.au3 / _GDIPlus_Carousel.au3 Each animation function has a built-in example how it can be used. AiO download: GDI+ Animated Wait Loading Screens.7z (previous downloads: 1757) Big thanks to Eukalyptus for providing several examples. Maybe useful for some of you Br, UEZ PS: I don't understand CSS - everything is made out of my mind, so it might be different from original CSS examples
    1 point
×
×
  • Create New...