Leaderboard
Popular Content
Showing content with the highest reputation on 04/07/2016 in all areas
-
Or in a simpler form... ; Hours, Minutes, Seconds To Milliseconds Func _HMS_To_MS($H = 0, $M = 0, $S = 0) Return $H * 3600000 + $M * 60000 + $S * 1000 EndFunc ;==>_HMS_To_MS ... & the return trip... ; Milliseconds To Hours:Minutes:Seconds Func _MS_TO_HHMMSS($iMs) $iMs /= 1000 Return StringFormat("%02d:%02d:%02d", Floor($iMs / 3600), Mod(Floor($iMs / 60), 60), Mod($iMs, 60)) EndFunc ;==>_MS_TO_HHMMSS2 points
-
#include <FileConstants.au3> If Number(FileGetTime("file1.txt", $FT_CREATED, 1)) > Number(FileGetTime("file2.txt", $FT_CREATED, 1)) Then _ Msgbox(0, "", "file2 is older than file1")2 points
-
If you can use FileGetTime, you should be able to use StringCompare ( "string1", "string2" [, casesense = 0] ) to compare the two strings.2 points
-
New Version 0.2.1-beta (see 1st post) ; ============================================================================================================================== ; Changes between versions 0.2.0-beta and 0.2.1-beta ; _ArrayAttach - Added a check for the output array size maximum limit. ; _ShuffleArray - Rewrote the code to be used with the option $iDimension = 0. ; _DeleteRegion - New Function added. ; _ArrayUniqueXD - Replaces the depreciated function _UniqueRegion. ; _ReverseArray - New Function added. ; ============================================================================================================================== This release includes several improvements on the existing code (some small changes are not mentioned). The biggest change is the renaming of _UniqueRegion() to _ArrayUniqueXD(). Anyone who was using it will have to change the function name in scripts that are affected. Also, tests have been carried out on _ArraySortXD() for up to 16 million elements. Expect more functions, and be aware that some error codes may also change, in the not too distant future. Now let's peel that spud! #include 'ArrayWorkshop.au3' ; Delete the outer regions of a cube Local $aCube = [[['0','1','2','3'],['4','5','6','7'],['8','9','A','B'],['C','D','E','F']], _ [['G','H','I','J'],['K','X','X','N'],['O','X','X','R'],['S','T','U','V']], _ [['W','X','Y','Z'],['a','X','X','d'],['e','X','X','h'],['i','j','k','l']], _ [['m','n','o','p'],['q','r','s','t'],['u','v','w','x'],['y','z','=','?']]] Local $aCore = ArrayCore3D($aCube) ; see what remains ConsoleWrite("The Cube Core" & @LF & @LF) For $i = 0 To UBound($aCore) -1 For $j = 0 To UBound($aCore, 2) -1 For $k = 0 To UBound($aCore, 3) -1 ConsoleWrite($aCore[$i][$j][$k]) ; should all be X Next ConsoleWrite(@LF) Next ConsoleWrite(@LF) Next Func ArrayCore3D($aArray) ; remove the outer elements to reveal the core If Not (IsArray($aArray) And UBound($aArray, 0) = 3 And UBound($aArray) > 2 And UBound($aArray, 2) > 2 And UBound($aArray, 3) > 2) Then Return SetError(1) _DeleteRegion($aArray, 1) ; delete top ... [example] bounds [4][4][4] ==> [3][4][4] _DeleteRegion($aArray, 1, UBound($aArray) -1) ; delete bottom ... [3][4][4] ==> [2][4][4] _DeleteRegion($aArray, 2) ; delete left side ... [2][4][4] ==> [2][3][4] _DeleteRegion($aArray, 2, UBound($aArray, 2) -1) ; delete right side ... [2][3][4] ==> [2][2][4] _DeleteRegion($aArray, 3) ; delete front ... [2][2][4] ==> [2][2][3] _DeleteRegion($aArray, 3, UBound($aArray, 3) -1) ; delete back ... [2][2][3] ==> [2][2][2] Return $aArray EndFunc ;==> ArrayCore3D @iamtheky Above are the bare bones of your Rubix core extraction. With a little modification (extracting each region immediately before deletion) the regions could be reattached to produce the original cube. In this case, a bespoke function should probably manipulate the core directly instead, but the idea is useful for demonstration purposes.1 point
-
Looking for Script to play random Music files with random breakes
Ancrion reacted to JLogan3o13 for a topic
@Ancrion welcome to AutoIt. The purpose of this forum is to assist people in improving their own scripts; it is not a place where you put in a request and someone generates code for you. I would suggest taking a look through the help file as a way to begin, you can look at SoundPlay if the music is a wav file or mp3. Something like this (pseudo-code) should get you started. SoundPlay(<path to music file>) ;Play MP3 Sleep(10000) ;Wait 10 seconds SoundPlay("") ;Call SoundPlay again to stop play Once you get this going the way you would like, you can look at the second part of your requirement, playing a random music file. For that you can look at _FileListToArray in the help file, and grab all files from a directory: #include <Array.au3> #include <File.au3> Local $aMusic = _FileListToArray(<path to music files>, "*.MP3", $FLTA_Files, True) _ArrayDisplay($aMusic) Then you can look at different ways to parse through the array and choose your songs, based on your needs (look at Random in the help file as a place to start). Bleh, too slow1 point -
Try something like this here: #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> Global $sFolder = FileSelectFolder ("Select a folder with audio files", "") If @error Then Exit MsgBox($MB_ICONERROR, "Error", "No folder was selected - exiting script!", 15) Global $aFiles = _FileListToArrayRec($sFolder, "*.mp3", $FLTAR_FILES, $FLTAR_RECUR) If @error Then Exit MsgBox($MB_ICONERROR, "Error", "No MP3 files were found!", 15) If $aFiles[0] > 2 Then _ArrayShuffle($aFiles, 1) OnAutoItExitRegister("_Exit") HotKeySet("{ESC}", "_Exit") Local $iPos = 1 Do SoundPlay($sFolder & "\" & $aFiles[$iPos], 1) $iPos += 1 If $iPos > $aFiles[0] Then _ArrayShuffle($aFiles, 1) $iPos = 1 EndIf Until Not Sleep(Random(40 * 60 * 1000, 300 * 60 * 1000, 1)) Func _Exit() SoundPlay("") Exit EndFunc1 point
-
[VMware] Virtual Machine Windows to create a Server or Test Software/Servers.
Jos reacted to JLogan3o13 for a topic
@Trong per my PM you have been here long enough (and common sense should have prevailed regardless) to know better than to post links to illegal pirated software. Thread locked and you've earned a vacation from posting. I would suggest engaging your brain before posting upon your return.1 point -
I believe I misunderstood trancexx earlier. Surely there is nothing wrong with modifying a global flag directly (without additional parameters). I just hadn't considered the idea that globals can also be modified using ByRef. It still seems a strange and unnecessary thing to do.1 point
-
@markyrocks In the SciTE editor settings, you can add an additional include dir. I've written quite a few functions and basically try to save them in a separate file / include dir. It just gets time consuming trying to go through them and find the one I need. I could almost rewrite the function by the time I find the one I want to use. Sometimes I will go through some of my existing scripts I've written and search for custom functions in them that aren't in my function file. I wish there was a way to add them into the help file in the favorites section or something. That would be awesome!1 point
-
Why use Local and Global at all?
philkryder reacted to trancexx for a topic
As argument, not as parameter. Your example would look much better like this: Global $g_bToggle = False For $i = 1 To 2 Toggle($g_bToggle) Next Func Toggle(ByRef $bToggle) If $bToggle Then ; something Else ; something else EndIf $bToggle = Not $bToggle EndFunc1 point -
Search for: DPI Awareness You can start from my signature1 point
-
Cool Calculator v1.0
guiltyking reacted to MikePa for a topic
In your function _Decimal () you have a space before and after the decimal point.1 point -
basic simple calculator :)
guiltyking reacted to smashly for a topic
Thank You for sharing, keep up the good effort. As ACS said (even though the way it was said sounded a bit harsh to me) you could make the code briefer by using loops or multiple Case values per case. #include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $SSB = StringSplit("1|2|3|4|5|6|7|8|9|-|0|+|/|*|.|C|%|=", "|"), $bX = 8, $bY = 40 $Form1 = GUICreate("Lc", 108, 233, 193, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "Close", $Form1) GUISetBkColor(0xFFFF00) $som = GUICtrlCreateInput("", 8, 8, 89, 21) For $i = 1 To $SSB[0] GUICtrlCreateButton($SSB[$i], $bX, $bY, 27, 25, $BS_CENTER) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetFont(-1, 10, 700, 0, "MS Sans Serif") If Not Mod($i, 3) Then $bX = 8 $bY += 32 Else $bX += 32 EndIf Next $SSB = 0 GUISetState(@SW_SHOW) While 1 Sleep(100) WEnd Func Event() Switch GUICtrlRead(@GUI_CtrlId) Case "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "-", "*", "/", "." GUICtrlSetData($som, GUICtrlRead($som) & GUICtrlRead(@GUI_CtrlId)) Case "=" If Execute(GUICtrlRead($som)) Then GUICtrlSetData($som, Execute(GUICtrlRead($som))) Case "C" GUICtrlSetData($som, "") Case "%" ;??? Percent, leave this one for you :P EndSwitch EndFunc Func Close() Exit EndFunc Cheers1 point