Sign in to follow this  
Followers 0
Champak

sleep jump

12 posts in this topic

I cannot lie, I have not done a search on this because I really don't know what to search for what I want.

I have a timer that counts down in a save dialogue. When timer hits 0 it automatically goes to the next step. As it is, the person cannot press Save/Enter, they have to wait for the count down to finish. I would like it if they pressed enter or clickd the save button, the timer would automatically end, or the script would jump to the next or a specified part in the script. Can this happen?

I'm probobly WAY off, but this is what I have tried so far:

$time = $settings17
$step = 100 / $settings17
ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
For $i = 0 To 100 Step $step
  $time = $time - 1
  Sleep(1000)
  ProgressSet($i, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
  If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)

;=======================================I tried both of the following
;      If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then $time - $time
;
;OR
;
;      If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then $i = 0
;=======================================

Next
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)

Thanks.

Share this post


Link to post
Share on other sites



HI,

build a loop until timer = 0 or $button was clicked Then next step.

Hope that helps.

So long,

MEga


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

Thanks, but that is not working for me.

1/ The until is not working because using that I can't get the bar to go all the way to the end....probobly because I have to cut out the "$i = 0 To 100 Step $step" because of an error.

2/ I don't know how the $button is going to work because the button is not a part of the GUI, it is a save dialogue in another program. That is why I used the control command.

This is how I've tried it:

$time = $settings17
$step = 100 / $settings17
ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
Do 
;   $i = 0 To 100 Step $step
  $time = $time - 1
  Sleep(1000)
  ProgressSet($step, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
  If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then $time=0
Until $time=0
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)

Any other directions?

Share this post


Link to post
Share on other sites

Check the helpfile for "HotKeySet".

Share this post


Link to post
Share on other sites

Check the helpfile for "HotKeySet".

Check the helpfile for adlibenable and/or _ispressed. Not sure where the Save/Enter come into your script...

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

Share this post


Link to post
Share on other sites

...I would like it if they pressed enter or clickd the save button, the timer would automatically end, or the script would jump to the next or a specified part in the script...

In the code in your first post, change this line:

If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then $i = 0

to:

If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then ExitLoop

or to what you I think that you were going for:

If ControlCommand("Export Audio Mixdown in", "Look in:", 1, "IsChecked", "") = 1 Then $i = 100

If that does not work for you, then check your assumptions and coding in that ControlCommand by replacing the "ExitLoop" above with a MsgBox for debugging. (Or a ConsoleWrite if you are so inclined).

If you cannot find a condition to trigger an ExitLoop using ControlCommand, then consider:

If WinExists... Then ExitLoop

or

If Not WinExists... Then ExitLoop

...or maybe I don't understand your request...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Here's a funny story. Herewasplato, your assumption of what I want to do is correct. The funny thing is, your suggestion of what to do with the "not winexist", I did it already way back when, and achieved exactly what I was trying to do for the past day or so with this exact part of the script.....but there was a problem and I

scraped it because I couldn't figure out how to solve it and apparantly forgot all about this attempt until now I'm in it again.

Life is a full circle. Let's sing "The circle of life."

So I guess, let's try to solve the problem that I was having then and now. Right after the loop, there is an "{ENTER}" send. So when the timer reaches "0" the "enter" is sent to save in the dialogue. This particular part has to stay, however, if someone does press enter and exits the window, that "{ENTER}" send is still going to happen, and it interfears with the next/rest of the script. So basically, I don't think winexist or commandcontrol will work for me, and is there a way to "jump" to another, or "jump" over a particular step "If" something happens?

This is what it looks like:

$time = $settings17
$step = 100 / $settings17
ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
For $i = 0 To 100 Step $step
  $time = $time - 1
  Sleep(1000)
  ProgressSet($i, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
  If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
    If Not WinExists("Export Audio Mixdown in", "File name:") Then ExitLoop
Next
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)
        
    Send($keybindings19) ;-N----Enter: Save---start mixdown;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    WinWaitClose("Export Audio Mixdown in", "File name:");;;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    Sleep($sleep15);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    
;;;;;;;;;;;;;;;;;;;;This is where it needs to jump to if the enter is pressed and the window exits
    
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
            Sleep($sleep17)
            Send($keybindings19)
            Sleep($sleep19)
        EndIf
        
        WinWaitClose("Export Audio", "Abort")
        Sleep($sleep21)

jefhal, the Save/Enter just means if they press the save button or press the enter on the keyboard.

Is this possible?

Thanks.

Edited by Champak

Share this post


Link to post
Share on other sites

Here's a funny story. Herewasplato, your assumption of what I want to do is correct. The funny thing is, your suggestion of what to do with the "not winexist", I did it already way back when, and achieved exactly what I was trying to do for the past day or so with this exact part of the script.....but there was a problem and I

scraped it because I couldn't figure out how to solve it and apparantly forgot all about this attempt until now I'm in it again.

Life is a full circle. Let's sing "The circle of life."

