Sign in to follow this  
Followers 0
mini

HELP Use Autoit to delete temp files with hotkeys

3 posts in this topic

Hello guys, i bumped here with something that im trying to make.

Hope you guys can understand wht i whant to make.

I need to put some HotKeys like "F8 to quit gui", and if this Key is pressed, i need the gui to ask if you really want to "Quit" and if you type "Yes" it deletes the temp files and quit the gui.

this is where im stuck, i dont have no hotkeys, because i get always error.

in this point the gui do all at once. I need to make it to idle till i press "F8" and give me the "inputbox" to type "yes"

FileWrite("iBot.txt", InputBox ( "Write iBot.exe Path", " Example:"& @CRLF &""& @CRLF &"''C:\iBot\iBot.exe'' AS:CharName AB:HI" ))

FileWrite("loader.txt", InputBox ( "Write Loader.exe Path", " Example:"& @CRLF &""& @CRLF &"''C:\iBot\Loader.exe''" ))

this is the parte that i want to put a hotkey

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "AutoIt Example (English Only)", "This script will open an input box and get you to type in some text.  Run?")


; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(4096, "Delete", "OK.  Bye!")
    Exit
EndIf

; Loop around until the user gives a valid "autoit" answer
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Delete temp iBot.bat and Loader.bat files", "Please type in the word ""Delete"" and click OK")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> "Delete" Then
            MsgBox(4096, "Error", "You typed in the wrong thing - try again!")
        Else
            $bLoop = 0    ; Exit the loop - ExitLoop would have been an alternative too :)
        EndIf
    EndIf
WEnd

; Print the success message

MsgBox(4096,"AutoIt Example", "Files delete ^^! Congrats.")

FileDelete(@ScriptDir & "\iBot.txt")

FileDelete(@ScriptDir & "\loader.txt")

; Finished!

Share this post


Link to post
Share on other sites



Hello guys, i bumped here with something that im trying to make.

Hope you guys can understand wht i whant to make.

I need to put some HotKeys like "F8 to quit gui", and if this Key is pressed, i need the gui to ask if you really want to "Quit" and if you type "Yes" it deletes the temp files and quit the gui.

this is where im stuck, i dont have no hotkeys, because i get always error.

in this point the gui do all at once. I need to make it to idle till i press "F8" and give me the "inputbox" to type "yes"

I guess this is what you are looking for.... ;)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         IDK(sandeep_laik@mindtree.com)

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

HotKeySet("{F8}", "Fastrack")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

;;;; Body of program would go here ;;;;
TrayTip("Info","F8 to close any Notepad window,ESC to terminate.",30,1)

While 1
    Sleep(100)
WEnd
;;;;;;;;

Func Fastrack()
    
;----------- do whatever you want to do here :)


EndFunc

Func Terminate()
    TrayTip("Terminating","IDK[sandeep_laik@mindtree.com]",30,0)
    sleep(3000)
    Exit 0
EndFunc

Func ShowMessage()
    TrayTip("Info","F8 to close any Notepad window,ESC to terminate.",30,1)
EndFunc

Good Luck

addins.au3

Share this post


Link to post
Share on other sites

I guess this is what you are looking for.... ;)

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.0.0
 Author:         IDK(sandeep_laik@mindtree.com)

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

HotKeySet("{F8}", "Fastrack")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

;;;; Body of program would go here ;;;;
TrayTip("Info","F8 to close any Notepad window,ESC to terminate.",30,1)

While 1
    Sleep(100)
WEnd
;;;;;;;;

Func Fastrack()
    
;----------- do whatever you want to do here :)


EndFunc

Func Terminate()
    TrayTip("Terminating","IDK[sandeep_laik@mindtree.com]",30,0)
    sleep(3000)
    Exit 0
EndFunc

Func ShowMessage()
    TrayTip("Info","F8 to close any Notepad window,ESC to terminate.",30,1)
EndFunc

Good Luck

Hello bro, thx for the fast replay.

Cant the F8 and the ESC do the same, like, if i terminate the program it deletes the temp files??

my work with your help is like this ATM

; Script Start - Add your code below here

HotKeySet("{F8}", "Fastrack",)
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

;;;; Body of program would go here ;;;;
FileWrite("iBot.txt", InputBox ( "Write iBot.exe Path", "     Example:"& @CRLF &""& @CRLF &"''C:\iBot\iBot.exe'' AS:CharName AB:HI" ))
FileWrite("loader.txt", InputBox ( "Write Loader.exe Path", "     Example:"& @CRLF &""& @CRLF &"''C:\iBot\Loader.exe''" ))

TrayTip("Info","F8 delete temp files ,ESC to terminate.",30,1)

While 1
    Sleep(100)
WEnd

;Here it will delete the .bat temp files
Func Fastrack()
 FileDelete(@ScriptDir & "\iBot.txt")
 FileDelete(@ScriptDir & "\loader.txt")

EndFunc

Func Terminate()
    TrayTip("Terminating","See you next boting time ^^",30,0)
    sleep(3000)
    Exit 0
EndFunc

Func ShowMessage()
    TrayTip("Info","F8 delete temp files ,ESC to terminate.",30,1)
EndFunc

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  
Followers 0