I'm presuming it's not working at all, although you don't explicitly say
what's "wrong".
The first thing that I see is that you are scanning drives C through Z -
you might want to use an Xtra like CD Pro to just get a list of the CD drives.
Regardless, you have one immediate problem which is:
set thisPath = string(drive & ":\ASPL.pdf""&findCD)
The last part, the ""&findCD I couldn't even guess what it'll do. FindCD
is the name of your handler, of course, but it might also equate to a VOID
variable. The double quotes would presumably mean you have the string
unfinished, so I doubt it would compile, without actually trying it.
Then having built a path, you try to open it with FileIO, fair enough,
though that's probably only good for actually seeing if it exists (not for
displaying the PDF). You only free your instance of FileIO if you succeed,
which makes for a lot of unfreed instances on failure, but eventually
they'll go away when you exit the handler (but the recommended approach is
to free it always). You also don't close the file, which leaves it open
for reading, unless fileio automatically closes upon exit (I'm not sure).
Then you set "myCD" equal to drive&":\ASPL.PDF" but you don't do anything
with the myCD variable.
Finally you just return the drive letter.
What you might do is:
1) before the openFile is you should print out (put to the messgae window,
or use an alert if you're on a CD) what the path is, so you know what
you're building, and
2) This would be a great opportunity to learn the debugger, where you could
trace through and see exactly what it's doing at every step of the way.
- Tab
At 10:02 AM 12/18/01 -0500, Gess, Aaron wrote:
>Hi, I am try to open a PDF on a CD-ROM. Here is a code that I am using but,
>I don't know where I am going wrong. I must be missing something. Please
>help.
>
>
>
>on findCD
> repeat with x = 67 to 90
> set drive = numTochar(x)
> set thisPath = string(drive & ":\ASPL.pdf""&findCD)
> set myFile = new(xtra "fileio")
> openFile(myFile, thisPath, 1)
> if status(myfile) = 0 then
> set myFile = 0
> put drive&":\ASPL.pdf" into mycd
> return drive&":"
> exit
> end if
> end repeat
>
>end
[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi To post messages to the list,
email [EMAIL PROTECTED] (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo. Thanks!]