Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Jan 2012
    Posts
    5

    invalid key to 'next' ???

    Hi there, I want to create a small script to add any file in videos folder at "Autoplay\\Videos\\" to a tree when show with my code:
    Code:
    Debug.ShowWindow(true);
    Debug.SetTraceMode(true);
    result = File.Find("Autoplay\\Videos\\", "*.*", false, false, nil, nil);
    Tree.InsertNode("Items",0,result);
    context = Debug.GetEventContext();
    Debug.Print(context);
    When I run preview, it shows a dialog box show that:
    Error: invalid key to 'next'

    Stack Traceback:

    1: [Page1 -> OnShow] Line 4: in main chunk

    Debug show that:
    ---------------------------
    Error
    ---------------------------
    Error: invalid key to 'next'

    Stack Traceback:

    1: [Page1 -> On Show] Line: 4 in main chunk
    ---------------------------
    OK
    ---------------------------
    I don't know where the error is and how to fix it! Can anyone help me to fix this?

  2. #2
    Join Date
    Jan 2012
    Posts
    5
    I want to edit but i don't see where can I edit my post.

    Debug show like below:
    *** LOCATION: Page1 -> On Show
    [3]: result = File.Find("Autoplay\\Videos\\", "*.*", false, false, nil, nil);
    TRACE: LastError = 0 ("Success.")
    [4]: Tree.InsertNode("Items",0,result);

  3. #3
    Join Date
    Apr 2005
    Location
    São Paulo, Brazil
    Posts
    2,539
    For starters, check the documentation... File.Find() returns a table, where each element contains the path of the file that was found.

    The third argument to Tree.InsertNode() is also a table, but using a completely different data structure - its an associative array with 8 fields. So no, you cannot simply use the same variable.

    Fix your code first, and if that does not solve the problem, attach the exported project file (*.apz) to your post.

    Ulrich

  4. #4
    Join Date
    May 2011
    Location
    IRAN
    Posts
    14
    try this code:
    Code:
    Debug.ShowWindow(true);
    Debug.SetTraceMode(true);
    result = File.Find(_SourceFolder.."\\Autoplay\\Videos\\", "*.*", false, false, nil, nil);
    if result ~= nil then
    	for i, found in pairs(result) do
    		sPath = String.SplitPath(found);
    		tblNodeData = {};
    		tblNodeData.Text = sPath.Filename;
    		tblNodeData.Data = found;
    		tblNodeData.Expanded = true;
    		tblNodeData.NodeIndex = i;
    		Tree.InsertNode("Items", i, tblNodeData);
    		context = Debug.GetEventContext();
    		Debug.Print(context);
    	end
    end

  5. #5
    Join Date
    Jan 2012
    Posts
    5
    thank you for your support.
    I have fixed my code and it runs ok.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts