Jump to content

BlackLumiere

Members
  • Posts

    5
  • Joined

  • Last visited

Everything posted by BlackLumiere

  1. Hi all. It's been almost 11 years since this post. Even so, I would like to give a workaround function. This function is UDF and is inspired in the seq() function in R language. As it returns an 1D array, it also can be indexed easily. I hope can be useful to you all. Cheers! #include-once #include <Array.au3> Func seq($from, $to, $by = 1) Local $vector[0] Local $strVector for $e = $from to $to Step $by $strVector = $strVector & $e & ' ' Next $strVector = StringTrimRight($strVector, 1) _ArrayAdd($vector, $strVector, 0, ' ') ;~ _ArrayDisplay($vector) <== [Debug] ConsoleWrite('[1] ' & $strVector & @CRLF) Return $vector EndFunc ;Test $test1 = seq(1, 10) $test2 = seq(1, 10, 3) $indexTest3 = seq(1, 10, 1) ConsoleWrite('[1] ' & $indexTest3[0] & @CRLF) ConsoleWrite('[1] ' & $indexTest3[1] & @CRLF)
  2. I had the same issue. In my case I wrote in a function : Local $iRows = UBound($aWindows, $UBOUND_COLUMNS) ;and I had this error ==> warning: $UBOUND_COLUMNS: possibly used before declaration. Then I just declare the variaable as a Constant, dunno why but it worked, and the compiler did not show error anymore. Like these: Local Const $iRows = UBound($aWindows, $UBOUND_ROWS) Regards!
  3. I had the same issue. In my case I writed like: Local $iMax = UBound($aWindows, $UBOUND_COLUMNS) and I had this error ==> warning: $UBOUND_COLUMNS: possibly used before declaration. Then I just declare it like a Constant, dunno why but it worked and tthe compiler did nnot show the error anymore. Like these: Local Const $iRows = UBound($aArray2D, $UBOUND_ROWS)
  4. Here is another example of how to use some String properties. In this case the Input value is a short date from excel and the output can be: For $Format equal to: 0: Same Format without slashes 1: International Format "dd/mm/yyyy" 2: American Format "mm/dd/yyyy" Note: If u are a begginer, to use the function u just need to write in any part of your code: ExcelDate( $YourVariableWithDate , 0 or 1 or 2) Example: Copy the code below #include <MsgBoxConstants.au3> #include <Date.au3> Func ExcelDate($Date,$Format) ;0: Same Format ;1: International Format ;2: American Format $DIV=($Date)/(10^6) $Year = StringLeft($DIV,4) $Month = StringMid($DIV,5,2) $Day = StringRight($DIV,2) Select case $Format = "" or $Format = 0 $Date = $Day & $Month & $Year case $Format = 1 $Date = $Day & "/" & $Month & "/" & $Year case $Format = 2 $Date = $Month & "/" & $Day & "/" & $Year case $Format = 3 $Date = $Year & $Month & $Day EndSelect Return $Date endfunc Local $RawDate = "20150407000000" Local $Example=ExcelDate($RawDate,3) MsgBox(0, "",$Example) Pos: Again, I know is late, but just posted as an alternative to handle this issues with excel dates. Regards!
  5. Here is an example of how to use some String properties. You can save the values in a variable, eliminate the slashes if you dont need them, etc. $Date="20150407000000" $DIV=($Date)/(10^6) ;Division: To make easier to extract $Day and in case you want to use that inverse date $Year = StringLeft($DIV,4) $Month = StringMid($DIV,5,2) $Day = StringRight($DIV,2) MsgBox(0, "",$Day & "/" & $Month & "/" & $Year) •You can re-order the format to match with American dates "mm/dd/yyyy", or non tradicional formats, which is your case "dd/mm/yyyy". Pos: I know is late, but just posted as an alternative to handle this issues with excel dates. Regards!
×
×
  • Create New...