Vous pouvez récupérer vos ressource en exécutent votre EXE comme ceci
"FICHIER.EXE Mots_de_passe".
ils ne faut pas que le non de votre fichier.exe contienne des espace
PS : pour Récupérer les Source "Setup.exe 001027003"
► Afficher le texteScript
Code : Tout sélectionner
#include <File.au3>
#include <GuiConstantsEx.au3>
#include <EditConstants.au3>
If $CmdLine[0] = 1 Then
GUI1($CmdLine[1])
EndIf
Func GUI1($FILE)
Local $INPUT1, $INPUT2, $INPUT3, $INPUT4, $BUTTON1, $BUTTON2, $StringFILE, $BUTTON3, $BUTTON4
GUICreate("AutoIt Secour 1.0 Beta ", 300, 265, -1, -1)
GUICtrlCreateLabel("Fichier a Integrer dans le script : ", 10, 10, 280, 20)
$INPUT1 = GUICtrlCreateInput("", 10, 30, 240, 20)
$BUTTON1 = GUICtrlCreateButton("...", 260, 29, 30, 22)
GUICtrlCreateLabel("Mot de passe pour recuperer le fichier integrer : ", 10, 60, 280, 15)
GUICtrlCreateLabel("Exemple :('Script.exe Mot_de_passe') ", 10, 75, 280, 20)
$INPUT2 = GUICtrlCreateInput("", 10, 95, 280, 20, $ES_PASSWORD)
GUICtrlCreateLabel("Confirmer le mots de passe : ", 10, 120, 280, 20)
$INPUT3 = GUICtrlCreateInput("", 10, 140, 280, 20, $ES_PASSWORD)
GUICtrlCreateLabel("Icon de l'éxécutable : ", 10, 170, 280, 20)
$INPUT4 = GUICtrlCreateInput(@ProgramFilesDir&"\AutoIt3\Aut2Exe\Icons\AutoIt_Old4.ico", 10, 190, 180, 20)
$BUTTON3 = GUICtrlCreateButton("...", 200, 189, 30, 22)
$BUTTON4 = GUICtrlCreateButton("Default", 240, 189, 50, 22)
$BUTTON2 = GUICtrlCreateButton("Compiler", 10, 225, 280, 30)
GUISetState()
While 1
Switch GUIGetMsg()
case $GUI_EVENT_CLOSE
Exit
case $BUTTON1
$StringFILE = StringSplit($FILE, "\", 1)
$StringFILE = StringSplit($FILE, $StringFILE[$StringFILE[0]], 1)
GUICtrlSetData($INPUT1, FileOpenDialog("Selectionner un fichier", $StringFILE[1], "(*.*)"))
Case $BUTTON2
IF Control(GUICtrlRead($INPUT1), GUICtrlRead($INPUT2), GUICtrlRead($INPUT3), GUICtrlRead($INPUT4)) = 1 Then
If Compile($FILE, GUICtrlRead($INPUT2), GUICtrlRead($INPUT1), GUICtrlRead($INPUT4)) = 0 Then
MsgBox(0, "OK", "Compilation Terminner avec Sucse")
Exit
EndIf
Else
MsgBox(0, "Ereur", Control(GUICtrlRead($INPUT1), GUICtrlRead($INPUT2), GUICtrlRead($INPUT3), GUICtrlRead($INPUT4)))
EndIf
case $BUTTON3
$StringFILE = StringSplit($FILE, "\", 1)
$StringFILE = StringSplit($FILE, $StringFILE[$StringFILE[0]], 1)
GUICtrlSetData($INPUT4, FileOpenDialog("Selectionner un fichier", $StringFILE[1], "(*.ico)"))
case $BUTTON4
GUICtrlSetData($INPUT4, @ProgramFilesDir&"\AutoIt3\Aut2Exe\Icons\AutoIt_Old4.ico")
EndSwitch
WEnd
EndFunc
Func Control($READ1 = "", $READ2 = "", $READ3 = "", $READ4 = "")
Local $carct[44] = ["²", "~", '"', "#", "'", "{", "(", "[", "-", "|", "è", "`", "_", "\", "^", _
"@", ")", "°", "]", "=", "+", "}", "€", "^", "¨", "$", "£", "¤", "ù", "%", "*", "µ", ",", _
"?", ";", ".", ":", "/", "!", "§", "<", ">", "/", "*"]
If $READ1 = "" Then Return "Rempliser le chand de texte : Chemin"
If Not FileExists($READ1) Then Return "Le fichier suivant est introuvable"&@CRLF&$READ1
If $READ2 = "" Then Return "Choisiser un Mots de passe"
If $READ2 <> $READ3 Then Return "Le mot de passe de confirmation est diferent du premier"
For $VAR = 1 To 43
$SPLIT = StringSplit($READ2, $carct[$VAR], 1)
If $SPLIT[0] > 1 Then Return "Le mots de passe Doit contenir seulement des chifre et ou des letre sans espase"
Next
If $READ4 = "" Then Return "Rempliser le chand de texte : Icon"
Return 1
EndFunc
Func Compile($Script, $Code, $Resource, $Icon)
Local $string
If Stringleft(FileReadLine($Script, 1), 38) <> "If $CmdLine[0] <> 0 And $CmdLine[1] = " Then
$string = StringSplit($Resource, "\", 1)
$string = $string[$string[0]]
$TEXT = 'If $CmdLine[0] <> 0 And $CmdLine[1] = "'&$Code&'" Then'
$TEXT&=@CRLF
$TEXT&= 'FileInstall("'&$Resource&'", @ScriptDir&"\'&$string&'", 1)'
$TEXT&=@CRLF
$TEXT&= 'Exit'
$TEXT&=@CRLF
$TEXT&= 'EndIf'
$TEXT&=@CRLF
_FileWriteToLine($Script, 1, $TEXT)
Return RunWait(@ProgramFilesDir&'\AutoIt3\Aut2Exe\Aut2Exe.exe '&'/in "'&$Script&'" '&'/icon "'&$Icon&'"')
Else
For $VAR = 0 to 4
_FileWriteToLine($Script, 1, "", 1)
Next
Return Compile($Script, $Code, $Resource)
EndIf
EndFunc
---------------------------------------------------------------------------
Mise a jour le 03/02/2010 A 13H05
- Ajout de La selection d'un icon