Sign in to follow this  
Followers 0
wesb

"unable to open file error"

6 posts in this topic

first of all, love autoit...i have recently run into a problem with running scripts on some machines. I get the error "Unable to open file". i have rewritten the script on one occasion in ver 2.64 and it ran fine. I didnot do that with this one i just wrote. It ran fine on one WinXP machine SP1 patched but did not run on another same image as the first. Any ideas?? I even ran other 3.0 scripts on the failed machine and they ran fine. thanks,

$exists = fileexists("c:\windows\options\Office2003\Logs\oabsize.txt")

if $exists <>1 then

$oabsize = FileOpen("c:\windows\options\Office2003\Logs\oabsize.txt", 1)

;  Check if file opened for reading OK

If $oabsize = -1 Then

    MsgBox(0, "Error", "Unable to open file.")

    Exit

EndIf

filewriteline($oabsize, "")

filewriteline($oabsize, "This is a list of actual PST sizes taken before and after a supposed daily OAB download in Office 2003.")

filewriteline($oabsize, "Across the top is the file names and the resulting numbers below each file name are the date, time and file sizes.")

filewriteline($oabsize, @ComputerName)

filewriteline($oabsize, "Date & Time" & @TAB & @TAB & @TAB & "Browse.OAB" & @TAB & "ANRDEX.OAB" & @TAB & "PDNDEX.OAB" & @TAB & "DETAILS.OAB" & @TAB & "RDNDEX.OAB")

filewriteline($oabsize, "")

fileclose($oabsize)

endif

$oabsize = FileOpen("c:\windows\options\Office2003\Logs\oabsize.txt", 1)

;  Check if file opened for reading OK

If $oabsize = -1 Then

    MsgBox(0, "Error", "Unable to open file.")

    Exit

EndIf

$folder=(@userprofiledir & "\outlook\")

;msgbox(0,"this is in", "this is in the " & $folder & " dir")

;exit

$Browse=FileGetSize($folder & "browse.oab")

$ANRDEX=FileGetSize($folder & "anrdex.oab")

$PDNDEX=FileGetSize($folder & "pdndex.oab")

$Details=FileGetSize($folder & "details.oab")

$RDNDEX=FileGetSize($folder & "rdndex.oab")

fileWriteLine($oabsize, @mon & "/" & @mday & " " & @hour & ":" & @min & ":" & @SEC & @TAB & @TAB & $browse & @TAB & @TAB & $anrdex & @TAB & $pdndex & @TAB & @TAB & $details & @TAB & $rdndex)

fileclose($oabsize)

Share this post


Link to post
Share on other sites



first of all, love autoit...i have recently run into a problem with running scripts on some machines.  I get the error "Unable to open file". i have rewritten the script on one occasion in ver 2.64 and it ran fine. I didnot do that with this one i just wrote.  It ran fine on one WinXP machine SP1 patched but did not run on another same image as the first.  Any ideas??  I even ran other 3.0 scripts on the failed machine and they ran fine.  thanks,

Are you sure the Path exists ? (c:\windows\options\Office2003\Logs\)

Which of the fileOpen statements fail ?


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

If I undestand well if the file does not exist you try to open it.

It should never work.

$exists = fileexists("c:\windows\options\Office2003\Logs\oabsize.txt")
if $exists <>1 then

if the file does not exist "$exists" will be set to 0 and the then clause will be executed

Which version of AutoIt3 are you running? :D

Share this post


Link to post
Share on other sites

Awesome...can you say "DUHHHH!" boy do i feel stupid. :D thanks a lot for seeing what i had right infront of me...gotta create the folders first. One of those dayz :huh2:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0