Jump to content
Sign in to follow this  
eJan

Delete multiple files used as _TempFile

Recommended Posts

I missed something in $var or?

#include <File.au3>

#include <GUIConstants.au3>

Dim $s_TempFile

$grp = _TempFile()

$btn = _TempFile()

$cls = _TempFile()

FileInstall("group.bmp", $grp)

FileInstall("button.bmp", $btn)

FileInstall("close.bmp", $cls)

GUICreate("Program", 226, 89)

GUICtrlCreatePic($grp, 2, 4, 221, 82)

GUICtrlCreatePic($btn, 83, 63, 60, 18)

GUICtrlCreatePic($cls, 13, 63, 60, 18)

GUISetState(@SW_SHOW)

While 1

    $msg = GUIGetMsg()

    Select

        Case $msg = $GUI_EVENT_CLOSE

; --------------------------- files

            FileDelete($grp)

            FileDelete($btn)

            FileDelete($cls)

; -------------------------- to delete

            Exit      

    EndSelect

WEnd

How to set files "$grp, $btn, $cls" to delete them in a single line (not to write line for each file). Edited by eJan

Share this post


Link to post
Share on other sites

How to set files "$grp, $btn, $cls" to delete them in a single line (not to write line for each file).

What you have is the best way. :)

; An alternative but risky

FileDelete("*.bmp")

; Trick from Larry if you want to combine certain commands on one line

$foo = FileDelete($grp) + FileDelete($btn) + FileDelete($cls)

; Using DOS Commands--might require extra quotes if filenames contain spaces

Run(@ComSpec & " /c del " & $grp & " " & $btn & " " & $cls, "", @SW_HIDE)

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

Thanks CyberSlug this one works fine

; Trick from Larry if you want to combine certain commands on one line

$foo = FileDelete($grp) + FileDelete($btn) + FileDelete($cls)

; An alternative but risky

FileDelete("*.bmp")

(doesn't work because unique filenames was created [abcdefg.tmp])

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...