Page 1 sur 1
[R] Envoyer variable(s) + ligne de commande à AutoIt
Posté : sam. 12 févr. 2011 14:04
par Anthony
Bonjour à tous et merci d'avance pour votre aide
Ceci est mon deuxième post et j'aurai besoin d'ajouter une variable à ma ligne de commande.
Cette variable qui devrait renvoyer les informations à la fenêtre MMBTitle est:

Et ma ligne de commande:
Code : Tout sélectionner
$cmd = '"C:\Program Files (x86)\RipBot264\tools\avs2yuv\pipebuf.exe" "C:\Program Files (x86)\RipBot264\tools\avs2yuv\avs2yuv.exe" "D:\temp\RipBot264temp\job1\job1.avs" - : "C:\Program Files (x86)\RipBot264\tools\x264\x264_x64.exe" --pass 1 --bitrate 852 --stats "D:\temp\RipBot264temp\job1\job1.stats" --fps 50 --force-cfr --min-keyint 50 --keyint 500 --frames 2000 --sar 1:1 --level 4.0 --aud --nal-hrd vbr --vbv-bufsize 25000 --vbv-maxrate 25000 --filter 0,0 --ref 3 --bframes 3 --b-adapt 2 --b-pyramid none --subme 7 --aq-mode 1 --trellis 2 --partitions all --me umh --stdin y4m --output "D:\temp\RipBot264temp\video.264" - : 2'
Le but étant de récupérer une ou plusieure(s) variable(s) pour AutoIt + la ligne de commande à lancer
Mon code complet:
► Afficher le texte
Code : Tout sélectionner
#NoTrayIcon
#include <file.au3>
#include<Constants.au3>
#include<GUIConstantsEx.au3>
#include<WindowsConstants.au3>
#include <MMBLib.au3>
#include <WinAPI.au3>
; Change into the WinTitleMatchMode that supports classnames and handles
AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("WinSearchChildren", 1)
; get the string from commandline
$cmd = $CmdLine[1]
#$cmd = '"C:\Program Files (x86)\RipBot264\tools\avs2yuv\pipebuf.exe" "C:\Program Files (x86)\RipBot264\tools\avs2yuv\avs2yuv.exe" "D:\temp\RipBot264temp\job1\job1.avs" - : "C:\Program Files (x86)\RipBot264\tools\x264\x264_x64.exe" --pass 1 --bitrate 852 --stats "D:\temp\RipBot264temp\job1\job1.stats" --fps 50 --force-cfr --min-keyint 50 --keyint 500 --frames 2000 --sar 1:1 --level 4.0 --aud --nal-hrd vbr --vbv-bufsize 25000 --vbv-maxrate 25000 --filter 0,0 --ref 3 --bframes 3 --b-adapt 2 --b-pyramid none --subme 7 --aq-mode 1 --trellis 2 --partitions all --me umh --stdin y4m --output "D:\temp\RipBot264temp\video.264" - : 2'
; Atribute the MMB Title
#$MMBTitle = 'MMBTitle'
$ConsoleWindowClassTmpParam = "Title$='Go...'"
SendScriptMMB($MMBTitle, $ConsoleWindowClassTmpParam)
$PID = Run(@ComSpec, "", @SW_SHOW)
Sleep(1000)
; Get the handle of a cmd.exe window (from its classname)
$ConsoleWindowClass = WinGetTitle("classname=ConsoleWindowClass", "")
$ConsoleWindowClass = stringreplace($ConsoleWindowClass,@LF,"")
Opt("SendKeyDownDelay", 1)
Opt("SendKeyDelay", 1)
$cmd = $cmd & @CR & 'pause' & "{ENTER}"
ControlSend("[CLASS:ConsoleWindowClass]", "", "", $cmd)
While 1
; Get the handle of a cmd.exe window (from its classname)
$ConsoleWindowClassTmp = WinGetTitle("classname=ConsoleWindowClass", "")
$ConsoleWindowClassTmp = stringreplace($ConsoleWindowClassTmp,@LF,"")
; get the length of obtained $ConsoleWindowClassTmp
$Len=StringLen($ConsoleWindowClassTmp)
If @error Then ExitLoop
If $ConsoleWindowClassTmp = $ConsoleWindowClass & ' - pause' Then
$ConsoleWindowClassTmpParam = "Title$='Done...'"
SendScriptMMB($MMBTitle, $ConsoleWindowClassTmpParam)
$cmd = "{ENTER}" & 'exit' & "{ENTER}"
ControlSend("[CLASS:ConsoleWindowClass]", "", "", $cmd & "{ENTER}")
exit
EndIf
If $ConsoleWindowClassTmp = '0' Then
$ConsoleWindowClassTmpParam = "Title$='Error...'"
SendScriptMMB($MMBTitle, $ConsoleWindowClassTmpParam)
exit
EndIf
If $Len < '80' Then
$ConsoleWindowClassTmpParam = "Title$='" & $ConsoleWindowClassTmp & "'"
SendScriptMMB($MMBTitle, $ConsoleWindowClassTmpParam)
Else
$ConsoleWindowClassTmpParam = "Title$='Script Runing...'"
SendScriptMMB($MMBTitle, $ConsoleWindowClassTmpParam)
EndIf
Sleep(50)
WEnd
Re: [..] Envoyer variable(s) + ligne de commande à AutoIt
Posté : lun. 21 févr. 2011 07:57
par Anthony
Résolu
Code : Tout sélectionner
#$cmd = 'MMBTitle||50||"Programme.exe"'
$cmd = $CmdLine[1]
$CmdVar = StringSplit($cmd, "||", 1)
$MMBTitle = StringSplit($CmdVar[1], "||")
$MMBTitle = $MMBTitle[1]
$Timer = StringSplit($CmdVar[2], "||")
$Timer = $Timer[1]
$cmd = StringSplit($CmdVar[3], "||")
$cmd = $cmd[1]
MsgBox(0, "MMBTitle is:", $MMBTitle)
MsgBox(0, "Timer is:", $Timer)
MsgBox(0, "cmd is:", $cmd)
Discution suivie ici:
http://autoitscript.fr/forum/viewtopic. ... 523#p44523