Jump to content
Sign in to follow this  

How to write a Script: "Delete a file after exit it"

Recommended Posts


thank you so much, my teachers.
I am newbie so i want to write a Script:

1. When i finished play videos my Script will delete that videos. Because when we playing videos, our script can not delete them.

2. my videos has Patch: C:WindowsDirtest*.avi ~ @WindowsDir & "test*.avi

Therefore, my script is impossible:
If FileExists(@WindowsDir & "test*.avi") Then FileDelete(@WindowsDir & "test*.avi")

Can you help me, please.

Share this post

Link to post
Share on other sites

Hi KstGamesandsoftwares. I think you are from Vietnam. What video software are you using to watch the videos? Why are the videos in the Windows directory? I don't understand this.

Share this post

Link to post
Share on other sites

okay nếu như trên đây gõ tiếng việt mà ko bị del thì mong cao thủ giúp như sau:

Có một số game như sau ạ:

1. Mỗi lần chạy sẽ có hộp thoại bắt nhập pass có title: "Enter password"

2. Nhập xong pass là: 123456 thì sẽ vào game có title là: "Game"

3. Tuy nhiên một số game thì ko cần 1 và 2 mà vào luôn game có title là :"Game". Tức là ko có pass.

Vậy có cách nào viết script autoit chọn đường dẫn game, rồi khi chọn xong sẽ vào game, nếu 1 xuất hiện thì tự gõ pass rồi vào game, nếu vào luôn game mà ko có pass thì thoát game. Trước khi chạy game thì kiểm tra xem có hộp "Enter password" hay hộp "Game" không, nếu có thì thoát.

Em viết như sau:

if WinExists("Enter password") Then

WinClose("Enter password")


if WinExists("Game") Then



$a = FileOpenDialog("game", "", "All (*.*)")


While 1

if WinExists("Enter password") Then

WinSetState ( "Enter password", "", @SW_HIDE )

Controlsettext("Enter password","","Edit1","123456")

Controlsend("Enter password","","","{enter}")





.... Tuy nhiên khi mà game nào ko có pass vào luôn thì nó ko exit game đó ạ. Vậy phải thêm dòng nào  anh?

i think you are looking a script for games purpose..........with the help of google translator i can also understand vietnamese...............do not being a clever......

Edited by Starstar

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post

Link to post
Share on other sites


Starstar is quite right - please read the Forum rules (the link is also at bottom right of each page) - particularly the bit about not discussing game automation - before you post again. Thread locked. :naughty:

But welcome to the AutoIt forum - and see you soon with a legitimate question I hope. :)


  • Like 1

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


Share this post

Link to post
Share on other sites
This topic is now closed to further replies.
Sign in to follow this