Jump to content

Keep Script running in INACTIVE window


Recommended Posts

How can I keep the script running if another window pops up?

the exact command would be appreciated. This is what I've tried

after the enter command. standard command prompt in windows fyi.

controlsend ("Windows Command Processor")

controlsend ("{Windows Command Processor}")

;Ronnie K.

;Par and Rar Removal

;12.27.2012

Send ("#r")

sleep (1000)

send ("cmd")

sleep (2000)

send ("{enter}")

SLEEP (2000)

send ("D:")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.RAR /S")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.PAR /S")

send ("{enter}")

SLEEP (2000)

send ("E:")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.RAR /S")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.PAR /S")

send ("{enter}")

SLEEP (2000)

send ("F:")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.RAR /S")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.PAR /S")

send ("{enter}")

SLEEP (2000)

send ("G:")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.RAR /S")

SLEEP (2000)

send ("{enter}")

SLEEP (2000)

SEND ("DEL *.PAR /S")

send ("{enter}")

SLEEP (5000)

SEND ("EXIT")

send ("{enter}")

SLEEP (2000)

ParRarRemoval.au3

Link to comment
Share on other sites

Hello!

Instead of using a "cmd" interface for deleting file, you can use an autoit function for this called FileDelete

Try this:

Filedelete("D:\*.RAR")
Filedelete("D:\*.PAR")

Filedelete("E:\*.RAR")
Filedelete("E:\*.PAR")

Filedelete("F:\*.RAR")
Filedelete("F:\*.PAR")

Filedelete("G:\*.RAR")
Filedelete("G:\*.PAR")

This will work even if another window will pops up!

Link to comment
Share on other sites

You can do that in pure autoit:

Dim $aDevice[4] = ["D", "E", "F", "G"] ;If you have other drive just add the letter here

For $i = 0 To UBound($aDevice) - 1
    If DriveStatus($aDevice[$i] & ":\") <> "READY" Then ContinueLoop ;If drive is not ready or not exist just continue loop
    ConsoleWrite($aDevice[$i] & @CRLF) ;Debug only
    FileDelete($aDevice[$i] & ":\*.rar")
    FileDelete($aDevice[$i] & ":\*.par")
Next

MsgBox(0, "Done", "It's all ok!")

Hi!

My UDF: NetInfo UDF Play with your network, check your download/upload speed and much more! YTAPI Easy to use YouTube API, now you can easy retrive all needed info from a video. NavInfo Check if a specific browser is installed and retrive other usefull information. YWeather Easy to use Yahoo Weather API, now you can easily retrive details about the weather in a specific region. No-IP UDF Easily update your no-ip hostname(s).

My Script: Wallpaper Changer Change you wallpaper dinamically, you can also download your wallpaper from your website and share it with all!   My Snippet: _ImageSaveToBMPConvert an image to bmp format. _SciteGOTO Open a file in SciTE at specific fileline. _FileToHex Show the hex code of a specified file

Link to comment
Share on other sites

First and Foremost, thank you for helping a newbie like me, I sincerely appreciate it.

how about this : ( a better example of the window issue:)

WinActivate ("BMC Remedy User - [incident (New)]")

WinWaitActive ("BMC Remedy User - [incident (New)]")

SLEEP (1000)

SEND ("+{TAB 11}")

SLEEP (2000)

Send ("U")

Send ("U")

SEND ("{ENTER}")

If something else pops up and takes away focus, what command will either pause the script until the window is active again or will re force that window to become active?

Link to comment
Share on other sites

  • Moderators

Take a look at ControlSend in the help file. It is much more reliable than Send, and doesn't rely on the window being active.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

RonnieK,

Take a look at ControlSend in the help file

Have you? :huh:

I think not because if you do so it will be obvious that the syntax of your call is wrong - and also what the other parameters should be. ;)

So go and read the Help file now - and come back if you have specific questions on the parameters. :)

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

 

Link to comment
Share on other sites

RonnieK,

Have you? :huh:

I think not because if you do so it will be obvious that the syntax of your call is wrong - and also what the other parameters should be. ;)

So go and read the Help file now - and come back if you have specific questions on the parameters. :)

M23

I searched the help file, searched google AND spent an hour trying to figure it out by myself BEFORE my original post. I obviously am stuck and asked for assistance.

Just because something is obvious to you ( 15,000 posts + i'll assume you're fairly good with autoit) doesn't mean it is to everyone.

The issue isn't so much the syntax as I'm not 100% sure if Control send is the right command to keep a window active.

I found SendKeepActive ("BMC Remedy User - [incident (New)]") Which keeps the window active (the answer to my original question)

now I've moved on to running the script in an inactive window.

I have been tinkering with autoit for maybe 5 hours total. Melba 23 -Thank you for absolutely nothing.

To everyone else, a sincere thanks and appreciation.

Link to comment
Share on other sites

  • Moderators

RonnieK,

Stop acting the martyr - it is patently obvious that you have not even looked at the Help file for that command or you would not have tried to use:

Control Send ("+{TAB 11}")

as it bears no resemblance at all to the syntax required for ControlSend - you do not need many posts at all to realise that. ;)

I'm not 100% sure if Control send is the right command to keep a window active

Did you even read what JLogan3o13 said above? Let me repeat it for you:

"Take a look at ControlSend in the help file. It is much more reliable than Send, and doesn't rely on the window being active"

So I suggest you stop acting all injured and go read about ControlSend. if you have questions about the necessary syntax for the command or about how you find the parameter values, then do please ask again. :)

M23

Edited by Melba23
Typos

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

 

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...