Forum Liberty Basic France

Le 15/06/2011 à 10h10

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
voici un autre code, qui na rien a voir avec le jeu ^^
c'est pour celui ci que j'ai besoin des chemin run....


Code VB :
[start]
WindowWidth = 400
WindowHeight = 400
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
nomainwin
menu #ATOM, "&Editeur de texte   |", "&BlocNote", [r], "&WorkPad", [wordpad], "&Microsoft Word", [r], "&Oppen Office", [r]
menu #ATOM, "&Multi-médias   |","VLC Media player", [r],"Windows Media center", [r]
menu #ATOM, "&Jeux   |","&Jeux", [r]
menu #ATOM, "&Internet   |","&Google Chrome", [r],"&Internet Explorer", [r],"&Mozilla Firefox", [r]
menu #ATOM, "&Utilitaires","&Calculatrice", [r],"&Paint", [r],"&Cmd", [r]
button #ATOM, "  Quitter ?", [quitter], LR, 70, 90
button #ATOM, "    Aide   ", [r], LR, 70, 60
button #ATOM, "Mise à jour", [r], LR, 70, 30
statictext #ATOM.text, " Production 2011/2012", 0, 330, 150, 20
statictext #ATOM.text, " Version 1.0", 310, 330, 160, 20
open "ATOM 1.0 / 2011-2012" for window_nf as #ATOM
#ATOM, "trapclose [r]"
wait
[quitter]
close #ATOM
end
[r]
wait
[wordpad]
nomainwin
run "C:\ProgramFiles\Windows NT\Accessories\wordpad.exe"
wait
____________________
Yo !

MSN Web    
Le 15/06/2011 à 11h55

Administrateur

Groupe: Administrateur

Inscrit le: 25/09/2010
Messages: 362
Je pense que c'est le chemin qui ne va pas.
Quand on lance ton programme et qu'on clique sur Wordpad, LB s’arrête et nous dit que le fichier n'a pas été trouvé.
Vu que tu utilise Seven, je pense que le chemin est plutôt :
Citation:
C:\Program Files (x86)\Windows NT\Accessories\wordpad.exe

Par contre, si tu utilise un ordi en 32bit, le Program Files (x86) va changer. De toute façon, si tu veux lancer le programme, il te suffit de copier/coller le chemin que tu as fait pour y accéder. Sous Seven, un simple clic dans la barre d'adresse sur un endroit vide te donne le vrai chemin.

Cordialement
Jagang

PS : J'ai rajouter la balise [code] autour de ton code, ne l'oublie pas la prochaine fois :p

PS2 : Penses-tu distribuer ton programme ou juste l'utiliser pour toi ?
____________________
J'ai toujours raison ! Sauf quand j'ai tort ...

Web    
Le 15/06/2011 à 12h02

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
hey ca marche !!!
le but est de le distribuer gratuitement ! (lorsqu'il sera fini ^^)

j'explique mon programme :

faire un outil ou tout ce dont on a besoin est sous notre main, qui ne demande pas des quantités énormes de RAM pour ce lancé ou pour ce fermer et qui soit utilisable à tout moment. le but étant de faire un programme extrêmement léger (<20ko) et invisible au niveau de la charge de la RAM (<1mo RAM) de plus qui puisse tourné sur chaque système =) !



Edité par atomose Le 15/06/2011 à 12h02
____________________
Yo !

MSN Web    
Le 15/06/2011 à 12h07

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
WOW la vache !!!!
je viens de testé un chemin avec un jeu incompatible en w7 64bit (diablo II) avant il ne m'afiché pas les vidéos , je viens de le lancer avec mon programme et la magie tout marche nickel !!!!
____________________
Yo !

MSN Web    
Le 15/06/2011 à 12h08

Administrateur

Groupe: Administrateur

Inscrit le: 25/09/2010
Messages: 362
Ok, donc il y a un petit problème...
Ton programme ne fonctionnera que chez les gens qui on Windows 7 en 64bit.
Pour qu'il puisse fonctionner sur un plus large spectre, tu devrais demander au premier lancement du logiciel sur quel Windows est l'utilisateur. Ainsi, tu pourras adapter le chemin en fonction de l'OS.

Pour cela, une liste déroulante et un fichier où tu mets le nom de la version de Windows devrais suffire.

Cordialement
Jagang
____________________
J'ai toujours raison ! Sauf quand j'ai tort ...

Web    
Le 15/06/2011 à 12h15

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
c'était prévus ;) je vous poste la version w7 fini (niveau chemin pas graphique)
je pense poster la version Vista, w7 la semaine prochaine et Vista,w7,xp après. =)
je pars en vacance pendant 1 moins d'ici 10 jours donc vous inquiété pas de mon absence ;)
____________________
Yo !

MSN Web    
Le 16/06/2011 à 00h04

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
Voici le dernier code a jour ^^ demain je fini la partie seven 32 et 64 bits ;) !
Normalement tout doit fonctionné a par les accessoires et les jeux .
Pour google chrome écrivez votre nom a la place du mien ;).
Il reste beaucoup a faire je n'est travaillé que 2h en tout sur ce petit programme donc ne lui en demander pas trop =P !
En tout cas le programme a bien grossit ^^ il est passé de 2ko à 4,4ko !!!! c'est du lourd !!! :nex
A noté que seul w7 32 et 64 sont a peu près fait donc faudra tripler pour Vista et xp en plus !
J'ai une abondance d'idée, ce programme permettra de faire des truc de fous !!! vous verrez ça a mon retour ;)...
Voici le code !

