Sign in to follow this  
Followers 0
michcio

Control Send error :(

6 posts in this topic

hi!

In my program I have a variable $open where I have direction to a .avi file. Now the thing is when I write this:

WinWaitActive("Öppna")
ControlSend("Öppna","","Edit1",$open)

the program waits for the "Öppna" window and then enters my direction (shortcut) into the Edit1 field in the "Öppna" window. It works fine, but sometimes it writes the shortcut totaly wrong in the beginning. Instead of writing C:\ it writes c:? (or something else).

Why is that?

Thankfull for answers!

michcio =)

Share this post


Link to post
Share on other sites



how can?

maybe something wrong with your script.

for more detail, maybe you can post your script here


Sorry 4 Bad English, I'm Indonesian...I'm really need 'Translator' for helping me posting in this forum (http://deeriee.wordpress.com)

Share this post


Link to post
Share on other sites

hi!

In my program I have a variable $open where I have direction to a .avi file. Now the thing is when I write this:

WinWaitActive("Öppna")
ControlSend("Öppna","","Edit1",$open)

the program waits for the "Öppna" window and then enters my direction (shortcut) into the Edit1 field in the "Öppna" window. It works fine, but sometimes it writes the shortcut totaly wrong in the beginning. Instead of writing C:\ it writes c:? (or something else).

Why is that?

Thankfull for answers!

michcio =)

Could it be that CapsLock is active?

Try using ControlSetText() in stead of ControlSend()

:)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

ah will try ControlSetText() then. and here is my whole long script :):

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Array.au3>

$mainwindow = GUICreate("Fixa film", 150, 100,700,400)
$openbutton = GUICtrlCreateButton("Välj din .avi fil", 15, 60, 80, 25)
HotKeySet("{SCROLLLOCK toggle}", "abort")
GUICtrlCreateGroup("PAL-projekt eller inte?", 10, 10, 130, 80)
$pal = GUICtrlCreateCheckbox("PAL",20,30,40,20)
GUISetState(@SW_SHOW)

while True  
    $a = GuiGetMsg()
    If $a = $GUI_EVENT_CLOSE Then
        ExitLoop
    ElseIf $a = $openbutton Then
