Jump to content
Sign in to follow this  
mozart90

FileOpen reacts strange...

Recommended Posts

Hi

I use the following code in my script. But there is the possibility that a file is already open e.g. in Word

The strange thing is that FileOpen always returns ok even when the file ist opend in Word .....

Is the the possibility to open a file exclusivly ???

greetings mozart90

$file = FileOpen("c:\test.doc", 1)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileClose($file)

Share this post


Link to post
Share on other sites

Hi

I use the following code in my script. But there is the possibility that a file is already open e.g. in Word

The strange thing is that FileOpen always returns ok even when the file ist opend in Word .....

Is the the possibility to open a file exclusivly ???

greetings mozart90

$file = FileOpen("c:\test.doc", 1)

If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileClose($file)

I noticed the same behavior. It seems that Word is not locking the file. In fact, I opened a file in Word and deleted it without Word complaining. However, if you open a file using autoit and then try to open the file in Word, you will get a message that it is in use. So, I think this isn't a problem with autoit.

Share this post


Link to post
Share on other sites

Did any of the solutions offered to you in your other thread on this topic work for you?

http://www.autoitscript.com/forum/index.ph...showtopic=22440

Hi,

sorry but none of the ideas are working because it is a computer with limited rights and to pipe the net file you need admin rights...

so I thought it's possible to get the desired information by trying this way (with fileopen)

greetings mozart90

Share this post


Link to post
Share on other sites

Hi,

sorry but none of the ideas are working because it is a computer with limited rights and to pipe the net file you need admin rights...

so I thought it's possible to get the desired information by trying this way (with fileopen)

greetings mozart90

Compile the script in the other thread and then call that script via another script that uses RunAsSet. [2000/XP or later]

[size="1"][font="Arial"].[u].[/u][/font][/size]

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  

×
×
  • Create New...