Jump to content
Sign in to follow this  

{HELP] with my script

Recommended Posts


Hello everyone, I made a small bat file that replaces an image in shell32 by image chosen by the user then replaces shell32 by shell32 amended, for this to change the image of the panel config and system Windows 7.

But the script not work I have many problem:

1/i am obliged to put the full path, the problem is that if the user is in another path it will not work, I tried @ ScriptDir but it not work.

2/i unable to run my bat file.

3/i unable to run commands with buttons

4 / I get an error when I run the script (button 3)

Global $REPERTOIRE = "@scriptdir\" 

Global $Button1 = GUICtrlCreateButton("&Choisir image", 422, 3, 83, 25, $BS_NOTIFY)
Global $Button2 = GUICtrlCreateButton("&Changer bouton", 421, 36, 83, 25, $BS_NOTIFY)
Global $Button3 = GUICtrlCreateButton("&Quitter", 421, 68, 83, 25, $BS_NOTIFY)
Global $Label1 = GUICtrlCreateLabel("Cliquer sur le bouton et choisir une image parmis celles proposées", 8, 8, 399, 20, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
Global $Label2 = GUICtrlCreateLabel("Cliquer sur le bouton pour changer le panneau puis redémarrer", 16, 40, 375, 20, 0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
Global $Pic1 = GUICtrlCreatePic("@scriptdir\Capture.JPG", 8, 64, 409, 33)
#EndRegion ### END Koda GUI section ###

While 1

Case $button3 
MsgBox(16,"Aurevoir", "Venez sur notre site ",1)

Case $button2 

Case $button1 
FileOpenDialog("Choisir une image",@MyDocumentsDir,"Images (*.jpg;*.bmp)|Tous (*.*)",1)
If @error Then
MsgBox(0,"Erreur 1 :","Le choix de l'image n'a pas été pris en compte")
Return 1
$ecrase = 1 
$retour = FileCopy($cheminImage,$REPERTOIRE,$ecrase) 
If $retour = 0 Then
MsgBox(0,"Erreur 2 :","La copie/déplacement du fichier a échoué(e)")
Return 2
$nomImage = StringTrimLeft($cheminImage,StringInStr($cheminImage,"\",0,-1)) 
$nomDestination = "MonImage."&StringTrimLeft($nomImage,StringInStr($nomImage,".",0,-1)) 
$retour = FileMove($REPERTOIRE&$nomImage, $REPERTOIRE&$nomDestination, 1)
If $retour = 0 Then
MsgBox(0,"Erreur 3 :","Le renommage du fichier a échoué")
Return 3
If @error Then
MsgBox(0,"Erreur 4 :","Le batch a plante")
Return 4

Return 0 ; Pas d'erreur
EndFunc EndFunc

Please help me I am a beginner and I can not.Thanks.

(sorry for my english,i am french)

Edited by tytynono

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