megatron Posted February 21, 2007 Share Posted February 21, 2007 Hello guys, very simple problem I have: I want to get a string consisting of the date like this: DD.MM.YYYY I know the macros can give me a date inthe format DD/MM/YYYY but i need it delimited with . not / I have also tried to make a string from the seporate @MON @YEAR etc macros, I think my understanding of syntax here is letting me down. Any pointers would be much appreciated. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 What ever is giving you this format: DD/MM/YYYY you could simply use StringReplace() $sDateFunc = _MyDateFunctionGivingMeMyDateInformation();(You didn't state what you were using) $sDateFunc = StringReplace($sDateFunc, '/', '.') MsgBox(64, 'Presto', $sDateFunc) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
megatron Posted February 21, 2007 Author Share Posted February 21, 2007 Smoke. thanks for your help. While you were typing I managed to solve the problem myself: #Include <date.au3> #include <Array.au3> $avArray = _ArrayCreate(@MDAY, @MON, @YEAR) Dim $Date = _ArrayToString( $avArray,".") Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 Smoke. thanks for your help. While you were typing I managed to solve the problem myself: #Include <date.au3> #include <Array.au3> $avArray = _ArrayCreate(@MDAY, @MON, @YEAR) Dim $Date = _ArrayToString( $avArray,".")That's the really long way.... if you only have one date. $sDate = @MDay & '.' & @MON & '.' & @YEAR MsgBox(64, 'Info', $sDate) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
megatron Posted February 21, 2007 Author Share Posted February 21, 2007 That's the really long way.... if you only have one date. $sDate = @MDay & '.' & @MON & '.' & @YEAR MsgBox(64, 'Info', $sDate) I love you! thx Link to comment Share on other sites More sharing options...
megatron Posted February 21, 2007 Author Share Posted February 21, 2007 One more question, if I may: CODE$sDate = @MDAY & '.' & @MON & '.' & @YEAR ; Shows the filenames of all files in the current directory $search = FileFindFirstFile(*$sDate) The part that is not working correctly is the FileFindFirstFile(*$sDate), no matter what I try I can't seem to get it to search for the date string with a wildcard prefixing it. Link to comment Share on other sites More sharing options...
megatron Posted February 22, 2007 Author Share Posted February 22, 2007 /bump Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 22, 2007 Moderators Share Posted February 22, 2007 Did you try using the path to the directory as well? There are functions also that could help you... _FileListToArray(), I've wrote a _FileListToArrayEx() option in the Examples forum, these return a list of all files in the Path+directory you choose, and you can loop through them to see if the files match with something like StringInStr(). You also may want to look at _PathSplit() so you can compare just the actual file name itself. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
megatron Posted February 22, 2007 Author Share Posted February 22, 2007 Did you try using the path to the directory as well?There are functions also that could help you... _FileListToArray(), I've wrote a _FileListToArrayEx() option in the Examples forum, these return a list of all files in the Path+directory you choose, and you can loop through them to see if the files match with something like StringInStr().You also may want to look at _PathSplit() so you can compare just the actual file name itself.Following on from your advice it worked just great. Thanks so much dude! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now