Jump to content

AutoIT FileInstall() Funciton Error


 Share

Recommended Posts

Hi all,

i have just read all your infos and one point wasn't mentioned.

@JetlagJad: You said, it worked once but not again. Therefore i would like to ask you if the destination file already exists? If so then the documentation says:

flag [optional] this flag determines whether to overwrite files if they already exist:

0 = (default) do not overwrite existing files

1 = overwrite existing files

Your code sample says:

FileInstall("C:\AutoIT Projects\UltimateWoW\grey.gif", @WindowsDir & "\UltimateWoW\grey.gif")

so there this flag isn't included? Maybe you'll try

FileInstall("C:\AutoIT Projects\UltimateWoW\grey.gif", @WindowsDir & "\UltimateWoW\grey.gif",1)

D.

Link to comment
Share on other sites

Reading the entire topic, I would suggest that you check if "grey" is actually a .gif file.

I'm not retarded, of course it's a gif.

If $PrevStarted = '' Then
    DirCreate(@WindowsDir & '\UltimateWoW\')
    
    If FileExists(@WindowsDir & '\UltimateWoW\GUI.png') Then
        FileDelete(@WindowsDir & '\UltimateWoW\GUI.png')
    EndIf
        
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')
    
    If FileExists(@WindowsDir & '\UltimateWoW\grey.gif') Then
        FileDelete(@WindowsDir & '\UltimateWoW\grey.gif')
    EndIf
        
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')
EndIf

This is the code I use.

I found something really strange though...

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')

This works.

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')

And this doesn't.

But...

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')

If I make this a comment, and leave the other FileInstall (the grey.gif one) alone it compiles correctly...

Sadly I need both FileIncludes in the program... maybe there are too many FileInstalls in my script perhaps?

Edited by JetlagJad
Link to comment
Share on other sites

  • Moderators

I'm not retarded, of course it's a gif.

If $PrevStarted = '' Then
    DirCreate(@WindowsDir & '\UltimateWoW\')
    
    If FileExists(@WindowsDir & '\UltimateWoW\GUI.png') Then
        FileDelete(@WindowsDir & '\UltimateWoW\GUI.png')
    EndIf
        
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')
    
    If FileExists(@WindowsDir & '\UltimateWoW\grey.gif') Then
        FileDelete(@WindowsDir & '\UltimateWoW\grey.gif')
    EndIf
        
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')
EndIf

This is the code I use.

I found something really strange though...

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')

This works.

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')

And this doesn't.

But...

FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')

If I make this a comment, and leave the other FileInstall (the grey.gif one) alone it compiles correctly...

Sadly I need both FileIncludes in the program... maybe there are too many FileInstalls in my script perhaps?

If $PrevStarted = '' Then
    ; It doesn't need a slash
    DirCreate(@WindowsDir & '\UltimateWoW')
    
    ; Great you're doing the check, but you don't confirm it did anything
    If FileExists(@WindowsDir & '\UltimateWoW\GUI.png') Then
        FileDelete(@WindowsDir & '\UltimateWoW\GUI.png')
    EndIf

    ; Obvious you added this in after the fact with all the back spacing I had to do
    ; Anyway you're not using the suggested method here preseneted way above ( to overwrite if it does already exist )
    ; You check if a file exists.. .however you don't error check if the fileinstall failed... hmmm
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')
    
    If FileExists(@WindowsDir & '\UltimateWoW\grey.gif') Then
        FileDelete(@WindowsDir & '\UltimateWoW\grey.gif')
    EndIf

    ; Now wtf is this??  Which is failing this or the above????  One has "png" the other has "gif"
    ; It can't be that simple can it?
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')
EndIf

Anyway, you've failed to create a recreation script that fails when it shouldn't or works when it should. Now for telling a MVP you're not stupid... tell me how this looks?

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

If $PrevStarted = '' Then
    ; It doesn't need a slash
    DirCreate(@WindowsDir & '\UltimateWoW')
    
    ; Great you're doing the check, but you don't confirm it did anything
    If FileExists(@WindowsDir & '\UltimateWoW\GUI.png') Then
        FileDelete(@WindowsDir & '\UltimateWoW\GUI.png')
    EndIf

    ; Obvious you added this in after the fact with all the back spacing I had to do
    ; Anyway you're not using the suggested method here preseneted way above ( to overwrite if it does already exist )
    ; You check if a file exists.. .however you don't error check if the fileinstall failed... hmmm
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\GUI.png', @WindowsDir & '\UltimateWoW\GUI.png')
    
    If FileExists(@WindowsDir & '\UltimateWoW\grey.gif') Then
        FileDelete(@WindowsDir & '\UltimateWoW\grey.gif')
    EndIf

    ; Now wtf is this??  Which is failing this or the above????  One has "png" the other has "gif"
    ; It can't be that simple can it?
    FileInstall('C:\AutoIT Projects\UltimateWoW\Images\grey.gif', @WindowsDir & '\UltimateWoW\grey.gif')
EndIf

Anyway, you've failed to create a recreation script that fails when it shouldn't or works when it should. Now for telling a MVP you're not stupid... tell me how this looks?

I know, one of them is gif and one is png but I can guarantee you there is nothing wrong with the file path or formats. I've tried switching around the formats of it and still no luck.

My theory is that I have too many FileInstalls (there are more than the two I have included).

Link to comment
Share on other sites

If you have that many then the whole issue might come down to the time allowed for the proceedures to complete. When you run it as a script then FileInstall() really does a file copy with no way of telling it to over-write any existing. If the file exists then you have to give it time to delete before you attempt to put another copy in.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If you have that many then the whole issue might come down to the time allowed for the proceedures to complete. When you run it as a script then FileInstall() really does a file copy with no way of telling it to over-write any existing. If the file exists then you have to give it time to delete before you attempt to put another copy in.

One thing is sure, that's not it.

This looks like the case of "I can`t see the forest for the trees" (no offense JetlagJad).

What's unbelievable is that you still didn't figure out what's the problem. A true enigma.

Btw, almost brilliant observation Manadar.

Link to comment
Share on other sites

One thing is sure, that's not it.

This looks like the case of "I can`t see the forest for the trees" (no offense JetlagJad).

What's unbelievable is that you still didn't figure out what's the problem. A true enigma.

Btw, almost brilliant observation Manadar.

True, but I haven't ever seen this problem before, and no one can help me fix it.

Link to comment
Share on other sites

This may be a long shot but worth checking.

Do you have a function somewhere in your script or include files called FileInstall()?

The only way I have been able to re-create your original error message is to add a function called FileInstall() to my script and ignore the waring given by AU3Check.exe

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...