none
stuck with GetFiles RRS feed

  • Question


  • Hello,

    I have a small problem with GetFiles and Arrays.

    Thanks!

    Greetings, Chris



    Dummy = File.GetFiles ("C:\SOFT\Bilder_schoen", arrA1 )

    intMax = Array.GetItemCount (arrA1)


    TextWindow.WriteLine (intMax)

    Zufall = Math.GetRandomNumber (intMax)

    ' TextWindow.WriteLine (arrA1(Zufall))

    Desktop.SetWallPaper(Array.GetValue (arrA1,Zufall))

     

     

    Monday, April 6, 2009 1:15 PM

Answers

  • Try replacing arrA1 by "arrA1"
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Proposed as answer by FremyCompany [MSFT] Monday, April 6, 2009 1:35 PM
    • Marked as answer by Chrisir Monday, April 6, 2009 4:02 PM
    Monday, April 6, 2009 1:35 PM

All replies

  • Try replacing arrA1 by "arrA1"
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    • Proposed as answer by FremyCompany [MSFT] Monday, April 6, 2009 1:35 PM
    • Marked as answer by Chrisir Monday, April 6, 2009 4:02 PM
    Monday, April 6, 2009 1:35 PM

  • Great!
    You did it!

    Complete Code:



    ' Gets a random Picture from a folder and sets it
    ' as Wallpaper.
    ' "arrA1" is an Array.


    Result = File.GetFiles ("C:\SOFT\Bilder", "arrA1" )


    If Result  = "SUCCESS" Then
      TextWindow.WriteLine ("OK.")
    ElseIf Result  = "FAILED" then 
      TextWindow.WriteLine ("NOT OK.")
    Else
      TextWindow.WriteLine ("NO result.")
    EndIf

    intMax = Array.GetItemCount ("arrA1")

    TextWindow.WriteLine (intMax)

    Zufall = Math.GetRandomNumber (intMax)

    TextWindow.WriteLine (Zufall)
    TextWindow.WriteLine (Array.GetValue ("arrA1",Zufall))
    Desktop.SetWallPaper(Array.GetValue ("arrA1",Zufall))

     

    Monday, April 6, 2009 4:03 PM