Code TEXT :
[ini]
WindowWidth = 490
WindowHeight = 420
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
nomainwin
statictext #ATOM.text, "Quel Système Utilisez vous ?", 170, 110, 150, 20
button #ATOM, "Windows Seven", [ini2w7], LR, 430, 200
button #ATOM, "Windows Vista", [vista], LR, 280, 200
button #ATOM, " Windows  XP ", [XP], LR, 130, 200
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 4, 340, 150, 20
statictext #ATOM.text, " Production 2011/2012", 0, 360, 150, 20
statictext #ATOM.text, " Version 1.0", 0, 320, 60, 20
open "ATOM 1.0 / 2011-2012" for window_nf as #ATOM
#ATOM, "trapclose [quitter]"
wait
 
[ini2w7]
close #ATOM
statictext #ATOM.text, "Quel est votre cadence ?", 180, 110, 150, 20
button #ATOM, "32 Bits", [startw7.32b], LR, 310, 200
button #ATOM, "64 Bits", [startw7.64b], LR, 200, 200
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 4, 340, 150, 20
statictext #ATOM.text, " Production 2011/2012", 0, 360, 150, 20
statictext #ATOM.text, " Version 1.0", 0, 320, 60, 20
open "ATOM 1.0 / 2011-2012" for window_nf as #ATOM
#ATOM, "trapclose [quitter]"
wait
 
[startw7.64b]
close #ATOM
menu #ATOM, "&Editeur de texte   |", "&BlocNote", [blocnotw64], "&WorkPad", [wordpadw64], "&Microsoft Word", [wordw64], "&Oppen Office", [openoffw64]
menu #ATOM, "&Multi-médias   |","VLC Media player", [vlcw64],"Windows Media center", [wmcw64]
menu #ATOM, "&Jeux   |","&Diablo II", [DIIw64]
menu #ATOM, "&Internet   |","&Google Chrome", [chromw64],"&Internet Explorer", [iew64],"&Mozilla Firefox", [r],"&Messenger", [msnw64]
menu #ATOM, "&Utilitaires","&Calculatrice", [r],"&Paint", [r],"&Cmd", [r]
button #ATOM, "  Quitter ?", [quitter], LR, 100, 90
button #ATOM, "    Aide   ", [r], LR, 100, 60
button #ATOM, "Mise à jour", [r], LR, 100, 30
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 4, 310, 150, 20
statictext #ATOM.text, " Production 2011/2012", 0, 330, 150, 20
statictext #ATOM.text, " Version 1.0", 0, 290, 60, 20
open "ATOM 1.0 / 2011-2012" for window_nf as #ATOM
#ATOM, "trapclose [quitter]"
wait
 
[startw7.32b]
close #ATOM
menu #ATOM, "&Editeur de texte   |", "&BlocNote", [blocnotw64], "&WorkPad", [wordpadw32], "&Microsoft Word", [wordw32], "&Oppen Office", [openoffw32]
menu #ATOM, "&Multi-médias   |","VLC Media player", [vlcw32],"Windows Media center", [wmcw32]
menu #ATOM, "&Jeux   |","quitter", [quitter]
menu #ATOM, "&Internet   |","&Google Chrome", [chromw64],"&Internet Explorer", [iew32],"&Mozilla Firefox", [r],"&Messenger", [msnw32]
menu #ATOM, "&Utilitaires","&Calculatrice", [r],"&Paint", [r],"&Cmd", [r]
button #ATOM, "  Quitter ?", [quitter], LR, 100, 90
button #ATOM, "    Aide   ", [r], LR, 100, 60
button #ATOM, "Mise à jour", [r], LR, 100, 30
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 4, 310, 150, 20
statictext #ATOM.text, " Production 2011/2012", 0, 330, 150, 20
statictext #ATOM.text, " Version 1.0", 0, 290, 60, 20
open "ATOM 1.0 / 2011-2012" for window_nf as #ATOM
#ATOM, "trapclose [quitter]"
wait
 
[quitter]
close #ATOM
end
 
[wordpadw32]
nomainwin
run "C:\Program Files\Windows NT\Accessories\wordpad.exe"
wait
[wordpadw64]
nomainwin
run "C:\Program Files (x86)\Windows NT\Accessories\wordpad.exe"
wait
[DIIw64]
nomainwin
run "C:\Program Files (x86)\Diablo II\Diablo II.exe"
wait
[blocnotw64]
nomainwin
run "C:\Windows\notepad.exe"
wait
[wordw32]
nomainwin
run "C:\Program Files\Microsoft Office\Office14\WINWORD.exe"
wait
[wordw64]
nomainwin
run "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.exe"
wait
[openoffw64]
nomainwin
run "C:\Program Files (x86)\OpenOffice.org 3\program\soffice.exe"
wait
[vlcw32]
nomainwin
run "C:\Program Files\VideoLAN\VLC\vlc.exe"
wait
[vlcw64]
nomainwin
run "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
wait
[wmcw32]
nomainwin
run "C:\Program Files\Windows Media Player\wmplayer.exe"
wait
[wmcw64]
nomainwin
run "C:\Program Files (x86)\Windows Media Player\wmplayer.exe"
wait
[msnw32]
nomainwin
run "C:\Program Files\Windows Live\Messenger\msnmsgr.exe"
wait
[msnw64]
nomainwin
run "C:\Program Files (x86)\Windows Live\Messenger\msnmsgr.exe"
wait
[iew32]
nomainwin
run "C:\Program Files\Internet Explorer\iexplore.exe"
wait
[iew64]
nomainwin
run "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
wait
[chromw64]
nomainwin
run "C:\Users\Lomuto Alexandre\AppData\Local\Google\Chrome\Application\chrome.exe"
wait
 
 




Edité par atomose Le 16/06/2011 à 00h12
____________________
Yo !

MSN Web    
Le 16/06/2011 à 13h29

Administrateur

Groupe: Administrateur

Inscrit le: 24/09/2010
Messages: 238
Pourquoi tu mets un nomainwin devant les run ?
____________________

MSN Yahoo Web    
Le 16/06/2011 à 15h30

