Jump to content



Photo

Create AutoIt script from batch file help


  • Please log in to reply
4 replies to this topic

#1 SWB

SWB

    Seeker

  • Active Members
  • 14 posts

Posted 27 February 2012 - 01:40 AM

I've been running this batch program from autoit, which runs fine but, want to run completely from autoit.

Attached Files









#2 Aipion

Aipion

    Polymath

  • Banned (NOT IN USE)
  • 200 posts

Posted 27 February 2012 - 02:10 AM

Explain more.


I've been running this batch program from autoit, which runs fine but, want to run completely from autoit.

Do you want to create a full AutoIt Script by running a bat file.

"How do I pass this to my program, so when my program opens I get this result after it runs"
Do you want to create a console app where you will send switches to it.

Edited by Aipion, 27 February 2012 - 02:15 AM.


#3 danwilli

danwilli

    Unbalanced

  • Active Members
  • PipPipPipPipPipPip
  • 1,791 posts

Posted 27 February 2012 - 02:17 AM

I was also confused by the wording.
Perhaps this can help get you started?
AutoIt         
#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $Program = 'C:Program FilesDVDFab 8 Qt' Dim $msg, $fsf Dim $guiHandle = GUICreate("Run DVDFAB", 200, 150) GUICtrlCreateLabel('Destination:' , 5, 5, 190) Dim $Dest = GUICtrlCreateInput("", 5, 20, 165) Dim $Folder = GUICtrlCreateButton( '...', 170, 19, 25, 22) GUICtrlCreateLabel('Year:' , 5, 45, 190) Dim $Year = GUICtrlCreateInput("", 5, 60, 190) GUICtrlCreateLabel('Name:' , 5, 85, 190) Dim $Name = GUICtrlCreateInput("", 5, 100, 190) Dim $dvdfabbutton  = GUICtrlCreateButton("Run DVDFab", 5, 125, 75) Dim $exitbutton = GUICtrlCreateButton("Exit", 120, 125, 75) GUISetState(@SW_SHOW, $guiHandle ) While 1     $msg = GUIGetMsg($guiHandle )     Select         Case $msg == $GUI_EVENT_CLOSE Or $msg = $exitbutton             Exit         Case $msg == $Folder             $fsf = FileSelectFolder('Choose destination folder','')             If Not @error Then GUICtrlSetData($Dest, $fsf)         Case $msg == $dvdfabbutton             RunWait(@ComSpec & " /c " & $Program & 'dvdfab.exe /mode "mainmovie" /src "g:" /dest "' & GUICtrlRead($Dest) & '' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ')' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ').iso" /DISPLAYFORCEDSUB "Yes" /Title "auto" /removemenu "yes" /removepgc "yes" /outdisc "dvd9" /close')             MsgBox(0,'Done',$Program & 'dvdfab.exe /mode "mainmovie" /src "g:" /dest "' & GUICtrlRead($Dest) & '' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ')' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ').iso" /DISPLAYFORCEDSUB "Yes" /Title "auto" /removemenu "yes" /removepgc "yes" /outdisc "dvd9" /close')         Case Default     EndSelect WEnd


#4 SWB

SWB

    Seeker

  • Active Members
  • 14 posts

Posted 27 February 2012 - 02:48 AM

I get this as output

%DEST%%SHOW% (%YEAR%)%SHOW% (%YEAR%).ISO

From this:
#cs ----------------------------------------------------------------------------

AutoIt Version: 3.3.8.1
Author:

Script Function:
Template AutoIt script.

#ce ----------------------------------------------------------------------------

;Script Start - Add your code below here

$answer = InputBox("Question", "What Is The Film Destination?","C:Movies", "")

$filmyear = InputBox("Film Year", "Please Enter The Film Year")

$filmname = InputBox("Film Name", "Please Enter The Film Name")

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Dim $msg
Dim $guiHandle = GUICreate("Run DVDFAB", 200, 60)
Dim $blurbLabel = GUICtrlCreateLabel("Enter Your Choice", 5, 5)
Dim $dvdfabbutton = GUICtrlCreateButton("Run DVDFab", 5, 30, 75)
Dim $exitbutton = GUICtrlCreateButton("Exit", 120, 30, 75)

