Jump to content

while in while


ficofico
 Share

Recommended Posts

Hi huys, i'm not a programmer and I need aid...

I've make a gui with autoit , and all works well:

Posted Image

The "START WINDOWS" button its $winnormalebutton, and it will start many dos program like mencoder, x264, mp4box ecc ecc. Here a sample of the script:

while 1
         $msg = GUIGetMsg()
        select  
            
        
            
       case  $msg = $GUI_EVENT_CLOSE 
            exitloop

            
        [b]case $msg = $winnormalebutton[/b] 
            
            
        
        $cartella2 = FileOpen("cartella2.txt", 0)
        $cartella =  FileReadLine($cartella2)
        $delay2 = FileOpen("delay.txt", 0)
        $delay =  FileReadLine($delay2)
        $end2 = FileOpen("end.txt", 0)
        $end =  FileReadLine($end2)
        $start2 = FileOpen("start.txt", 0)
        $start =  FileReadLine($start2)
    
    filedelete ("C:\Programmi\Rigenerator-program\rigenerator2\*.mp4")
    filedelete ($cartella &"\*.*")
    
    FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\cartella\*.mp4", "C:\Programmi\Rigenerator-program\rigenerator2\originale.mp4", 8)
    FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\istruzioniwin640.avs", $cartella &"\istruzioniwin640.avs", 8) 
    FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\x264.exe", $cartella &"\x264.exe", 8) 
    FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\batx264.bat", $cartella &"\batx264.bat", 8) 
    
            

runwait("mencoder.bat","c:\Programmi\Rigenerator-program\rigenerator2",@SW_minimize) 
    

    
runwait("batx264.bat",$cartella,@SW_minimize )

ecc ecc..

Now I want to modify my program like this. when I click $winnormalebutton , the gui have to change like this( it's only an example)

Posted Image

I think that i need to work inside the while, but I'm a very beginner user of autoit and i'm not a programer. Below I've write a simple ( incorrect) script for understanding what i want to do:

while 1

$msg = GUIGetMsg()

select

case $msg = $GUI_EVENT_CLOSE

exitloop

case $msg = $winnormalebutton

$cartella2 = FileOpen("cartella2.txt", 0)

$cartella = FileReadLine($cartella2)

$delay2 = FileOpen("delay.txt", 0)

$delay = FileReadLine($delay2)

$end2 = FileOpen("end.txt", 0)

$end = FileReadLine($end2)

$start2 = FileOpen("start.txt", 0)

$start = FileReadLine($start2)

filedelete ("C:\Programmi\Rigenerator-program\rigenerator2\*.mp4")

filedelete ($cartella &"\*.*")

FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\cartella\*.mp4", "C:\Programmi\Rigenerator-program\rigenerator2\originale.mp4", 8)

FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\istruzioniwin640.avs", $cartella &"\istruzioniwin640.avs", 8)

FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\x264.exe", $cartella &"\x264.exe", 8)

FileCopy("C:\Programmi\Rigenerator-program\rigenerator2\batx264.bat", $cartella &"\batx264.bat", 8)

runwait("mencoder.bat","c:\Programmi\Rigenerator-program\rigenerator2",@SW_minimize)

while 2

$stopexecutionbutton = GUICtrlCreateButton("stopexecution button", 400, 300, 100, 20)

$runningmencoderbutton = GUICtrlCreateButton("It's running mencoder", 400, 300, 100, 20)

$msg = GUIGetMsg()

select

case $stopexecutionbutton

exitloop

processclose("mencoder.exe")

processclose("x264.exe")

processclose("mp4box.exe")

endselect

wend

runwait("batx264.bat",$cartella,@SW_minimize )

ecc ecc..

I know that it's completely wrong, but I've tried hundred of possible combination, outside and inside the while, and when the button it's played there's no way to use the gui for do work, only uf i stop the process of $winnormalebutton the gui respond

thank.

Link to comment
Share on other sites

Hey not a programmer either, but this is the post that helped me change my coding for the better. (removing button monitoring from while statements)

http://www.autoitscript.com/forum/index.php?showtopic=50412

btw -using this method with functions, my current project has 1000+ lines and only three of them are in my while statement.

Edited by Hatcheda
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...