Sign in to follow this  
Followers 0
Kidney

Trying to find a string in a string

22 posts in this topic

So im trying to find todays date inside of stings that are in an array that I pulled from some table on a website for my work. here is the code I am using to try and find the date inside the strings that are stored in an array. Below is the output I get in the console.

$Date = String(@MON & "/" & @MDAY & "/" & @YEAR)
    ConsoleWrite($Date & @CRLF)
    ;ConsoleWrite(UBound($aTableData) & @CRLF & UBound($aTableData, 2) & @CRLF)
    For $i = 1 to UBound($aTableData) - 1
        ;ConsoleWrite(@CRLF & @CRLF & $aTableData[$i][1] & @CRLF & @CRLF)
        $sData = String($aTableData[$i][1])
        ConsoleWrite($sData & @CRLF & @CRLF)
        $result = StringInStr($sData, $Date)
        If $result > 0 Then ConsoleWrite("~~~~~~~~~~~~~~~~~~~~~~~" & $i & @CRLF)
    Next

12/03/2013
Please Wait... Round: 1301
 Visit: Sunday - 11/3/2013
 Start Time:  Shift:  4:00PM- 8:00PM
Please Wait... Round: 1348
 Visit: Saturday - 11/23/2013
 Start Time:  Shift:  5:00PM- 9:00PM
Please Wait... Round: 1348
 Visit: Monday - 11/25/2013
 Start Time:  Shift:  11:45AM- 8:00PM
Please Wait... Round: 1348
 Visit: Tuesday - 11/26/2013
 Start Time:  Shift:  11:45AM- 8:00PM
Please Wait... Round: 1348
 Visit: Wednesday - 11/27/2013
 Start Time:  Shift:  2:00PM- 10:00PM
Please Wait... Round: 1349
 Visit: Saturday - 11/30/2013
 Start Time:  Shift:  4:00PM- 9:00PM
Please Wait... Round: 1349
 Visit: Monday - 12/2/2013
 Start Time:  Shift:  11:45AM- 8:15PM
Please Wait... Round: 1349
 Visit: Tuesday - 12/3/2013
 Start Time:  Shift:  11:45AM- 8:15PM
Please Wait... Round: 1349
 Visit: Friday - 12/6/2013
 Start Time:  Shift:  4:00PM- 9:00PM
Please Wait... Round: 1350
 Visit: Saturday - 12/7/2013
 Start Time:  Shift:  4:00PM- 9:00PM
Please Wait... Round: 1350
 Visit: Monday - 12/9/2013
 Start Time:  Shift:  11:45AM- 8:15PM
Please Wait... Round: 2013
 Visit: Sunday - 4/7/2013
 Start Time:  Shift: -
Please Wait... Round: 13481
 Visit: Friday - 11/29/2013
 Start Time:  Shift:  3:00PM- 9:00PM

Share this post


Link to post
Share on other sites



You're looking for 12/03/2013, but the file has 12/3/2013, one of these is not like the other.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

$Date = String(@MON & "/" & @MDAY & "/" & @YEAR) is already a string, so just use $Date = @MON & "/" & @MDAY & "/" & @YEAR. There is also no need for the other string function.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

The second window shows what's in the file itself, going by what the script is supposed to output to the console.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Kidney,

one way to do it...

local $aTableData[100] = [ _
    'Please Wait... Round: 1301', _
    ' Visit: Sunday - 11/3/2013', _
    ' Start Time:  Shift:  4:00PM- 8:00PM', _
    'Please Wait... Round: 1348', _
    ' Visit: Saturday - 11/23/2013', _
    ' Start Time:  Shift:  5:00PM- 9:00PM', _
    'Please Wait... Round: 1348', _
    ' Visit: Monday - 11/25/2013', _
    ' Start Time:  Shift:  11:45AM- 8:00PM', _
    'Please Wait... Round: 1348', _
    ' Visit: Tuesday - 11/26/2013', _
    ' Start Time:  Shift:  11:45AM- 8:00PM', _
    'Please Wait... Round: 1348', _
    ' Visit: Wednesday - 11/27/2013', _
    ' Start Time:  Shift:  2:00PM- 10:00PM', _
    'Please Wait... Round: 1349', _
    ' Visit: Saturday - 11/30/2013', _
    ' Start Time:  Shift:  4:00PM- 9:00PM', _
    'Please Wait... Round: 1349', _
    ' Visit: Monday - 12/2/2013', _
    ' Start Time:  Shift:  11:45AM- 8:15PM', _
    'Please Wait... Round: 1349', _
    ' Visit: Tuesday - 12/3/2013', _
    ' Start Time:  Shift:  11:45AM- 8:15PM', _
    'Please Wait... Round: 1349', _
    ' Visit: Friday - 12/6/2013', _
    ' Start Time:  Shift:  4:00PM- 9:00PM', _
    'Please Wait... Round: 1350', _
    ' Visit: Saturday - 12/7/2013', _
    ' Start Time:  Shift:  4:00PM- 9:00PM', _
    'Please Wait... Round: 1350', _
    ' Visit: Monday - 12/9/2013', _
    ' Start Time:  Shift:  11:45AM- 8:15PM', _
    'Please Wait... Round: 2013', _
    ' Visit: Sunday - 4/7/2013', _
    ' Start Time:  Shift: -', _
    'Please Wait... Round: 13481', _
    ' Visit: Friday - 11/29/2013', _
    ' Start Time:  Shift:  3:00PM- 9:00PM']