GUISetState(@SW_SHOW, $guiHandle )
While 1
$msg = GUIGetMsg($guiHandle )

Select
Case $msg == $GUI_EVENT_CLOSE Or $msg = $exitbutton
Exit

Case $msg == $dvdfabbutton

;do dvdfab
;********************************************************************
;RunWait(@COMSPEC & " /c Start fabisog.exe") ; THIS WORKS
;********************************************************************
;ShellExecuteWait("fabisog.exe") ; THIS WORKS
;********************************************************************
RunWait('"C:Program FilesDVDFab 8 QtDVDFab.exe" /mode "mainmovie" /src "g:" /dest "%dest%%show% (%year%)%show% (%year%).iso" /DISPLAYFORCEDSUB "Yes" /Title "auto" /removemenu "yes" /removepgc "yes" /outdisc "dvd5" /close"') ; THIS WORKS
MsgBox(0,"Debug","Program is done!")
;RunWait("fabisog.exe") ; THIS WORKS
;MsgBox(0,"Debug","Program is done!")
;********************************************************************
;RunWait(@COMSPEC & " /c Start fabisog.exe") ; THIS WORKS
;********************************************************************
;RunWait("fabisog.exe") ; THIS WORKS
;MsgBox(0,"Debug","Program is done!")
;********************************************************************





Case Default
EndSelect
WEnd

I want to end up wih this

D:MOVIESMURDER BY DEATH (1980)MURDER_BY_DEATH.ISO

Thanks,

#5 SWB

SWB

    Seeker

  • Active Members
  • 14 posts

Posted 27 February 2012 - 03:50 AM

I was also confused by the wording.
Perhaps this can help get you started?

AutoIt         
#include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) Global $Program = 'C:Program FilesDVDFab 8 Qt' Dim $msg, $fsf Dim $guiHandle = GUICreate("Run DVDFAB", 200, 150) GUICtrlCreateLabel('Destination:' , 5, 5, 190) Dim $Dest = GUICtrlCreateInput("", 5, 20, 165) Dim $Folder = GUICtrlCreateButton( '...', 170, 19, 25, 22) GUICtrlCreateLabel('Year:' , 5, 45, 190) Dim $Year = GUICtrlCreateInput("", 5, 60, 190) GUICtrlCreateLabel('Name:' , 5, 85, 190) Dim $Name = GUICtrlCreateInput("", 5, 100, 190) Dim $dvdfabbutton  = GUICtrlCreateButton("Run DVDFab", 5, 125, 75) Dim $exitbutton = GUICtrlCreateButton("Exit", 120, 125, 75) GUISetState(@SW_SHOW, $guiHandle ) While 1     $msg = GUIGetMsg($guiHandle )     Select         Case $msg == $GUI_EVENT_CLOSE Or $msg = $exitbutton             Exit         Case $msg == $Folder             $fsf = FileSelectFolder('Choose destination folder','')             If Not @error Then GUICtrlSetData($Dest, $fsf)         Case $msg == $dvdfabbutton             RunWait(@ComSpec & " /c " & $Program & 'dvdfab.exe /mode "mainmovie" /src "g:" /dest "' & GUICtrlRead($Dest) & '' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ')' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ').iso" /DISPLAYFORCEDSUB "Yes" /Title "auto" /removemenu "yes" /removepgc "yes" /outdisc "dvd9" /close')             MsgBox(0,'Done',$Program & 'dvdfab.exe /mode "mainmovie" /src "g:" /dest "' & GUICtrlRead($Dest) & '' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ')' & GUICtrlRead($Name) & ' (' & GUICtrlRead($Year) & ').iso" /DISPLAYFORCEDSUB "Yes" /Title "auto" /removemenu "yes" /removepgc "yes" /outdisc "dvd9" /close')         Case Default     EndSelect WEnd

I Thank You, This what I was looking for, short and sweet, I guess I took the long way around. What I was doing was trying to read from the inputbox, which doesn't look like you can do,

Thanks Again,
Regards'
SWB




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users