Bonjour Dobro
Parce que le nom de sortie par défaut est "purebasic.asm"
Pb identique avec pureasm de ERIX14
Voici à titre d'exemple un prg pour utiliser pureasm ou notepad
Code : Tout sélectionner
Procedure.l FindTargetPIDByWindowName(Name.s,Opt.l=0)
;Opt option pour obtenir soit le PID soit Handle
;opt=O par defaut donne PID
;opt=1 donne le Handle
; Name est le nom window
Define.l hWnd,Pid
hWnd=FindWindow_(#Null,Name)
If hWnd<>0
GetWindowThreadProcessId_(hWnd,@Pid)
EndIf
If opt=0
ProcedureReturn Pid
Else
ProcedureReturn hWnd
EndIf
EndProcedure
ExamineDesktops()
HAUTEUR_W=DesktopHeight(0)
Largeur_W=DesktopWidth(0)
Nb_param=CountProgramParameters()
Dim Tparam.s{256}(Nb_param)
For param=0 To NB_PARAM
Tparam(param)=ProgramParameter(Param)
If Tparam(param)<>""
If LCase(Tparam(param))="/notepad"
EDIT.B=1
Else
EDIT.b=0
EndIf
EndIf
Next
fichier$=Trim(Tparam(0))
result$=""
If Nb_param>2
result$="*** Il manque très certainement les quotes qui encadrent le nom du fichier ***"+#LF$+#LF$
For param=0 To NB_PARAM
result$+Tparam(param)+#LF$
Next
result$+#LF$+" exemple de paramètre : "+#LF$+Chr(34)+"Nom entier avec répertoire du proramme PB"+Chr(34)+" [/notepad]"+#LF$
EndIf
If fichier$<>"" And FileSize(fichier$)<0
result$+#LF$+" Le fichier :"+fichier$+" n'existe pas"
EndIf
If result$<>""
fichier$=""
MessageRequester("Erreur dans les paramètres passés. ",result$,#PB_MessageRequester_Ok)
EndIf
Mesg$="Fichier à convertir"
While fichier$=""
fichier$=OpenFileRequester(Mesg$,"","*.pb;*.pbi",0)
Mesg$+"Fichier "+Str(Len(Mesg$))
If Len(Mesg$)>80
End
EndIf
Wend
chemin$=GetPathPart(fichier$)
nom_fichier$=Left(GetFilePart(fichier$),Len(GetFilePart(fichier$))-1-Len(GetExtensionPart(fichier$)))
#guil=Chr(34)
; Debug #PB_Compiler_Home+"/Compilers/pbcompiler"+_s(nom_fichier$)+_s(chemin$)
; ; /DEBUGGER: Enable the debugger
; ; /EXE "Filename": Create an executable To the given filename
; ; /DLL: Create a DLL
; ; /CONSOLE: Create a console executable
; ; /ICON "Filename": ADD an icon To the executable
; ; /RESOURCE "Filename": ADD a resource file (.rc) To the executable
; ; /QUIET: Disable all unnecessary textoutput
; ; /COMMENTED: Produce a commented asm output (PureBasic.asm)
; ; /REASM: Compile the 'PureBasic.asm' file To an executable
; ; /XP: ADD the Windows XP theme support To the executable
; ; /USER: ADD the 'User' hint To the executable (Windows Vista)
; ; /ADMINISTRATOR: ADD the 'Administrator' hint To the executable (Windows Vista)
; ; /INLINEASM: Enable the inline ASM support ;===>>> N'EXISTE PLUS A PARTIR DE PB520
; ; /RESIDENT "Filename": Create a resident file To the given filename
; ; /IGNORERESIDENT "Filename": ignore the given resident
; ; /LINENUMBERING: Enable line numbering IN the final executable For OnError
; ; /STANDBY: WAIT For external commands (editor, scripts...)
; ; /MMX, /3DNOW, /SSE Or /SSE2: Create a processor specific executable
; ; /DYNAMICCPU: Create a executable containing all processor specific routines
; ; /THREAD: Use thread safe Runtime For strings And general routines
; ; /UNICODE: Use unicode instead ascii For strings management
; ; /PURIFIER: Enable the purifier
; ; /SUBSYSTEM "Name": Use this subsystem To replace a set of internal functions
; ; /CONSTANT Name=Value: Declare a new constant at compile time
; ; /LINKER "ResponsFile": Specify a commands file To be passed To the linker
; ; /CHECK: Check the syntax only, doesn't create/launch the executable
; ;
; ; /LANGUAGE "Language": Uses the specified language For the compiler
; ;
; ; /VERSION: Display the version of the compiler
TAILFIL1=FileSize(chemin$+"purebasic.exe")
If TAILFIL1>0
DeleteFile(chemin$+"purebasic.exe",#PB_FileSystem_Force)
EndIf
TAILFIL2=FileSize(chemin$+nom_fichier$+".asm")
If TAILFIL2>0
DeleteFile(chemin$+nom_fichier$+".asm",#PB_FileSystem_Force)
EndIf
Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",chemin$,#PB_Program_Hide | #PB_Program_Open | #PB_Program_Read )
; Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",chemin$,#PB_Program_Hide | #PB_Program_Wait )
; ; Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED /INLINEASM ",chemin$,#PB_Program_Open | #PB_Program_Read)
; ; Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",#guil+fichier$+#guil+" /COMMENTED ",#PB_Compiler_Home,#PB_Program_Hide|#PB_Program_Open | #PB_Program_Read)
; ; Compilateur = RunProgram(CheminPB$ + "PBCompiler.exe", Chr(34) + File + Chr(34) + " /COMMENTED /INLINEASM " + Chr(34) + File + Chr(34) + " /EXE " + Chr(34) + " " + Chr(34),"",1|2)
; ; Compilateur = RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler", Chr(34) + fichier$ + Chr(34) + " /COMMENTED /INLINEASM " + Chr(34) + fichier$+ Chr(34) + " /EXE " + Chr(34) + " " + Chr(34),#PB_Program_Open | #PB_Program_Read)
; ; Compilateur=RunProgram(#PB_Compiler_Home+"/Compilers/pbcompiler",Chr(34)+fichier$+Chr(34)+" /COMMENTED ",#PB_Compiler_Home+"/Compilers/ /INLINEASM",#PB_Program_Open | #PB_Program_Read)
; Compilateur=RunProgram("L:\program files\Purebasic\Compilers\pbcompiler",#guil+fichier$+#guil+" /COMMENTED",chemin$,#PB_Program_Open | #PB_Program_Read)
; Debug _s(fichier$)+_s(chemin$)+_s(nom_fichier$)
Sortie$=""
If Compilateur
While ProgramRunning(Compilateur)
If AvailableProgramOutput(Compilateur)
Sortie$+ReadProgramString(Compilateur)+Chr(13)
EndIf
Wend
exit_code= ProgramExitCode(compilateur)
Sortie$+Chr(13)+Chr(13)
Sortie$+"Code de retour : "+Str(ProgramExitCode(Compilateur))
CloseProgram(Compilateur) ; Ferme la connection vers le compilateur
If FileSize(chemin$+nom_fichier$+".exe")>0
DeleteFile(chemin$+nom_fichier$+".exe")
EndIf
If RenameFile(chemin$+"purebasic.exe",chemin$+nom_fichier$+".exe")
Else
SORTIE$+#LFCR$+" Le fichier "+chemin$+"purebasic.exe ne peut être renommé"
EndIf
If FileSize(chemin$+nom_fichier$+".asm")>0
DeleteFile(chemin$+nom_fichier$+".asm")
EndIf
If RenameFile(chemin$+"purebasic.asm",chemin$+nom_fichier$+".asm")
Else
SORTIE$+#LFCR$+" Le fichier "+chemin$+"purebasic.asm ne peut être renommé"
EndIf
If edit=1
compil=RunProgram("notepad" ,chemin$+nom_fichier$+".asm"," ")
;********************************************************************************************************************
; RUN_PRG_AL=RunProgram("notepad",GpathAL$+"file_al.txt","")
Delay(50)
cpt=0
file_c$=nom_fichier$+".asm - Bloc-notes"
While HNDL_BLOC=0 And cpt<100
cpt+1
HNDL_BLOC=FindTargetPIDByWindowName(file_c$,1)
; Debug _n( HNDL_BLOC)+_s(file_c$)
Delay(50)
Wend
Delay(100)
SetWindowPos_(HNDL_BLOC,#HWND_NOTOPMOST,10,10,Largeur_w/3+50,HAUTEUR_W-50,0) ;:
;********************************************************************************************************************
Else
compil=RunProgram("L:\program files\PUREASM\pureasm.exe" ,chemin$+nom_fichier$+".asm"," ")
; compil=RunProgram("L:\program files\PB520C\PURASM\pureasm.exe",chemin$+nom_fichier$+".asm"," ")
EndIf
If exit_code <>0
MessageRequester("Sortie",Sortie$)
EndIf
EndIf
A+