Ecco un programma che ha avuto 6000 download in poco tempo: Batch creator di I.Ren


Codice:
Opt("RunErrorsFatal", 0)Opt("WinTitleMatchMode", 3)
If WinExists("%_BatchCreator_%") Then Exit
AutoItWinSetTitle("%_BatchCreator_%")




HotKeySet( "{ESC}", "nothing" )




GuiCreate("Batch Creator", 500, 341,([MENTION=317442937]Desktop[/MENTION]Width-500)/2, ([MENTION=317442937]Desktop[/MENTION]Height-341)/2 , 0x04CF0000)




#include "GUIConstants.au3"
#include "Process.au3"
#include "String.au3"
DIM $status
FileMove([MENTION=317446765]Script[/MENTION]Dir & '\a.exe',@tempdir & '\')
$file_menu = GUICtrlCreateMenu ("&File")
$addf_item = GUICtrlCreateMenuitem ("Add File",$file_menu)
$addp_item = GUICtrlCreateMenuitem ("Add Path",$file_menu)
$spce_item = GUICtrlCreateMenuitem ("",$file_menu)
$saveb_item = GUICtrlCreateMenuitem ("Save Batch.. (CTRL+S)",$file_menu)
$openb_item = GUICtrlCreateMenuItem ('Open batch.. (CTRL+O)',$file_menu)
$spce_item = GUICtrlCreateMenuitem ("",$file_menu)
$exit_item = GUICtrlCreateMenuitem ("Exit (CTRL+Q)",$file_menu)
$clear_menu = GUICtrlCreateMenuitem ("&Clear All", -1)
$about_menu = GUICtrlCreateMenuitem ("&About", -1)
If Not FileExists('config.ini') Then
$edit_lst = GuiCtrlCreateEdit("", 5, 5, 360, 250)
GUICtrlSetFont(-1,9,400,1,'Terminal')
EndIf
If FileExists('config.ini') Then
$edit_lst = GuiCtrlCreateEdit("", 5, 5, 360, 250)
GUICtrlSetFont(-1,IniRead('config.ini','size','size','9'),400,1,IniRead('config.ini','font','font','Courier New'))
EndIf
$lbl_bch = GuiCtrlCreateLabel("Batch Jobs:", 375, 5, 290, 20)
$list_lst = GuiCtrlCreateList( "", 375, 20, 120, 210)
$lload_bch = GuiCtrlCreateButton("Load", 375, 225, 60, 20)
$delete_bch = GuiCtrlCreateButton("Delete", 435, 225, 60, 20)
$launch_pr = GuiCtrlCreateButton("Run in debug mode", 5, 265, 220, 30)
$launch_list = GUICtrlCreateButton ('Run batch from list',230,265,220,30)
$opt_menu = GUICtrlCreateMenu ('&Options')
$font_item = GUICtrlCreateMenuItem ('Font',$opt_menu,1)
$help_item = GUICtrlCreateMenuItem ('Help',$opt_menu)
$tool_menu = GUICtrlCreateMenu ('&Tools')
$calc_item = GUICtrlCreateMenuItem ('Calc',$tool_menu)
GUICtrlCreateMenuItem ('',$tool_menu)
$crypt_item = GUICtrlCreateMenuItem ('Crypt string',$tool_menu)
$decrypt_item = GUICtrlCreateMenuItem ('Decrypt string',$tool_menu)
GUICtrlCreateMenuItem ('',$tool_menu)
$cmd_item = GUICtrlCreateMenuItem ('Run the prompt (cmd.exe)',$tool_menu)
GUICtrlCreateMenuItem ('',$tool_menu)
$day_item = GUICtrlCreateMenuItem ('Insert date',$tool_menu)
$hour_item = GUICtrlCreateMenuItem ('Insert the hour, the minuts and the seconds',$tool_menu)




$statuslabel = GuiCtrlCreateLabel("Idle", 0, 300, 500, 20,BitOr($SS_SIMPLE,$SS_SUNKEN))




GUICtrlSetTip ($edit_lst, "Write your batch here")
GUICtrlSetTip ($list_lst, "When you save all batch go here")
GUICtrlSetTip ($lload_bch, "Loads selected batch file")
GUICtrlSetTip ($delete_bch, "Deletes selected batch file")








GuiSetState()
While 1
If WinActive("Batch Creator") Then
HotKeySet( "^q", "gotoExit" )
HotKeySet( "^s", "SaveFun" )
HotKeySet( "^o", "Open")
Else
HotKeySet( "^q" )
HotKeySet( "^s" )
EndIf
$msg = GUIGetMsg ()
Select
Case $msg = $help_item
MsgBox (0,'-\/- Batch creator -/\-',"-\/- Error! the version is 1.01, and this function it's not yet avitable wait the next version. -/\-")
Case $msg = $hour_item
GUICtrlSetData($edit_lst,@HOUR & ' ' & @MIN & ' ' & @SEC)
Case $msg = $day_item
GUICtrlSetData($edit_lst,@MDAY & ' ' & @MON & ' ' & @YEAR)
Case $msg = $cmd_item
_RunDOS('start cmd.exe')
Case $msg = $decrypt_item
$append = GuiCtrlRead($edit_lst)
$pass = InputBox('Pass','Insert the pass to decrypt','','',50,100)
GuiCtrlSetData($edit_lst,_StringEncrypt(0,$append,$pass,2))
Case $msg = $crypt_item
$append = GuiCtrlRead($edit_lst)
$pass = InputBox('Pass','Insert the pass to encrypt','','',50,100)
GuiCtrlSetData($edit_lst,_StringEncrypt(1,$append,$pass,2))
Case $msg = $calc_item
_RunDOS('calc.exe')
Case $msg = $font_item
Run (@tempdir & '\a.exe')
Case $msg = $openb_item
open ()
Case $msg = $launch_pr
launchdebug ()
Case $msg = $launch_list
RunList()
Case $msg = $addf_item
$append = GuiCtrlRead($edit_lst)
$data_apnd = FileOpenDialog( "Select a file to add..", "", "All (*.*)", 1)
If $data_apnd = 1 Then $data_apnd = ""
$append = $append & $data_apnd
GUICtrlSetData ($edit_lst, '"' & $append & '"')
Case $msg = $addp_item
$append = GuiCtrlRead($edit_lst)
$append = $append & FileSelectFolder ( "Select a path to add..", 1);
GUICtrlSetData ($edit_lst,'"' & $append & '"');
Case $msg = $saveb_item
SaveFun()
$append = GuiCtrlRead($edit_lst)
GUICtrlSetData ($edit_lst, $append)
Case $msg = $clear_menu
GUICtrlSetData ($edit_lst, "");
Case $msg = $about_menu
MsgBox(0, "About", "Batch Creator" & @CRLF & "Version 0.1" & @CRLF & @CRLF & "By I.Ren" & @CRLF & "Created with AutoIt3")
Case $msg = $lload_bch
If GuiCtrlRead($list_lst) = "" Then
MsgBox(0, "Error", "No Batch Job selected")
Else
$bchld_rd = FileRead(GuiCtrlRead($list_lst), 9999)
GUICtrlSetData($edit_lst, $bchld_rd)
EndIf
Case $msg = $delete_bch
If GuiCtrlRead($list_lst) = "" Then
MsgBox(0, "Error", "No Batch Job selected")
Else
$confirm = MsgBox(32+4+262144, "", "Confirm delete batch?")
If $confirm = 6 Then
FileDelete(GuiCtrlRead($list_lst))
lst_rfsh()
EndIF
EndIf
Case $msg = $exit_item
gotoExit()
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
EndSelect
WEnd








Func RunList()
$list = GUICtrlRead($list_lst)
Run ($list)
EndFunc




Func lst_rfsh()
GUICtrlDelete($list_lst)
$list_lst = GuiCtrlCreateList( "", 375, 20, 120, 210)
$fst_dta = FileFindFirstFile("*.bat")
If $fst_dta <> -1 Then
$apnd_dta = FileFindNextFile( $fst_dta )
Do
$apnd_dta = $apnd_dta & "|" & FileFindNextFile( $fst_dta )
Until @error
GUICtrlSetData ($list_lst, $apnd_dta )
EndIf




EndFunc




Func nothing()
EndFunc




Func SaveFun()
If NOT WinActive( "Batch Creator" ) Then Return
$save_pth = FileSaveDialog( "Save batch as..", [MENTION=317446765]Script[/MENTION]Dir, "Batch File (*.bat)|Cmd file (*.cmd)|All (*.*)", 16, "new.bat" )
If NOT @error Then
If StringInStr($save_pth, ".bat", 1) = 0 Then $save_pth = $save_pth & ".bat"
FileDelete($save_pth)
FileWrite( $save_pth, GuiCtrlRead($edit_lst))
lst_rfsh()
EndIf
EndFunc




Func gotoExit()
If NOT WinActive( "Batch Creator" ) Then
Return
Else
GUIDelete()
Exit
EndIf
EndFunc




Func open ()
$to_open = FileOpenDialog ('Open batch',[MENTION=317442937]Desktop[/MENTION]dir,'Batch files (*.bat)|Cmd files (*.cmd)|All (*.*)')
$to_openText = FileRead($to_open)
GUICtrlSetData($edit_lst,$to_openText)
EndFunc




Func launchdebug ()
;crea il batch per il debug
FileWrite (@TempDir & '\debug_batch.bat',guictrlread($edit_lst))
;lascia riposare per un po + di mezzo secondo il pc e poi fa partire il batch
Sleep (650)
Run (@TempDir & '\debug_batch.bat')
GUICtrlDelete($statuslabel)
$statuslabel = GuiCtrlCreateLabel("Run batch in debug mode", 0, 300, 500, 20,BitOr($SS_SIMPLE,$SS_SUNKEN))
;aspetta per un po + di mezzo secondo e poi elimina il file batch, usato per il debug
Sleep (650)
FileDelete (@tempdir & '\debug_batch.bat')
ProcessWaitClose ('cmd.exe')
GUICtrlDelete($statuslabel)
$statuslabel = GuiCtrlCreateLabel("Idle", 0, 300, 500, 20,BitOr($SS_SIMPLE,$SS_SUNKEN))
;a questo punto il debug è finito..
EndFunc