;fixar i FitCD:
        
        $open = FileOpenDialog("Håll nere SHIFT eller CTRL för att välja flera filer", "D:\","Avi files (*.avi)")
        $vald = ControlCommand("Fixa film", "PAL",$pal, "IsCHecked", "")
        $avs = $open & ".avs"
        
;tar ut den sista arrayen från arrayen som består av shortcuten uppdelad mha "\"
        $array = StringSplit($avs, "\")
        Global $avs2 = _ArrayPop($array)
        
        if $open = "" Then
            MsgBox(0,"VARNING","Du valde ingen .avi fil!!")
        Else
            
;FitCD
            Run("D:\DVD-making Program\FitCD.exe","D:\DVD-making Program")
            WinWaitActive("FitCD")
            WinSetState("FitCD","",@SW_MAXIMIZE)
            MouseClick("main",20,260,1)
            WinWaitActive("Öppna")
            ControlSend("Öppna","","Edit1",$open)
            Send("{ENTER}")
            if $vald = 1 Then
                ControlCommand("FitCD","PAL", "TCheckBox6", "Check", "")
            Else 
                ControlCommand("FitCD","PAL", "TCheckBox6", "UnCheck", "")
            EndIf
            MouseClick("main",500,550,1)
            WinWaitActive("Spara som")
            Send("{ENTER}")
            WinClose("FitCD")
            WinWaitClose("FitCD")
            
;HCEnc
            Run("D:\DVD-making Program\HC023\HCgui_023.exe","D:\DVD-making Program\HC023")
            WinWaitActive("  HCgui 0.23")
            
;selectar min .m2v fil =)
            selecta(7,"input",$avs,"")
            
;Selectar m2v's output
            selecta(8,"output", $open,".m2v")

;Selectar log output
            selecta(9,"log",$open,".log")
            
;encodar
            ControlClick("  HCgui 0.23", "", "Button147")
            if WinWait("HC message","",2)=1 Then
                Send("{ENTER}")
            EndIf
            WinWait("  HCenc 0.23")
            
;VirtualDub
            Run("D:\DVD-making Program\virutaldub\VirtualDubMod.exe","D:\DVD-making Program\virutaldub\",@SW_MAXIMIZE)
            WinWaitActive("VirtualDubMod 1.5.10.2 (build 2540/release) [Based on VirtualDub 1.5.10 by Avery Lee]")
            Send("{CTRLDOWN}")
            Send("{o}")
            Send("{CTRLUP}")
            WinWaitActive("Open video file")
            Send($avs)
            Send("{ENTER}")
            WinWaitClose("Open video file")
            MouseClick("",150,20)
            MouseClick("",150,100)
            WinWait("Available streams")
            MouseClick("right",150,100)
            MouseClick("",160,280)
            ControlClick("Available streams", "", "Button7")
            WinWaitActive("Save WAV File")
            ControlSend("Save WAV File", "", "Edit1", $open & ".wav")   
            Send("{ENTER}")
            if WinWait("Bekräfta Spara som","",2)=1 Then
                Send("{LEFT}")
                Send("{ENTER}")
            EndIf
            WinWaitClose("Save WAV File")
            ControlClick("Available streams", "", "Button1")
            WinWaitClose("Available streams")
            Send("{F4}")
            WinWaitActive("VirtualDubMod Job Control")
            ControlClick("VirtualDubMod Job Control","","Button6")
            WinWaitActive("VirtualDubMod Status - [" & $avs2 & "]")
            WinWaitClose("VirtualDubMod Status - [" & $avs2 & "]")
            WinClose("VirtualDubMod Job Control")
            WinClose("VirtualDubMod 1.5.10.2")
            WinWaitClose("VirtualDubMod Job Control")
            WinWaitClose("VirtualDubMod 1.5.10.2")
            
;ffmpegui
            Run("D:\DVD-making Program\ffmpeggui03c\ffmpeggui.exe","D:\DVD-making Program\ffmpeggui03c")
            WinWaitActive("ffmpegGUI Beta Build 3")
            ControlClick("ffmpegGUI Beta Build 3", "", "TButton2")
            WinWaitActive("Öppna")
            ControlSend("Öppna","","Edit1",$open & '.wav')
            Send("{ENTER}")
            WinWaitClose("Öppna")
            ControlClick("ffmpegGUI Beta Build 3", "", "TButton1")
            WinWaitActive("Spara som")
            ControlSend("Spara som","","Edit1",$open & ".ac3")
            Send("{ENTER}")
            WinWaitClose("Spara som")
            ControlClick("ffmpegGUI Beta Build 3", "", "TButton3")
            WinWaitActive("ffmpegGUI Message")
            ControlClick("ffmpegGUI Message", "", "Button1")
            WinWaitClose("ffmpegGUI Message")
            WinClose("ffmpegGUI Beta Build 3")
            WinWaitClose("ffmpegGUI Beta Build 3")
            
;väntar till söliga HCEnc blir klar
            WinWaitClose("  HCenc 0.23")
            WinWaitActive("  HCgui 0.23")
            WinClose("  HCgui 0.23")
            WinWaitClose("  HCgui 0.23")
            WinClose("Fixa film")
        EndIf

    EndIf
WEnd

Func selecta($buttonNr, $type, $string,$end)
    ControlClick("  HCgui 0.23", "", "Button" & $buttonNr)
    WinWaitActive("select " & $type & " file")
    ControlSend("select " & $type & " file", "", "Edit1", $string & $end)   
    Send("{ENTER}")
    WinWaitClose("select " & $type & " file")
EndFunc

Func abort()
;stänger HCEnc!!
    WinClose("  HCenc 0.23")
    ControlClick("HC message","","Button1")
    WinWaitClose("  HCenc 0.23")
    WinClose("  HCgui 0.23")
    
;stänger min ruta och andra möjliga program!
    WinClose("Fixa film")
    WinClose("VirtualDubMod Status - [" & $avs2 & "]")
    WinClose("VirtualDubMod Job Control")
    WinCLose("FitCD")
    WinClose("VirtualDubMod 1.5.10.2")
    Send("{ENTER}")
    Exit(0)
EndFunc
Edited by michcio

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

ControlSetText() works much better. Instead of "writing" the text it inputs it directly while the window appears! :)

will test if I get same error again

Edited by michcio

Share this post


Link to post
Share on other sites

ControlSetText() works perfectly I think m,y error accuered because of CAPS LOCK like you said. THANKS!!

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  
Followers 0