Jump to content

Not working -- FileExists


Recommended Posts

This code works sometimes, but when I call makeTPL("C:\temp\script\file.png", "C:\mymenu\file.tpl", 608, 456) it doesn't work and says "TPL Fail!"...

The file is not copied to "C:\mymenu\file.tpl", the original "C:\mymenu\file.tpl" stays the way it was, and yet FileExists still returns 0 (doesn't exist). I am 100% sure that convert.exe works correctly, as it _does not_ say "Image Failed to resize!", and I know that gentpl.exe is creating the "C:\mymenu\file.tpl".

It does however work when I call: makeTPL(@DesktopDir & "\tux.png", "C:\mymenu\file.tpl", 608, 456) and it does everything correctly.

the function fatal() displays a message box then exits.

Any ideas? I can provide any more information you guys need :P.

func makeTPL ($origimage, $tplfile, $width, $height);ImageMagick/Irfan to resize, TPLGen to convert
    If (FileExists($tplfile)) Then
        FileDelete($tplfile)
    EndIf
    
    FileCopy($origimage, "C:\temp\tpl.png")
    
    RunWait('convert.exe "' & $origimage & '" -resize ' & $width & "x" & $height & '! C:\temp\tpl.png', @ScriptDir, $winstate)
    If (FileExists("C:\temp\tpl.png")) Then
        RunWait('gentpl.exe C:\temp\tpl.png C:\temp\out.tpl', @ScriptDir, $winstate)
    Else
        fatal("Image failed to resize!")
    EndIf
    
    FileCopy("C:\temp\out.tpl", $tplfile)
    FileDelete("C:\temp\tpl.png")
    FileDelete("C:\temp\out.tpl")
    
    if (FileExists($tplfile)<>1) Then
        fatal("TPL Fail")
    EndIf
EndFunc
Edited by icefire
Link to comment
Share on other sites

I am 100% sure that convert.exe works correctly, as it _does not_ say "Image Failed to resize!", and I know that gentpl.exe is creating the "C:\mymenu\file.tpl".

It does however work when I call: makeTPL(@DesktopDir & "\tux.png", "C:\mymenu\file.tpl", 608, 456) and it does everything correctly.

the function fatal() displays a message box then exits.

Any ideas? I can provide any more information you guys need :P.

I will rename Convert.exe to ConvertEx.exe. Convert.exe is a Windows command to change FAT volumes to NTFS.

CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]

volume Specifies the drive letter (followed by a colon),

mount point, or volume name.

/FS:NTFS Specifies that the volume is to be converted to NTFS.

/V Specifies that Convert should be run in verbose mode.

/CvtArea:filename

Specifies a contiguous file in the root directory to be

the place holder for NTFS system files.

/NoSecurity Specifies the converted files and directories security

settings to be accessible by everyone.

/X Forces the volume to dismount first if necessary.

All opened handles to the volume would then be invalid.

AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Link to comment
Share on other sites

I will rename Convert.exe to ConvertEx.exe. Convert.exe is a Windows command to change FAT volumes to NTFS.

Good point.

Or, he could path it out literally, so the Windows version won't be found in %PATH% before his graphic converter.

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...