Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 9 of 9
  1. #1
    Join Date
    Mar 2006
    Posts
    61

    File Search Path Progress

    Hi there, I just picked up the trial version of Autoplay 6. So far I like what I see although I have some issues.

    First what I am trying to do is a File.Find function call with propper flags. I've searched though and found allot of examples but none seem to address the issue I have come across. Here is an example:

    [inside a button click event]
    Code:
    fFile = "blah.exe";
    
    sFile = File.Find(_SourceDrive, fFile, true, true, nil, nil);
    if (sFile) then
    	for i, value in sFile do
    		Paragraph.SetText("Paragraph1", String.AbbreviateFilePath(value, 45));
    		-- do some more work
    	end
    end
    The above code works and displays the search progress in the paragraph object fine. You can see it going though the array and displaying each directory it looked in.
    However, as soon as I write a function to handle the same thing and call the function from a button click event for instance, the progress does not display in the paragraph it just shows the fist directory in the array.

    [inside button click event]
    Code:
    FindFile(_SourceDrive, "blah.exe");
    
    [global function]
    function FindFile(sPath, fFile)
    	sFile = File.Find(_SourceDrive, fFile, true, true, nil, nil);
    	if (sFile) then
    		for i, value in sFile do
    			Paragraph.SetText("Paragraph1", String.AbbreviateFilePath(value, 45));
    			-- do some more work
    		end
    	end
    end
    Any ideas why doing the same thing from a function call doesn't allow for the paragraph object to be updated?

  2. #2
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Reverse your thinking (call after the creation of said function)

    Code:
    -- global function
    function FindFile(sPath, fFile)
    	sFile = File.Find(_SourceDrive, fFile, true, true, nil, nil);
    	if (sFile) then
    		for i, value in sFile do
    			Paragraph.SetText("Paragraph1", String.AbbreviateFilePath(value, 45));
    			-- do some more work
    		end
    	end
    end
    
    
    FindFile(_SourceDrive, "blah.exe");
    Intrigued

  3. #3
    Join Date
    Apr 2004
    Location
    Vancouver, Canada
    Posts
    1,790
    That's what I was thinking Intrigued but then I noticed he had "-- global function" above the function which I took to mean the function was in the the Global Functions. It would not make sense to put a function in the Onclick of a button.
    Dermot

    I am so out of here

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    But it will still work, if you code it the way I stated. I agree with you though. Global Functions area is where you should put the function code at and then 'call' it where you need it.

    Intrigued

  5. #5
    Join Date
    Mar 2006
    Posts
    61
    Yes the function is in the global functions area and I call it from the click event of a button.

    It does not show the progression through the array in the for loop, it just shows the first array value. Though if I copy paste the code from the function to the button click event space it works fine.

  6. #6
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    the action set.text removes any previous displayed text,
    try adding functionality like strPara = Paragraph.get text
    strParadisp = strpara.."\n"..then append the next 'data' to display in table cycle
    paragraph.settext("paraObjectname", strParadisp);

    --sorry dont have AMS6 open at the moment..

    you would repeat the above for each cycle

    hth a little

  7. #7
    Join Date
    Mar 2006
    Posts
    61
    Hey Eagle,

    I rebooted my computer and now it works fine!?

    Don't know what that was about, thanks for the help anyway guys!

  8. #8
    Join Date
    Mar 2005
    Location
    WA 'wait a while' - Australia
    Posts
    872
    If that is all that was needed...whoopie
    (bit a puzzle - strange one)

  9. #9
    Join Date
    Mar 2006
    Posts
    61
    Yes it is very strange, although I've come accross this very same situation in Visual Studio 6 as well. Code was functioning well one night and the next it didn't do what it did before, reboot the machine and it was back to normal.

    I don't know what causes it but it is an annoyance for sure because it causes allot of lost time debugging when there wasn't any need too. I blame it in XP.

Similar Threads

  1. search for a file with relative path locks up installer.
    By jassing in forum Setup Factory 6.0
    Replies: 1
    Last Post: 04-16-2003, 07:14 AM
  2. HOWTO: Create a Project Template
    By Support in forum AutoPlay Media Studio 4.0 Examples
    Replies: 0
    Last Post: 10-28-2002, 01:49 PM
  3. Can search allow manual browse even if file is found?
    By RichardShaw in forum Setup Factory 5.0
    Replies: 2
    Last Post: 08-28-2000, 06:08 PM
  4. Replies: 0
    Last Post: 08-17-2000, 02:29 PM

Posting Permissions

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