Thanks fischgeek and Bobo,
I decided to take your advice, and came up with my own version to tackle the problem:
Code: Select all
StringSplit, SplitDate, data10, -
If (StrLen(SplitDate1) = 1)
{
SplitDate1 = 0%SplitDate1%
}
If (StrLen(SplitDate2) = 1)
{
SplitDate2 = 0%SplitDate2%
}
data10 = %Splitdate3%%SplitDate2%%SplitDate1% ; change the date fields to resemble YYYYMMDD-format
However, for some strange reason I cannot get it working if I put this code inside of a function,
like so:
Code: Select all
MyFunction(MyVar, StringToSplit, LeadingNumber, Delimiter)
{
global ; not sure if needed, doesn't work without either though.
MsGBox, Why Doesn't this fire ????
StringSplit, %MyVar%, %StringToSplit%, %Delimiter%
If (StrLen(MyVar1) = 1)
{
MyVar1 = 0%MyVar1%
}
If (StrLen(MyVar2) = 1)
{
MyVar1 = 0%MyVar2%
}
}
When I call it like so:
Code: Select all
MyFunction(Splitdate, data10, 0, -)
And then look at the lines most recently exectuted, on line 190 I see the function being called,
however the MsGBox inside the function doesn't fire. I cannot figure out why.
It looks like everything inside of the function gets skipped.
Code: Select all
190: MyFunction(Splitdate, data10, 0, -)
191: data10 = %Splitdate3%%SplitDate2%%SplitDate1%
193: GuiControl,,DatumInDienst,data10
194: GuiControl,Choose,DatumUitDienst,%data11%
195: GuiControl,,Huisarts,%data12%
196: GuiControl,,Huisartsnummer,%data13%
197: GuiControl,,Contact,%data14%
198: GuiControl,,Contactnummer,%data15%
199: GuiControl,,BGG,%data16%