Administrateur

Groupe: Administrateur

Inscrit le: 25/09/2010
Messages: 362
Bonne question.
De plus, si tu veux faire un programme petit, ce n'est pas en refaisant 50 fois les lignes qui affiche la fenêtre pour chaque OS.
Je pense plutôt que tu devrais utiliser un tableau à 2 dimensions pour stocker les chemins en fonction de l'OS. Tu attribue un nombre à chaque OS, puis chaque ligne de ton tableau correspondrons a un OS et chaque colonnes à un programme. Comme ça tu pourras faire un truc du genre :
Code VB :
[wordpad]
run chemin$(idOS,3)
wait

Avec idOS la variable contenant m'identifiant (le numéro) de l'OS et 3 c'est la colonne où il y a le chemin pour WordPad.

Voila.
Cordialement
Jagang
____________________
J'ai toujours raison ! Sauf quand j'ai tort ...

Web    
Le 19/06/2011 à 21h49

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
Voici une mise a jour qui corrige et améliore très nettement la précédente ^^ .
Suite a un accident et a une semaine épouvante je n'est pas pu être très présent .
Je posterais la prochaine version avant mon départ.
Je suis conscient qu'il peut y avoir beaucoup d'améliorations et je m'en occupe ;) .
La version xp et Vista ne sont pas encore au point ; la version Seven marche a 90% si vous avez installez les logiciels ciblés par défaut =) .


Voici le nouveau code source :

Code TEXT :
[ini]
nomainwin
WindowWidth = 490
WindowHeight = 300
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
button #ATOM, "Windows Seven", [ini2w7], LR, 410, 140
button #ATOM, "Windows Vista", [ini2vista], LR, 260, 140
button #ATOM, " Windows  XP ", [ini2xp], LR, 110, 140
statictext #ATOM.text, "Quel Système Utilisez vous ?", 180, 30, 150, 20
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 14, 230, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 250, 150, 20
statictext #ATOM.text, " Version 1.0", 10, 210, 60, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[restart]
close #ATOM
goto[ini]
wait
 
[ini2w7]
close #ATOM
button #ATOM, "32 Bits", [startw7.32b], LR, 320, 100
button #ATOM, "64 Bits", [startw7.64b], LR, 180, 100
statictext #ATOM.text, "Window 7 : Quelle est votre cadence ?", 120, 50, 300, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 12"
#ATOM, "trapclose [quitter]"
wait
 
[startw7.64b]
close #ATOM
cadence = 64
goto [w7]
wait
 
[startw7.32b]
close #ATOM
cadence = 32
goto [w7]
wait
 
[w7]
menu #ATOM, "&Menu", "&Choix de l'OS", [restart], "&Ouvrir", [ouvrir], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeur de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaires","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "Widows Seven", 14, 170, 150, 20
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 20
statictext #ATOM.text, " Version 1.0", 10, 190, 60, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[ini2vista]
close #ATOM
button #ATOM, "32 Bits", [startvista.32b], LR, 320, 100
button #ATOM, "64 Bits", [startvista.64b], LR, 180, 100
statictext #ATOM.text, "Windows Vista : Quelle est votre cadence ?", 110, 50, 300, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 12"
#ATOM, "trapclose [quitter]"
wait
 
[startvista.64b]
close #ATOM
cadence = 64
goto [vista]
wait
 
[startvista.32b]
close #ATOM
cadence = 32
goto [vista]
wait
 
[vista]
menu #ATOM, "&Menu", "&Choix de l'OS", [restart], "&Ouvrir", [ouvrir], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeur de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaires","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "Widows Vista", 14, 170, 150, 20
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 20
statictext #ATOM.text, " Version 1.0", 10, 190, 60, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[ini2xp]
close #ATOM
button #ATOM, "32 Bits", [startxp.32b], LR, 320, 100
button #ATOM, "64 Bits", [startxp.64b], LR, 180, 100
statictext #ATOM.text, "Windows XP : Quelle est votre cadence ?", 120, 50, 300, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 12"
#ATOM, "trapclose [quitter]"
wait
 
[startxp.64b]
close #ATOM
cadence = 64
goto [xp]
wait
 
[startxp.32b]
close #ATOM
cadence = 32
goto [xp]
wait
 
[xp]
menu #ATOM, "&Menu", "&Choix de l'OS", [restart], "&Ouvrir", [ouvrir], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeur de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaires","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "Widows XP", 14, 170, 150, 20
statictext #ATOM.text, "ATOM by Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 20
statictext #ATOM.text, " Version 1.0", 10, 190, 60, 20
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
 
[wordpadw]
if cadence = 32 then run "C:\Program Files\Windows NT\Accessories\wordpad.exe"
if cadence = 64 then run "C:\Program Files (x86)\Windows NT\Accessories\wordpad.exe"
wait
[blocnotw]
run "C:\Windows\notepad.exe"
wait
[paintw]
run "C:\Windows\System32\mspaint.exe"
wait
[cmdw]
run "C:\Windows\System32\cmd.exe"
wait
[calculw]
run "C:\Windows\System32\calc.exe"
wait
[wordw]
if cadence = 32 then run "C:\Program Files\Microsoft Office\Office14\WINWORD.exe"
if cadence = 64 then run "C:\Program Files (x86)\Microsoft Office\Office14\WINWORD.exe"
wait
[openoffw]
run "C:\Program Files (x86)\OpenOffice.org 3\program\soffice.exe"
wait
[vlcw]
if cadence = 32 then run "C:\Program Files\VideoLAN\VLC\vlc.exe"
if cadence = 64 then run "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
wait
[wmcw]
if cadence = 32 then run "C:\Program Files\Windows Media Player\wmplayer.exe"
if cadence = 64 then run "C:\Program Files (x86)\Windows Media Player\wmplayer.exe"
wait
[msnw]
if cadence = 32 then run "C:\Program Files\Windows Live\Messenger\msnmsgr.exe"
if cadence = 64 then run "C:\Program Files (x86)\Windows Live\Messenger\msnmsgr.exe"
wait
[iew]
if cadence = 32 then run "C:\Program Files\Internet Explorer\iexplore.exe"
if cadence = 64 then run "C:\Program Files (x86)\Internet Explorer\iexplore.exe"
wait
[chromw]
run "C:\Users\Lomuto Alexandre\AppData\Local\Google\Chrome\Application\chrome.exe"
wait
[mozw]
if cadence = 32 then run "C:\Program Files\Mozilla Firefox\firefox.exe"
if cadence = 64 then run "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
wait
[ccleaner]
if cadence = 32 then run "C:\Program Files\CCleaner\CCleaner32.exe"
if cadence = 64 then run "C:\Program Files\CCleaner\CCleaner64.exe"
wait
 
