Jump to content
Sign in to follow this  
Kurto2021

pause question

Recommended Posts

Kurto2021

Hey Melba is there any way to pause is a program other than sleep? I have a program where I have to send a key command to the program at least 1 time per hour or it will time out. If I use sleep then I can't exit out of the program. I was going to use a loop but figured that would overload the CPU.

Share this post


Link to post
Share on other sites
somdcomputerguy

Kurto2021 - you shouldn't hijack a thread to ask an unrelated question.. Start a new topic.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Melba23

Kurto2021,

You might like to look at AdlibRegister - this will let you run a function after a specified delay and sounds like just what you need: :mellow:

HotKeySet("{ESC}", "On_Exit") ; Press ESC to exit

AdlibRegister("Func_1", 1000) ; Run the function every second

While 1
    Sleep(10)
WEnd

Func Func_1()
    ; Write to the SciTE console
    ConsoleWrite("Adlib running at " & @SEC & @CRLF)
EndFunc

Func On_Exit()
    Exit
EndFunc

But as you can see you still need a loop to keep the script active - and you still need a Sleep(10) in there to save your CPU! :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Kurto2021

Okay maybe I am not getting this but here is what I have.

If $duration > 3600000 Then
    $duration = $duration - 3600000
    WinActivate("Sirius XM")
    Send("{Space}")
Else
    Sleep ($duration)
    $duration = 0
    WinClose("Sirius XM")
EndIf

Essentially I calculated how many minutes a program is to record...I have to send a space bar ever hour to keep it from timing out. I put in the Adlibregister but I am not sure how to say run it for an hour then exit out of it.

Edited by Kurto2021

Share this post


Link to post
Share on other sites
MvGulik

Suggest you read the documentation on the AdlibRegister() function, and report back with what you (specifically) don't get about the AdlibRegister() function use. (unless you like to wait for Mel, which might take a while though.)

O. And how about starting to use the forum

or [autoit] tags to post your code in those nice code boxes.

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
Kurto2021

Suggest you read the documentation on the AdlibRegister() function, and report back with what you (specifically) don't get about the AdlibRegister() function use. (unless you like to wait for Mel, which might take a while though.)

O. And how about starting to use the forum

or [autoit] tags to post your code in those nice code boxes.

You don't think I have spent some time reading it? I get into the adlib code but I don't know how to get out of it.

Share this post


Link to post
Share on other sites
MvGulik

You don't think I have spent some time reading it?

Something like that yes.

I get into the adlib code but I don't know how to get out of it.

And I still do, as you seem to have missed the item that is listed under the Related section of AdlibRegister. As that item seems directly related to the problem of not knowing how to Stop a Started Adlib process.

AdlibRegister()

AdlibUnRegister()


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
Kurto2021

Something like that yes.

And I still do, as you seem to have missed the item that is listed under the Related section of AdlibRegister. As that item seems directly related to the problem of not knowing how to Stop a Started Adlib process.

AdlibRegister()

AdlibUnRegister()

I have unregistered but then the code just hangs....

PS try helping

Share this post


Link to post
Share on other sites
MvGulik

I have unregistered but then the code just hangs....

And what code might that be ... :mellow:

PS try helping

I'm trying to help you. By trying to get you to post more information, so its less of a trial and error process or guessing game in trying to figure out what it is your missing in your knowledge in relation to coding and AutoIt.

(And I do that in my own way. Suggest you wait for Mel, or other forum users, if you don't like my way. And you know what. The moment you start providing more useful information about your problem you seriously increase the change some other forum users will jump in.)

So ... Do you like me to make a other suggestion about what you might like to do in your next post. Or do you think you can figure that one out on your own.

... And if you still don't know how to post code into code boxes (as so far I have not seen any hints or proof otherwise) ... Consider asking, instead of just ignoring the request.

GL. As I think I'm taking a break from you until I see some improvements.


"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
Melba23

Kurto2021,

I put in the Adlibregister

So where is your code setting AdlibRegister to run a function? :mellow:

We help you develop your own code, not write it for you. So over to you to show what you have got so far and why you think it does not do what you want. :)

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
Kurto2021

I was able to get it to work with a simple message box that just says the script is paused. Hit ok to cancel.

Share this post


Link to post
Share on other sites
Melba23

Kurto2021,

Delighted you got it working to your satisfaction. :mellow:

M23


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  

×