Leaderboard
Popular Content
Showing content with the highest reputation on 05/20/2015 in all areas
-
_ChooseColor in <Misc.au3> is based on ChooseColor function in comdlg32.dll. ChooseColor is depending on a CHOOSECOLOR structure. The Flags and lpfnHook fields in this structure can be used to create a hook function for the ChooseColor window. This hook function can be used to simulate a modeless ChooseColor window. There are two interesting features of a hook funtion. It allows you to receive windows messages even if the ChooseColor dialog is a modal window. And it makes it possible to determine which messages are to be forwarded to the ChooseColor dialog, and which are not to be forwarded. The hook function receives Windows messages before the ChooseColor dialog. If the hook function returns 0, the messages are forwarded to the ChooseColor dialog. If the hook function returns 1 (not 0), the messages are not forwarded to the ChooseColor dialog. Messages that are not forwarded to ChooseColor should be processed by the hook function. When the OK button in ChooseColor dialog is clicked, this click is handled by the hook function and not forwarded to the ChooseColor dialog. This means, that the ChooseColor window does not close. In the hook function the selected color is calculated and send to the AutoIt window with _SendMessage. In the zip below the main AutoIt GUI, ChooseColor.au3, contains a button. When you click this button another script, ModelessCC.au3, is started with ShellExecute. ModelessCC.au3 opens the ChooseColor dialog. There is no message loop in ModelessCC.au3. But because ChooseColor is modal, ModelessCC.au3 will not exit until ChooseColor is closed. The hook function is also running in ModelessCC.au3. The hook function is running even if ChooseColor is modal. The function catches the OK button clicks in ChooseColor and sends the color to the main AutoIt GUI with _SendMessage. The hook function and ChooseColorEx is coded in MiscEx.au3. The main AutoIt GUI contains 12 labels. Click a label, select a color in the ChooseColor dialog, click the OK button, and the background color of the label will be set to the selected color. You can select colors for all 12 labels without closing the ChooseColor dialog. Tested with AutoIt 3.3.10 on Windows 7 64 bit and Windows XP 32 bit. ModelessChooseColor.7z3 points
-
Forum upgraded from 4.0.5.1 to 4.0.6. Release Notes1 point
-
StringRegExp($files[$x],".*\\(.+)$",3)returns an array Try ConsoleWrite("??? Path "&StringRegExp($files[$x],".*\\(.+)$",3)[0] & @lf)1 point
-
AutoIt Eye Clock v1.3.1 build 2015-06-28
coffeeturtle reacted to UEZ for a topic
How to create a screensaver using AutoIt -> https://www.autoitscript.com/forum/topic/164699-autoit-screensaver-collection-gdiplus-direct2d Download links on German AutoIt site are broken. You can use this link to download the screensavers: http://www.mediafire.com/download/ltmcf23uikd1apn/AutoIt_ScreenSavers_using_Direct2D.7z1 point -
1 point
-
Check @error after calling _FileGetTime and you will see that it equals 1. The file doesn't exist because you aren't taking any subdirectories into account. You could change the last parameter of _FileListToArrayRec to $FLTAR_FULLPATH, and then modify your call to _FileGetTime to remove the hardcoded path.1 point
-
Because you're using $FLTAR_NOPATH. Try without it1 point
-
PCI, Do you mean something like this: #include <FileConstants.au3> #include <MsgBoxConstants.au3> ; Create file $sFile = "Test.csv" $hFile = FileOpen($sFile, $FO_OVERWRITE) $sLine = "" ; Produce numbers (100 here as an example) For $i = 1 To 100 ; Create a random number $sNumber = String(3000000 + Random(0, 6000000, 1)) ; Calculate a check digit $iCheckSum = 0 For $j = 1 To 7 $iCheckSum += StringMid($sNumber, $j, 1) Next $iCheckDigit = Mod($iChecksum, 10) ; Add the number and check digit to the line $sLine &= $sNumber & "-" & $iCheckDigit & "," ; Write every a line to the file every 5 numbers If Mod($i, 5) = 0 Then $sLine = StringTrimRight($sLine, 1) FileWrite($hFile, $sLine & @CRLF) $sLine = "" EndIf Next ; Close the file FileClose($hFile) ; And here is the result $sData = FileRead($sFile) MsgBox($MB_SYSTEMMODAL, "Random", $sData)Just out of interest, why do you need so many random numbers? M23 Edit: And here is the Luhn version (now I know what it is!): #include <FileConstants.au3> #include <MsgBoxConstants.au3> $sFile = "Test.csv" $hFile = FileOpen($sFile, $FO_OVERWRITE) $sLine = "" For $i = 1 To 100 $sNumber = String(3000000 + Random(0, 6000000, 1)) $iCheckSum = 0 For $j = 1 To 7 $iCheckSum += StringMid($sNumber, $j, 1) Next $iCheckSum *= 9 $sCheckDigit = StringRight(String($iCheckSum), 1) $sLine &= $sNumber & $sCheckDigit & "," If Mod($i, 5) = 0 Then $sLine = StringTrimRight($sLine, 1) FileWrite($hFile, $sLine & @CRLF) $sLine = "" EndIf Next FileClose($hFile) $sData = FileRead($sFile) MsgBox($MB_SYSTEMMODAL, "Random", $sData)1 point
-
Thought it might be something like that. Congrats and welcome to the Autoit boards!1 point
-
1 point
-
The picture shows Rubik's Cube in the middle of a rotation, wherein the layer is rotated 90 degrees. New version for AutoIt 3.3.10 The scripts were flawed. Fixed in this update. 08-01-2013: First post In the Cubes menu there are six cubes from 2*2*2 to 7*7*7: Pocket Cube, Rubik's Cube, Rubik's Revenge, Professor's Cube, V-Cube 6 and V-Cube 7. See http://en.wikipedia.org/wiki/Rubik's_Cube. The Scramble menu scrambles the cube. In the input field in the statusbar you can set the number of scramble steps. The Solve menu automatically solves the cube. In this version it just plays back the undo log. The Build menu shows how the cubes are created. It also shows how the rotation of a layer is simulated. The Scramble, Solve and Build menus puts the program into a Scramble, Solve and Build mode. To leave the Scramble and Solve modes click the menu once more. To leave the Build mode uncheck the menu. The program mode or state appears in the statusbar. See the Help menu for more information about the menus. Rotating a layer in the cube Click an edge of the layer with the left mouse button and hold the button downMove the mouse in the direction you want to rotate the layerRelease the left mouse buttonThe rotating layer in the picture has probably been clicked somewhere on the blue edge. You can't rotate a layer in Scramble, Solve and Build modes. The mouse buttons can be switched in the Options. Rotating the entire cube Click in the window with the right mouse button and hold the button downMove the mouse in the direction you want the cube to rotateRelease the right mouse buttonThe description of the mouse rotations can be found in the Help menu. Using the keyboard Use the arrow keys or <A,a>, <W,w>, <S,s>, <Z,z> to rotate the cube. Use <Home> or <H,h> to place the cube in the start position. Use <Page Up> or <I,i> and <Page Down> or <O,o> to zoom in and out. Use Num 1-6 or 1-6 to show the 6 sides of the cube. The program Inspiration for the program is from this site: http://rubiksim.sourceforge.net/. The graphics is generated with old style OpenGL 1.1. Some OpenGL globals and functions are copied from this thread http://www.autoitscript.com/forum/index.php?showtopic=83581 by trancexx. Especially globals and functions for creating an OpenGL window and a rendering context. Zipfile The zipfile contains a number of files: RubiksCube.au3 - GUI and main loop, run this fileMenuFncs.au3 - implements the menu systemMenuWins.au3 - creates menu system windowsKeyboard.au3 - code for shortcut keysOGLconsts.au3 - OpenGL constantsOGLfuncs.au3 - OpenGL functionsCubes.au3 - creates the cubesTurnLayer.au3 - rotate a layerRotateCube.au3 - rotate the cubeScramble.au3 - scramble functionSolveCube.au3 - solve functionsBuild.au3 - build functionsUtilities.au3 - calculations(The files are edited with Notepad++ with a tabwidth of 2. This doesn't match the default settings in Scite.) 21-01-2013: Update #1 Fixed some errors in the Build menu. Added a log to see the colors of all sides at one time. See picture in post #5. RubiksCube3.3.10.7z Testet on XP 32 bit and Win 7 32/64 bit. Previous versions for AutoIt 3.3.81 point
-
UDF: _FileGetTreeList, _FileFindAllR
Cheekybugger reacted to blindwig for a topic
My function _FileGetTreeList is used to get the directory structure listed in an array, like doing a "dir /ad/s/b" and saving it to an array. This function can display a progress meter so you can see how far into the tree it is (also so you don't think it has frozen) CODE;=============================================================================== ; ; Function Name: _FileGetTreeList ; Description: Returns a recursive list of directories ; Parameter(s): $Path = root path to begin the listing from ; $ProgressTitle = A title to put on a progress window. Empty String = no progress window ; Requirement(s): $Path is an existing directory ; Return Value(s): A 1-based array containing the full path of all found directories ; Note: Upon return, @Extended will contain a count of files (non-folders) found while searching for folders ; Author(s): Mike Ratzlaff <mike@ratzlaff.org> ; Revision: 20050622A ; ;=============================================================================== ; Func _FileGetTreeList($Path, $ProgressTitle = @ScriptName) Dim $aDirList[100], $TotalFiles = 0 If $ProgressTitle <> '' Then ProgressOn($ProgressTitle, 'Scanning directories...', '', -1, -1, 16) If _FileIsDir($Path) Then $TotalFiles = __FileGetTreeList($aDirList, $Path, $ProgressTitle) EndIf If $ProgressTitle <> '' Then ProgressOff() SetExtended($TotalFiles) ReDim $aDirList[$aDirList[0]+1] Return $aDirList EndFunc Func __FileGetTreeList(ByRef $aDirList, $Path, $ProgressTitle) Dim $hndSearch_Dirs, $FileCount If $ProgressTitle <> '' Then ProgressSet(random(99), $Path) ;Add the current directory on to the list $aDirList[0] = $aDirList[0] + 1 If $aDirList[0] > UBound($aDirList) - 1 Then ReDim $aDirList[$aDirList[0] + 20] $aDirList[$aDirList[0]] = $Path ;Scan for more directories $hndSearch_Dirs = FileFindFirstFile($Path & '\*') If $hndSearch_Dirs <> -1 Then $sFileName = FileFindNextFile($hndSearch_Dirs) While Not @error If _FileIsDir($Path & '\' & $sFileName) Then ;Recurse into the directory, if it's not a special directory If $sFileName <> '.' And $sFileName <> '..' Then $FileCount = $FileCount + __FileGetTreeList($aDirList, $Path & '\' & $sFileName, $ProgressTitle) EndIf Else ;Add to the filecount $FileCount = $FileCount + 1 EndIf $sFileName = FileFindNextFile($hndSearch_Dirs) WEnd EndIf FileClose($hndSearch_Dirs) Return $FileCount EndFunc My _FileFindAllR function will return a list of files, found recursively, that match a given mask and attribute filter. This function also has an optional progress meter. The speed has been optimized by pre-fetching the directory structure and file count, so that these items don't have to be calculated dynamically. CODE;=============================================================================== ; ; Function Name: _FileFindAllR ; Description: Returns a recursive list of files ; Parameter(s): $Path = root path to begin the listing from ; $Mask = file mask to match ; $AttribFilter = File Attributes to filter files through. See _FileFilterAttrib for details ; $ProgressTitle = A title to put on a progress window. Empty String = no progress window ; Requirement(s): $Path is an existing directory ; Return Value(s): A 1-based array containing the full path of all found files ; Author(s): Mike Ratzlaff <mike@ratzlaff.org> ; Revision: 20050622A ; ;=============================================================================== ; ;Returns a recursive list of files under $Path, matching $Mask, and filtered through $AttribFilter Func _FileFindAllR($Path, $Mask='*', $AttribFilter='dhs', $ProgressTitle = @ScriptName) Dim $i, $aDirList = _FileGetTreeList($Path, $ProgressTitle), $FileList[@extended + 1] If $ProgressTitle <> '' Then ProgressOn($ProgressTitle, 'Scanning files...', '', -1, -1, 16) For $i = 1 to $aDirList[0] If $ProgressTitle <> '' Then ProgressSet($i * 100 / $aDirList[0], $aDirList[$i]) __FileFindAllR($FileList, $aDirList[$i], $Mask, $AttribFilter) Next If $ProgressTitle <> '' Then ProgressOff() ReDim $FileList[$FileList[0]+1] Return $FileList EndFunc Func __FileFindAllR(ByRef $aFileList, $Path, $Mask, $AttribFilter) Dim $hndSearch_Files $hndSearch_Files = FileFindFirstFile($Path & '\' & $Mask) If $hndSearch_Files <> -1 Then $sFileName = FileFindNextFile($hndSearch_Files) While Not @error If _FileFilterAttrib($Path & '\' & $sFileName, $AttribFilter) And $sFileName <> '.' And $sFileName <> '..' Then $aFileList[0] = $aFileList[0] + 1 $aFileList[$aFileList[0]] = $Path & '\' & $sFileName EndIf $sFileName = FileFindNextFile($hndSearch_Files) WEnd FileClose($hndSearch_Files) EndIf EndFunc These functions require my _FileFilterAttrib function, and also my _FileIsDir function: CODE;=============================================================================== ; ; Function Name: _FileIsDir ; Description: Returns true or false weather given file is a directory or not ; Parameter(s): $Path ; Requirement(s): ; Return Value(s): 0 = not a directory or does not exist, 1 = file exists and is a directory ; Author(s): Mike Ratzlaff <mike@ratzlaff.org> ; Revision: 20050623A ; ;=============================================================================== ; Func _FileIsDir($Path) ;This function checkes to see if $FileName exists and if it is a Directory If StringInStr(FileGetAttrib($Path),'D') Then Return 1 Return 0 EndFunc1 point