[quitter]
confirm "Voulez vous Quittez l'application ATOM ?"; quit$
if quit$ = "no" then wait
close #ATOM
end
 




Edité par atomose Le 19/06/2011 à 21h54
____________________
Yo !

MSN Web    
Le 19/06/2011 à 22h01

Administrateur

Groupe: Administrateur

Inscrit le: 24/09/2010
Messages: 238
J'suis sur le même type de projet (sauf que je le fait en ligne de commande pour lancer les programmes) et je te conseil de faire un file exist avant de faire le run, comme cela ça ne retournera pas d'erreur si le programme n'est pas présent (:
____________________

MSN Yahoo Web    
Le 19/06/2011 à 23h39

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
comment ça ?
____________________
Yo !

MSN Web    
Le 20/06/2011 à 07h39

Administrateur

Groupe: Administrateur

Inscrit le: 24/09/2010
Messages: 203
Salut !

Ce que Nephthys veut dire, c'est qu'avant de faire un run, tu peux tester l’existence de l'application à lancer grâce à la fonction fileExist : http://libertybasic.fr/forum/topic-45+jb-function-teste-l-existance-d-un-fichier-ou-d-un-dossier.php

Comme ça, si l'application à lancer n'existe pas sur le PC de la personne qui exécute le programme, tu peux le savoir et gérer l'erreur toi même. (ça évite de faire planter ton programme)

++

Mail MSN Web    
Le 20/06/2011 à 19h00

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
Voici une mise a jour très importante :
-refonte complète du système
-nouvelle interface
-allègement du système
-ajout de nouvelles options
-application plus simple d'utilisation
-système de sécurité anti-crash
-indicateur d'OS,version,langue
-Seven, Vista et XP sont supportés ( en 32 et 64 bits)


A noté que l'application chrome ne marche pas ( elle ne marche que sur mon pc ). Je compte aussi rajouter encore une dizaine d'applications courantes d'ici mon départ ^^.

Cette version est pour les ordinateurs portables aillants une résolution d'écran > 1200x600 ;
une version pour Notebook ou résolution plus faible est en cours.


Voici le code :

Code TEXT :
[ini]
w7 = 1 : vista = 2 : xp = 3
nomainwin
WindowWidth = 490
WindowHeight = 300
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
button #ATOM, "Windows Seven", [s], LR, 410, 140
button #ATOM, "Windows Vista", [v], LR, 260, 140
button #ATOM, " Windows  XP ", [x], LR, 110, 140
statictext #ATOM.text, "Quel Système Utilisez vous ?", 180, 30, 160, 20
statictext #ATOM.text, "By Alexandre Lomuto", 14, 220, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 240, 150, 20
statictext #ATOM.text, " ATOM 1.0", 10, 200, 100, 20
groupbox #ATOM, "", 5, 180, 160, 85
groupbox #ATOM, "", 30, 85, 440, 60
groupbox #ATOM, "", 150, 5, 200, 60
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 10"
#ATOM, "trapclose [quitter]"
wait
 
[restart]
close #ATOM
goto[ini]
wait
 
[s]
sys = 1
goto[w]
wait
[v]
sys = 2
goto[w]
wait
[x]
sys = 3
goto[w]
wait
 