So I guess, let's try to solve the problem that I was having then and now. Right after the loop, there is an "{ENTER}" send. So when the timer reaches "0" the "enter" is sent to save in the dialogue. This particular part has to stay, however, if someone does press enter and exits the window, that "{ENTER}" send is still going to happen, and it interfears with the next/rest of the script. So basically, I don't think winexist or commandcontrol will work for me, and is there a way to "jump" to another, or "jump" over a particular step "If" something happens?

This is what it looks like:

$time = $settings17
$step = 100 / $settings17
ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
For $i = 0 To 100 Step $step
  $time = $time - 1
  Sleep(1000)
  ProgressSet($i, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
  If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
    If Not WinExists("Export Audio Mixdown in", "File name:") Then ExitLoop
Next
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)
        
    Send($keybindings19) ;-N----Enter: Save---start mixdown;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    WinWaitClose("Export Audio Mixdown in", "File name:");;;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    Sleep($sleep15);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;This must be "jumped" if enter is pressed and window exits
    
;;;;;;;;;;;;;;;;;;;;This is where it needs to jump to if the enter is pressed and the window exits
    
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
            Sleep($sleep17)
            Send($keybindings19)
            Sleep($sleep19)
        EndIf
        
        WinWaitClose("Export Audio", "Abort")
        Sleep($sleep21)

jefhal, the Save/Enter just means if they press the save button or press the enter on the keyboard.

Is this possible?

Thanks.

Have you thought of capturing the "{ENTER}" pressed by the user and not let it through to the application?

Using _IsPressed()

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Try this...

;==============BEGIN SNIPPET====================
;This is just a code snippet that should be at the top of the script
Global $bSkip = 0
Global $bInProcess = 0
;==============END SNIPPET======================

;==============BEGIN SNIPPET====================
;This is just a code snippet that should be in your GUI While Loop
Case $msg = $saveButton
    If $bInProcess Then
        _Nada()
    Else
        ;Your normal $saveButton
    EndIf
;==============END SNIPPET======================

HotKeySet("{ENTER}", "_Nada") ;Set HotKey to set global boolean variable

$bInProcess = 1
$time = $settings17
$step = 100 / $settings17
ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
For $i = 0 To 100 Step $step
  $time = $time - 1
  Sleep(1000)
  ProgressSet($i, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
  If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
    If Not WinExists("Export Audio Mixdown in", "File name:") Then ExitLoop
Next
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)

;Reset boolean value for next time around.
$bInProcess = 0

HotKeySet("{ENTER}", "")
;If either Save or Enter has been pressed skip this section.
If $bSkip Then
    ;Nada
Else
    Send($keybindings19)
    WinWaitClose("Export Audio Mixdown in", "File name:")
    Sleep($sleep15)
EndIf
;Reset boolean value for next time around.
$bSkip = 0
   
        If WinExists("Nuendo", "Do you want to replace") Then
            Send($keybindings19) ;Enter
            Sleep($sleep17)
            Send($keybindings19)
            Sleep($sleep19)
        EndIf
       
        WinWaitClose("Export Audio", "Abort")
        Sleep($sleep21)

Func _Nada()
    $bSkip = 1
EndFunc

Edit: Changed code to better fit description given over AIM.

I hope the above helps...

JS

Edited by JSThePatriot

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

how about:

$time = $settings17
$step = 100 / $settings17

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Jump_flag = 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

ProgressOn("Format And Import Options", "Time to enter format/import settings.", "Please wait.", "50", "50", "16")
For $i = 0 To 100 Step $step
    $time = $time - 1
    Sleep(1000)
    ProgressSet($i, $time & " seconds left. Please wait." & @CRLF & @CRLF & "DO NOT press Save/Enter.")
    If $time < 10 Then Run(@ComSpec & " /c echo " & Chr(7), "", @SW_HIDE)
    
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    If Not WinExists("Export Audio Mixdown in", "File name:") Then
        $Jump_flag = 1
        ExitLoop
    EndIf
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Next
ProgressSet(100, "Done", "Complete")
Sleep($sleep1)
ProgressOff()
Sleep($sleep1)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
If $Jump_flag <> 1 Then
    Send($keybindings19)
    WinWaitClose("Export Audio Mixdown in", "File name:")
    Sleep($sleep15)
EndIf
;;;;;;;;;;;;;;;;;;;;This is where it needs to jump to if the enter is pressed and the window exits

If WinExists("Nuendo", "Do you want to replace") Then
    Send($keybindings19) ;Enter
    Sleep($sleep17)
    Send($keybindings19)
    Sleep($sleep19)
EndIf

WinWaitClose("Export Audio", "Abort")
Sleep($sleep21)
Edit: I do not think that you want to skip the ProgressOff() lines... but you can move the "If line" above them if you wish.

Edit2: Changed to 1 or 0 for the Jump_flag value...

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Thanks for both of your efforts, herewasplato's code is the one that is so far working for me. Just have to test out a few other things to make sure everything is working well together.

Thanks.

Share this post


Link to post
Share on other sites

Thanks for both of your efforts, herewasplato's code is the one that is so far working for me. Just have to test out a few other things to make sure everything is working well together.

Thanks.

Once it's working, please post your final code if you would... :D

...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format

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