cant read from cdrom
Moderators: Dorian (MJT support), JRL
-
- Pro Scripter
- Posts: 58
- Joined: Thu Oct 16, 2003 12:53 am
cant read from cdrom
Guys Im really stumped with this one - this is going to sound pretty amatuerish to say the least - look at this code:
ReadFile>D:\CDCount\CD1\results.txt,file
Thats it - only one line, I have cleared all blank spaces and when I run it I get an unknown error dialog box. This file in on a cd rom (which is D drive). If I put this file on the hard drive (C drive) theres no problem. Im running MSched 7.4 on w2k am I missing something...
ReadFile>D:\CDCount\CD1\results.txt,file
Thats it - only one line, I have cleared all blank spaces and when I run it I get an unknown error dialog box. This file in on a cd rom (which is D drive). If I put this file on the hard drive (C drive) theres no problem. Im running MSched 7.4 on w2k am I missing something...
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
What do you mean with
Does the actual file have spaces, but you have removed them in the ReadFile command? If yes, that was wrong, you need exact spelling, including in the path and file names.I have cleared all blank spaces
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
-
- Pro Scripter
- Posts: 58
- Joined: Thu Oct 16, 2003 12:53 am
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
-
- Pro Scripter
- Posts: 58
- Joined: Thu Oct 16, 2003 12:53 am
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Also... what does the error log say?
Start > Run > eventvwr.msc
Searching the microsoft knowledgebase for the phrase: "has generated errors and will be closed by windows" found nothing specific to your exact error or problem. But there does seem to be a pattern. This particular error seems to be prevalent in Win 2000 prior to SP4. There are also articles which mention this type of error when explorer.exe (in Win 2000) tries to access a read-only file. Aren't most CD files marked Read-Only?
Perhaps you could upgrade to Win 2000 SP4.
Or, a workaround might be to add the line:
CopyFile>D:\CDCount\CD1\results.txt,%TEMP_DIR%results.txt
Then, assuming the copyfile> doesn't throw a similar error, change the readfile line to:
ReadFile>%TEMP_DIR%results.txt,file
Start > Run > eventvwr.msc
Searching the microsoft knowledgebase for the phrase: "has generated errors and will be closed by windows" found nothing specific to your exact error or problem. But there does seem to be a pattern. This particular error seems to be prevalent in Win 2000 prior to SP4. There are also articles which mention this type of error when explorer.exe (in Win 2000) tries to access a read-only file. Aren't most CD files marked Read-Only?
Perhaps you could upgrade to Win 2000 SP4.
Or, a workaround might be to add the line:
CopyFile>D:\CDCount\CD1\results.txt,%TEMP_DIR%results.txt
Then, assuming the copyfile> doesn't throw a similar error, change the readfile line to:
ReadFile>%TEMP_DIR%results.txt,file
-
- Pro Scripter
- Posts: 58
- Joined: Thu Oct 16, 2003 12:53 am
Hi JRL:
I ran the exe file to get an updated log - I then checked the application / Security and system logs - there was no updated log created.
I am running W2k SP4 - also if I change the command from ReadFile to ReadLn then all the lines on the text file on the CD are read its only if I attempt to use ReadFile command that the error occurs. I used a message box to confirm this
I ran the exe file to get an updated log - I then checked the application / Security and system logs - there was no updated log created.
I am running W2k SP4 - also if I change the command from ReadFile to ReadLn then all the lines on the text file on the CD are read its only if I attempt to use ReadFile command that the error occurs. I used a message box to confirm this
So you have found a way to make this work by using ReadLn>. Or is there some reason ReadLn> can't be used?
In any case, the error is a Windows system error not a Macro Scheduler error, so you need to make your script work around it. I would guess from what I read on the Microsoft web site that Windows 2000 doesn't like ReadFile> on a read only file. So the ReadFile> function is the "Unknown" portion of the error message.
In any case, the error is a Windows system error not a Macro Scheduler error, so you need to make your script work around it. I would guess from what I read on the Microsoft web site that Windows 2000 doesn't like ReadFile> on a read only file. So the ReadFile> function is the "Unknown" portion of the error message.
-
- Pro Scripter
- Posts: 58
- Joined: Thu Oct 16, 2003 12:53 am
Using ReadLn
Sorry about the long break in responses guys:
JRl youre right I can use ReadFile but here is what I was trying to do:
Lets say you grab a file using ReadFile - and the variable is labed file ie:
ReadFile>D:\temp\test.txt,file (keep in mind D: is the CDROM drive)
Can the variable "file" then be used to read lines from the file that is now stored in memory" ie:
ReadLn>%file%,k,line
doing this would make accessing and reading the file much faster because the file is preloaded in memory - that is wby I was attempting to read the file on the CDROM. Am I making sense...??
JRl youre right I can use ReadFile but here is what I was trying to do:
Lets say you grab a file using ReadFile - and the variable is labed file ie:
ReadFile>D:\temp\test.txt,file (keep in mind D: is the CDROM drive)
Can the variable "file" then be used to read lines from the file that is now stored in memory" ie:
ReadLn>%file%,k,line
doing this would make accessing and reading the file much faster because the file is preloaded in memory - that is wby I was attempting to read the file on the CDROM. Am I making sense...??
I assume you mean that you could use ReadLn but you'd rather use ReadFile.JRl youre right I can use ReadFile but here is what I was trying to do: Lets say you grab a file using ReadFile...
I thought the issue here was that you are getting a Microsoft error when you try to use ReadFile from the CD-ROM? If that is the case then I think you have two paths you could follow.
1) Use ReadLn instead of ReadFile. It might be a little slower if the file is large, on the other hand if the file is quite large, ReadFile will possibly throw an "Out of Memory" error.
2) Copy the file from your CD drive (D:) to you hard drive (C:) and then use Readfile to read the C drive copy.
Not exactly. Once you have the file assigned to a variable by using ReadFile, (in the case of your example the variable is "file") you can divvy up the individual lines and assign each one of them to a variable by using the Separate> function. The individual lines of a Windows text file are divided up by the characters ASCII 13 (Carriage Return) and ASCII 10 (Line Feed). In Macro Scheduler this unique combination has a predefined variable that can be called in your script by entering %CRLF%.Can the variable "file" then be used to read lines from the file that is now stored in memory" ie:
ReadLn>%file%,k,line
Therefore, the line:
Separate>%file%,%CRLF%,var
Will assign each line of the file to the variables var_X where "X" is the line number. In other words line one will be assigned to variable var_1, line two will be assigned to variable var_2, and so on...
After assigning the lines to variables the lines can be accessed by calling them from a loop. Something like:
Let>k=0
Repeat>k
Add>k,1
Let>line=var_%k%
//The variable "line" now contains the contents of line "k" similar to the ReadLn example you posted.
//Do something with "line"
Until>k=var_count
Hope this helps,
Dick