local $Date = @MON & "/" & @MDAY & "/" & @YEAR, $tdate, $atdate
ConsoleWrite($Date & @CRLF)
For $i = 1 to UBound($aTableData) - 1
    $tdate = stringregexp($aTableData[$i],'\d{1,2}/\d{1,2}/\d{4}',3)
    if not @error then
        $atdate = stringsplit($tdate[0],'/')
        $tdate[0] = stringformat('%02s/%02s/%04s',$atdate[1],$atdate[2],$atdate[3])
        if $tdate[0] = $date then ConsoleWrite('!   hit for date = ' & $tdate[0] & @LF)
    endif
next

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

You're looking for 12/03/2013, but the file has 12/3/2013, one of these is not like the other.

:mad2:

silly mistake..... added a switch statement to change it from a double digit output to a single digit for 1-9.

 

final result:

Local $MDAY
    Switch @MDAY
        Case 01
            $MDAY = "1"
        Case 02
            $MDAY = "2"
        Case 03
            $MDAY = "3"
        Case 04
            $MDAY = "4"
        Case 05
            $MDAY = "5"
        Case 06
            $MDAY = "6"
        Case 07
            $MDAY = "7"
        Case 08
            $MDAY = "8"
        Case 09
            $MDAY = "9"
    EndSwitch

    $Date = @MON & "/" & $MDAY & "/" & @YEAR

    ConsoleWrite($Date & @CRLF)
    For $i = 1 to UBound($aTableData) - 1
        $result = StringInStr($aTableData[$i][1], $Date)
        If $result > 0 Then ConsoleWrite($aTableData[$i][1] & $i & @CRLF)
    Next

And then here is the output:

12/3/2013
Please Wait... Round: 1349
 Visit: Tuesday - 12/3/2013
 Start Time:  Shift:  11:45AM- 8:15PM8
Edited by Kidney

Share this post


Link to post
Share on other sites

Why not just use StringReplace() or StringTrimLeft()?


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

That answers the day part, now you can do the month part, or, see post #7

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

no need for the switch:

$sDayWithNoLead0 = StringRegExpReplace(@MDAY,"(0)(\d+)","\2")
ConsoleWrite($sDayWithNoLead0 & @CRLF)
$sDayWithNoLead0 = StringRegExpReplace("01","(0)(\d+)","\2")
ConsoleWrite($sDayWithNoLead0 & @CRLF)
$sDayWithNoLead0 = StringRegExpReplace("09","(0)(\d+)","\2")
ConsoleWrite($sDayWithNoLead0 & @CRLF)
$sDayWithNoLead0 = StringRegExpReplace("10","(0)(\d+)","\2")
ConsoleWrite($sDayWithNoLead0 & @CRLF)

example outputs for the second (just to demonstrate)

1

9

10

haha, even easier:

ConsoleWrite(Number(@MDAY) & @CRLF)
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

Why not just use StringReplace() or StringTrimLeft()?

because the array I am using has 5 columns but only 2 that I actually care about. the one with the date and then the one with the link to the call report for that day.

However, the call report id has not barring on the date and the link to click has the same text as all the other call reports. so im trying to find the row with the correct day and then just click the link in the appropriate column and row.

Share this post


Link to post
Share on other sites

No kidney, I meant what is wrong with this...

Local $MDAY = StringReplace(@MDAY, '0', '')
ConsoleWrite($MDAY & @CRLF)

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Local $MDAY = StringReplace(@MDAY, '0', '')
ConsoleWrite($MDAY & @CRLF)

Nope, the above will replace 10 with 1.

Use my example:

ConsoleWrite(Number(@MDAY) & @CRLF)
Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

 

Nope, that will replace 10 with 1.

Use my example:

ConsoleWrite(Number(@MDAY) & @CRLF)

I am only going by what kidney provided as an example.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

gotcha, I was suggesting a global fix for any day...to remove leading 0's

For $i = 1 To 31
    If StringLen($i) = 1 Then
        $number = "0" & $i
    Else
        $number = $i
    EndIf
    ConsoleWrite("Before=[" & $number & "]; After=[" & Number($number) & "]" & @CRLF)
Next

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

I post-pended an even easier fix, on #11...which would then be:

$Date = Number(@MON) & "/" & Number(@MDAY) & "/" & @YEAR
ConsoleWrite($date & @LF)





(edit: as you can tell, I'm averse to quotes)

(edit2: Int() would result in the same...not sure which would be the best...probably Int)

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

I think I like the SRE solution better as it does not rely on converison rules which could change...splitting hairs, perhaps...


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0