[w]
close #ATOM
textbox #ATOM.phone, 20, 80, 440, 25
menu #ATOM, "&Menu", "&Retour au choix de l'OS", [restart], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeurs de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaire","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "By Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 15
statictext #ATOM.text, " ATOM 1.0 fr", 10, 190, 80, 20
statictext #ATOM.text, "Avertissement :", 180, 165, 80, 20
statictext #ATOM.text, "Si votre fichier est introuvable, changez d'OS ou référez-vous au menu aide. Si le programme ce ferme suite à une erreur, télécharger la dernière mise à jour ou relancez l'application.", 180, 183, 280, 60
if sys = 1 then statictext #ATOM.text, "Windows Seven", 14, 170, 150, 20
if sys = 2 then statictext #ATOM.text, "Windows vista", 14, 170, 150, 20
if sys = 3 then statictext #ATOM.text, "Windows XP", 14, 170, 150, 20
groupbox #ATOM, "", 5, 155, 160, 95
groupbox #ATOM, "", 170, 155, 300, 95
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[wordpadw]
dir$ = "C:\Program Files"
file$ = "Windows NT\Accessories\wordpad.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
function fileExist(dir$,file$)
    dim info$(10, 10)
    files dir$,file$, info$(
    if val(info$(0, 0)) > 0 then
        fileExist = 1
    else
        fileExist = 0
    end if
end function
wait
 
[wordw]
if sys = 2 or 3 then dir1$ = "C:\Program Files"
if sys = 1 then dir1$ = "C:\Program Files (x86)"
file1$ = "Microsoft Office\Office14\WINWORD.exe"
if fileExist1(dir1$,file1$) = 1 then
    print #ATOM.phone, dir1$;"\";file1$;" Trouvé !"
        run dir1$;"\";file1$
else
    print #ATOM.phone,"Le fichier ";dir1$;"\";file1$;" n'existe pas"
            wait
end if
wait
function fileExist1(dir1$,file1$)
    dim info1$(10, 10)
    files dir1$,file1$, info1$(
    if val(info1$(0, 0)) > 0 then
        fileExist1 = 1
    else
        fileExist1 = 0
    end if
end function
wait
 
[blocnotw]
dir2$ = "C:\Windows"
file2$ = "notepad.exe"
if fileExist2(dir2$,file2$) = 1 then
    print #ATOM.phone, dir2$;"\";file2$;" Trouvé !"
        run dir2$;"\";file2$
else
    print #ATOM.phone,"Le fichier ";dir2$;"\";file2$;" n'existe pas"
            wait
end if
wait
function fileExist2(dir2$,file2$)
    dim info2$(10, 10)
    files dir2$,file2$, info2$(
    if val(info2$(0, 0)) > 0 then
        fileExist2 = 1
    else
        fileExist2 = 0
    end if
end function
wait
 
[paintw]
dir3$ = "C:\Windows"
file3$ = "System32\mspaint.exe"
if fileExist3(dir3$,file3$) = 1 then
    print #ATOM.phone, dir3$;"\";file3$;" Trouvé !"
        run dir3$;"\";file3$
else
    print #ATOM.phone,"Le fichier ";dir3$;"\";file3$;" n'existe pas"
            wait
end if
wait
function fileExist3(dir3$,file3$)
    dim info3$(10, 10)
    files dir3$,file3$, info3$(
    if val(info3$(0, 0)) > 0 then
        fileExist3 = 1
    else
        fileExist3 = 0
    end if
end function
wait
 
[cmdw]
dir4$ = "C:\Windows"
file4$ = "System32\cmd.exe"
if fileExist4(dir4$,file4$) = 1 then
    print #ATOM.phone, dir4$;"\";file4$;" Trouvé !"
        run dir4$;"\";file4$
else
    print #ATOM.phone,"Le fichier ";dir4$;"\";file4$;" n'existe pas"
            wait
end if
wait
function fileExist4(dir4$,file4$)
    dim info4$(10, 10)
    files dir4$,file4$, info4$(
    if val(info4$(0, 0)) > 0 then
        fileExist4 = 1
    else
        fileExist4 = 0
    end if
end function
wait
 
[calculw]
dir5$ = "C:\Windows"
file5$ = "System32\calc.exe"
if fileExist5(dir5$,file5$) = 1 then
    print #ATOM.phone, dir5$;"\";file5$;" Trouvé !"
        run dir5$;"\";file5$
else
    print #ATOM.phone,"Le fichier ";dir5$;"\";file5$;" n'existe pas"
            wait
end if
wait
function fileExist5(dir5$,file5$)
    dim info5$(10, 10)
    files dir5$,file5$, info5$(
    if val(info5$(0, 0)) > 0 then
        fileExist5 = 1
    else
        fileExist5 = 0
    end if
end function
wait
 
[openoffw]
if sys = 2 or 3 then dir6$ = "C:\Program Files"
if sys = 1 then dir6$ = "C:\Program Files (x86)"
file6$ = "OpenOffice.org 3\program\soffice.exe"
if fileExist6(dir6$,file6$) = 1 then
    print #ATOM.phone, dir6$;"\";file6$;" Trouvé !"
        run dir6$;"\";file6$
else
    print #ATOM.phone,"Le fichier ";dir6$;"\";file6$;" n'existe pas"
            wait
end if
wait
function fileExist6(dir6$,file6$)
    dim info6$(10, 10)
    files dir6$,file6$, info6$(
    if val(info6$(0, 0)) > 0 then
        fileExist6 = 1
    else
        fileExist6 = 0
    end if
end function
wait
 
[chromw]
dir7$ = "C:\Users\Lomuto Alexandre"
file7$ = "AppData\Local\Google\Chrome\Application\chrome.exe"
if fileExist7(dir7$,file7$) = 1 then
    print #ATOM.phone, dir7$;"\";file7$;" Trouvé !"
        run dir7$;"\";file7$
else
    print #ATOM.phone,"Le fichier ";dir7$;"\";file7$;" n'existe pas"
            wait
end if
wait
function fileExist7(dir7$,file7$)
    dim info7$(10, 10)
    files dir7$,file7$, info7$(
    if val(info7$(0, 0)) > 0 then
        fileExist7 = 1
    else
        fileExist7 = 0
    end if
end function
wait
 
[vlcw]
if sys = 2 or 3 then dir8$ = "C:\Program Files"
if sys = 1 then dir8$ = "C:\Program Files (x86)"
file8$ = "VideoLAN\VLC\vlc.exe"
if fileExist8(dir8$,file8$) = 1 then
    print #ATOM.phone, dir8$;"\";file8$;" Trouvé !"
        run dir8$;"\";file8$
else
    print #ATOM.phone,"Le fichier ";dir8$;"\";file8$;" n'existe pas"
            wait
end if
wait
function fileExist8(dir8$,file8$)
    dim info8$(10, 10)
    files dir8$,file8$, info8$(
    if val(info8$(0, 0)) > 0 then
        fileExist8 = 1
    else
        fileExist8 = 0
    end if
end function
wait
 
[wmcw]
dir9$ = "C:\Program Files"
file9$ = "Windows Media Player\wmplayer.exe"
if fileExist9(dir9$,file9$) = 1 then
    print #ATOM.phone, dir9$;"\";file9$;" Trouvé !"
        run dir9$;"\";file9$
else
    print #ATOM.phone,"Le fichier ";dir9$;"\";file9$;" n'existe pas"
            wait
end if
wait
function fileExist9(dir9$,file9$)
    dim info9$(10, 10)
    files dir9$,file9$, info9$(
    if val(info9$(0, 0)) > 0 then
        fileExist9 = 1
    else
        fileExist9 = 0
    end if
end function
wait
 
[msnw]
if sys = 2 or 3 then dir8$ = "C:\Program Files"
if sys = 1 then dir10$ = "C:\Program Files (x86)"
file10$ = "Windows Live\Messenger\msnmsgr.exe"
if fileExist10(dir10$,file10$) = 1 then
    print #ATOM.phone, dir10$;"\";file10$;" Trouvé !"
        run dir10$;"\";file10$
else
    print #ATOM.phone,"Le fichier ";dir10$;"\";file10$;" n'existe pas"
            wait
end if
wait
function fileExist10(dir10$,file10$)
    dim info10$(10, 10)
    files dir10$,file10$, info10$(
    if val(info10$(0, 0)) > 0 then
        fileExist10 = 1
    else
        fileExist10 = 0
    end if
end function
wait
 
[iew]
if sys = 2 or 3 then dir8$ = "C:\Program Files"
if sys = 1 then dir11$ = "C:\Program Files (x86)"
file11$ = "Internet Explorer\iexplore.exe"
if fileExist11(dir11$,file11$) = 1 then
    print #ATOM.phone, dir11$;"\";file11$;" Trouvé !"
        run dir11$;"\";file11$
else
    print #ATOM.phone,"Le fichier ";dir11$;"\";file11$;" n'existe pas"
            wait
end if
wait
function fileExist11(dir11$,file11$)
    dim info11$(11, 11)
    files dir11$,file11$, info11$(
    if val(info11$(0, 0)) > 0 then
        fileExist11 = 1
    else
        fileExist11 = 0
    end if
end function
wait
 
[mozw]
if sys = 2 or 3 then dir8$ = "C:\Program Files"
if sys = 1 then dir12$ = "C:\Program Files (x86)"
file12$ = "Mozilla Firefox\firefox.exe"
if fileExist12(dir12$,file12$) = 1 then
    print #ATOM.phone, dir12$;"\";file12$;" Trouvé !"
        run dir12$;"\";file12$
else
    print #ATOM.phone,"Le fichier ";dir12$;"\";file12$;" n'existe pas"
            wait
end if
wait
function fileExist12(dir12$,file12$)
    dim info12$(12, 12)
    files dir12$,file12$, info12$(
    if val(info12$(0, 0)) > 0 then
        fileExist12 = 1
    else
        fileExist12 = 0
    end if
end function
wait
 
[ccleaner]
dir13$ = "C:\Program Files"
if sys = 2 or 3 then file13$ = "CCleaner\CCleaner32.exe"
if sys = 1 then file13$ = "CCleaner\CCleaner64.exe"
if fileExist13(dir13$,file13$) = 1 then
    print #ATOM.phone, dir13$;"\";file13$;" Trouvé !"
        run dir13$;"\";file13$
else
    print #ATOM.phone,"Le fichier ";dir13$;"\";file13$;" n'existe pas"
            wait
end if
wait
function fileExist13(dir13$,file13$)
    dim info13$(13, 13)
    files dir13$,file13$, info13$(
    if val(info13$(0, 0)) > 0 then
        fileExist13 = 1
    else
        fileExist13 = 0
    end if
end function
wait
 
[quitter]
confirm "Voulez vous Quittez l'application ATOM ?"; quit$
if quit$ = "no" then wait
close #ATOM
end
 




Edité par atomose Le 20/06/2011 à 19h03
____________________
Yo !

MSN Web    
Le 20/06/2011 à 20h57

Administrateur

Groupe: Administrateur

Inscrit le: 24/09/2010
Messages: 238
Ouch que c'est lourd >< Tu n'as pas besoin de copier 50 fois la fonction. Le but d'un fonction, c'est de gagner de la place, hors en la recopiant autant de fois que tu en as besoin, tu alourdis inutilement le fichier, et ralentit l'exécution.

De même, au lieu de c/c la phrase 'print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"' pour chaque sous programme différents, tu pourrais faire une sub, et si tu veux changer de phrase, tu n'auras qu'une phrase à modifier (celle de la sub) et modifier la phrase de chaque sous programme ! (Je ne sais pas si je suis très clair).

Pourquoi avoir créer des dir$1, dir$2, dir$n ? Si une variable porte le même nom qu'une autre, c'est la dernière valeur que tu as placée de dedans qui l'emporte, l'autre est écrasée. :)

Code VB :
 
[ini]
w7 = 1 : vista = 2 : xp = 3
nomainwin
 
WindowWidth = 490
WindowHeight = 300
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
 
button #ATOM, "Windows Seven", [s], LR, 410, 140
button #ATOM, "Windows Vista", [v], LR, 260, 140
button #ATOM, " Windows  XP ", [x], LR, 110, 140
statictext #ATOM.text, "Quel Système Utilisez vous ?", 180, 30, 160, 20
statictext #ATOM.text, "By Alexandre Lomuto", 14, 220, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 240, 150, 20
statictext #ATOM.text, " ATOM 1.0", 10, 200, 100, 20
groupbox #ATOM, "", 5, 180, 160, 85
groupbox #ATOM, "", 30, 85, 440, 60
groupbox #ATOM, "", 150, 5, 200, 60
 
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 10"
#ATOM, "trapclose [quitter]"
wait
 
[restart]
close #ATOM
goto[ini]
wait
 
[s]
sys = 1
goto[w]
wait
[v]
sys = 2
goto[w]
wait
[x]
sys = 3
goto[w]
wait
 
[w]
close #ATOM
 
textbox #ATOM.phone, 20, 80, 440, 25
menu #ATOM, "&Menu", "&Retour au choix de l'OS", [restart], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeurs de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaire","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "By Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 15
statictext #ATOM.text, " ATOM 1.0 fr", 10, 190, 80, 20
statictext #ATOM.text, "Avertissement :", 180, 165, 80, 20
statictext #ATOM.text, "Si votre fichier est introuvable, changez d'OS ou référez-vous au menu aide. Si le programme ce ferme suite à une erreur, télécharger la dernière mise à jour ou relancez l'application.", 180, 183, 280, 60
 
if sys = 1 then statictext #ATOM.text, "Windows Seven", 14, 170, 150, 20
if sys = 2 then statictext #ATOM.text, "Windows vista", 14, 170, 150, 20
if sys = 3 then statictext #ATOM.text, "Windows XP", 14, 170, 150, 20
 
groupbox #ATOM, "", 5, 155, 160, 95
groupbox #ATOM, "", 170, 155, 300, 95
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[wordpadw]
dir$ = "C:\Program Files"
file$ = "Windows NT\Accessories\wordpad.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[wordw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file1$ = "Microsoft Office\Office14\WINWORD.exe"
if fileExist(dir$,file1$) = 1 then
    print #ATOM.phone, dir$;"\";file1$;" Trouvé !"
        run dir$;"\";file1$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file1$;" n'existe pas"
            wait
end if
wait
 
 
[blocnotw]
dir$ = "C:\Windows"
file$ = "notepad.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[paintw]
dir$ = "C:\Windows"
file$ = "System32\mspaint.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[cmdw]
dir$ = "C:\Windows"
file$ = "System32\cmd.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[calculw]
dir$ = "C:\Windows"
file$ = "System32\calc.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[openoffw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "OpenOffice.org 3\program\soffice.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[chromw]
dir$ = "C:\Users\Lomuto Alexandre"
file$ = "AppData\Local\Google\Chrome\Application\chrome.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[vlcw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "VideoLAN\VLC\vlc.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[wmcw]
dir$ = "C:\Program Files"
file$ = "Windows Media Player\wmplayer.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
[msnw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Windows Live\Messenger\msnmsgr.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[iew]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Internet Explorer\iexplore.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[mozw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Mozilla Firefox\firefox.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
 
[ccleaner]
dir$ = "C:\Program Files"
if sys = 2 or 3 then file$ = "CCleaner\CCleaner32.exe"
if sys = 1 then file$ = "CCleaner\CCleaner64.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
wait
 
[quitter]
confirm "Voulez vous Quittez l'application ATOM ?"; quit$
if quit$ = "no" then wait
close #ATOM
end
 
 
function fileExist(dir$,file$)
    dim info$(10, 10)
    files dir$,file$, info$(
    if val(info$(0, 0)) > 0 then
        fileExist = 1
    else
        fileExist = 0
    end if
end function
wait
 
 


On peu aussi alléger les blocs de ce type (en créant une sub par exemple) :)

Code VB :
 
dir$ = "C:\Program Files"
file$ = "Windows NT\Accessories\wordpad.exe"
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
____________________

MSN Yahoo Web    
Le 20/06/2011 à 21h08

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
En effet, c'est ma première fonction que j'utilise ^^ j'ai déjà eu du mal a la faire fonctionner....merci de ta remarque ça a bien alléger le programme !

questions :
comment changer la couleur d'une police avec une windows_nf ???
comment changer la couleur de l'arrière plan ? d'un cadre ?
que pensez vous de ce programme ? de son évolution ?

merci =)

voici le code optimisé ! :
Code TEXT :
[ini]
w7 = 1 : vista = 2 : xp = 3
nomainwin
WindowWidth = 490
WindowHeight = 300
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
button #ATOM, "Windows Seven", [s], LR, 410, 140
button #ATOM, "Windows Vista", [v], LR, 260, 140
button #ATOM, " Windows  XP ", [x], LR, 110, 140
statictext #ATOM.text, "Quel Système Utilisez vous ?", 180, 30, 160, 20
statictext #ATOM.text, "By Alexandre Lomuto", 14, 220, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 240, 150, 20
statictext #ATOM.text, " ATOM 1.0", 10, 200, 100, 20
groupbox #ATOM, "", 5, 180, 160, 85
groupbox #ATOM, "", 30, 85, 440, 60
groupbox #ATOM, "", 150, 5, 200, 60
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 10"
#ATOM, "trapclose [quitter]"
wait
 
[restart]
close #ATOM
goto[ini]
wait
 
[s]
sys = 1
goto[w]
wait
[v]
sys = 2
goto[w]
wait
[x]
sys = 3
goto[w]
wait
 
[w]
close #ATOM
textbox #ATOM.phone, 20, 80, 440, 25
menu #ATOM, "&Menu", "&Retour au choix de l'OS", [restart], "&Mise à jour", [maj], "&Aide / A propos de...", [blabla],"&Quitter", [quitter]
menu #ATOM, "&Editeurs de texte", "&BlocNote", [blocnotw], "&WorkPad", [wordpadw], "&Microsoft Word", [wordw], "&Oppen Office", [openoffw]
menu #ATOM, "&Multi-médias","VLC Media player", [vlcw],"Windows Media center", [wmcw]
menu #ATOM, "&Internet","&Google Chrome", [chromw],"&Internet Explorer", [iew],"&Mozilla Firefox", [mozw],"&Messenger", [msnw]
menu #ATOM, "&Utilitaire","&Calculatrice", [calculw],"&Paint", [paintw],"&Commande", [cmdw]
menu #ATOM, "&Entretien","&Ccleaner", [ccleaner]
menu #ATOM, "&Jeux","quitter", [quitter]
statictext #ATOM.text, "By Alexandre Lomuto", 14, 210, 150, 20
statictext #ATOM.text, " Production 2011/2012", 10, 230, 150, 15
statictext #ATOM.text, " ATOM 1.0 fr", 10, 190, 80, 20
statictext #ATOM.text, "Avertissement :", 180, 165, 80, 20
statictext #ATOM.text, "Si votre fichier est introuvable, changez d'OS ou référez-vous au menu aide. Si le programme ce ferme suite à une erreur, télécharger la dernière mise à jour ou relancez l'application.", 180, 183, 280, 60
if sys = 1 then statictext #ATOM.text, "Windows Seven", 14, 170, 150, 20
if sys = 2 then statictext #ATOM.text, "Windows vista", 14, 170, 150, 20
if sys = 3 then statictext #ATOM.text, "Windows XP", 14, 170, 150, 20
groupbox #ATOM, "", 5, 155, 160, 95
groupbox #ATOM, "", 170, 155, 300, 95
open " " for window_nf as #ATOM
print #ATOM, "font Times New Roman 9"
#ATOM, "trapclose [quitter]"
wait
 
[wordpadw]
dir$ = "C:\Program Files"
file$ = "Windows NT\Accessories\wordpad.exe"
gosub[files]
wait
 
[wordw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Microsoft Office\Office14\WINWORD.exe"
gosub[files]
wait
 
[blocnotw]
dir$ = "C:\Windows"
file$ = "notepad.exe"
gosub[files]
wait
 
[paintw]
dir$ = "C:\Windows"
file$ = "System32\mspaint.exe"
gosub[files]
wait
 
[cmdw]
dir$ = "C:\Windows"
file$ = "System32\cmd.exe"
gosub[files]
wait
 
[calculw]
dir$ = "C:\Windows"
file$ = "System32\calc.exe"
gosub[files]
wait
 
[openoffw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "OpenOffice.org 3\program\soffice.exe"
gosub[files]
wait
 
[chromw]
dir$ = "C:\Users\Lomuto Alexandre"
file$ = "AppData\Local\Google\Chrome\Application\chrome.exe"
gosub[files]
wait
 
[vlcw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "VideoLAN\VLC\vlc.exe"
gosub[files]
wait
 
[wmcw]
dir$ = "C:\Program Files"
file$ = "Windows Media Player\wmplayer.exe"
gosub[files]
wait
 
[msnw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Windows Live\Messenger\msnmsgr.exe"
gosub[files]
wait
 
[iew]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Internet Explorer\iexplore.exe"
gosub[files]
wait
 
[mozw]
if sys = 2 or 3 then dir$ = "C:\Program Files"
if sys = 1 then dir$ = "C:\Program Files (x86)"
file$ = "Mozilla Firefox\firefox.exe"
gosub[files]
wait
 
[ccleaner]
dir$ = "C:\Program Files"
if sys = 2 or 3 then file$ = "CCleaner\CCleaner32.exe"
if sys = 1 then file$ = "CCleaner\CCleaner64.exe"
gosub[files]
wait
 
[quitter]
confirm "Voulez vous Quittez l'application ATOM ?"; quit$
if quit$ = "no" then wait
close #ATOM
end
 
[files]
if fileExist(dir$,file$) = 1 then
    print #ATOM.phone, dir$;"\";file$;" Trouvé !"
        run dir$;"\";file$
else
    print #ATOM.phone,"Le fichier ";dir$;"\";file$;" n'existe pas"
            wait
end if
wait
 
function fileExist(dir$,file$)
    dim info$(10, 10)
    files dir$,file$, info$(
    if val(info$(0, 0)) > 0 then
        fileExist = 1
    else
        fileExist = 0
    end if
end function
wait
 
 
 




Edité par atomose Le 20/06/2011 à 21h22
____________________
Yo !

MSN Web    
Le 21/06/2011 à 12h54

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
Dit moi Nephthys , ton programme ressemble a quoi ?
tu pourais le poster ?
____________________
Yo !

MSN Web    
Le 21/06/2011 à 13h49

Administrateur

Groupe: Administrateur

Inscrit le: 24/09/2010
Messages: 238
Voilà (: MiaLBFR.zip

Le code est un peu en bordel et pour le moment c'est un peu trop du bricolage à mon goût, enfin bon, je ferai ça quand j'aurai un peu plus de temps =)
Pour le moment j'essaie de faire un système de BDD basic pour me permettre de gérer la liste de programmes (et à plus grande échelle avoir un truc BDD potable qui marche avec JB qui si j'y arrive devrais pouvoir faire 'des requêtes' du genre du SQL). Enfin pour le moment, le code n'est que sur le papier et pas top, donc faut que je bosse la dessus aussi =)
____________________

MSN Yahoo Web    
Le 21/06/2011 à 17h59

Modérateur

Groupe: Modérateur

Inscrit le: 30/03/2011
Messages: 437
hum je n'arrive pas a lire ton programme o_o...
ça bloque ici :
stylebits #main, _WS_DLGFRAME,0,0,0
____________________
Yo !

MSN Web    
Le 21/06/2011 à 18h02

Libertynaute Expert

Groupe: Membre

Inscrit le: 19/02/2011
Messages: 767
normal c'est du LIBERTY BASIC et non du JUST BASIC. ;)
____________________
Devise Shadocks : "Mieux vaut mobiliser son intelligence pour des conneries, que mobiliser sa connerie pour des choses intelligentes"
Coluche disait : "C'est parce que la vitesse de la lumière est plus rapide que celle du son que certains peuvent paraîtrent brillants jusqu'à ce qu'ils ouvrent la bouche."

Web    

 |  |

1 Utilisateur en ligne : 0 Administrateur, 0 Modérateur, 0 Membre et 1 Visiteur
Utilisateur en ligne : Aucun membre connecté
Répondre
Vous n'êtes pas autorisé à écrire dans cette catégorie