Jump to content

ControlCommand's FindString & SysListView321 Issue


gilk
 Share

Recommended Posts

Hello fellow AutoITers

Ive been trying to automate the creation of a scheduled task..

To do that I want to verify that the task doesnt already exist,

So I tried searching the list of scheduled tasks with the following:

$exist=ControlCommand("Scheduled Tasks","","SysListView321", "FindString", "My Task")

sleep(1000)

MsgBox ( 1, "kuku", $exist ,10 )

But no matter if the task exists or not and where it is in the list of tasks, the returned value is always 1

Ideas anyone ?

gilk

Link to comment
Share on other sites

Not exactly the answer you're looking for, but under XP (and I assume 2k3), you could use the command line utility SCHTASKS. Win2K and above also has the AT command, but it's no where near as powerful. Check (gasp) XP's HELP for details on SCHTASKS or simply type SCHTASKS at a command line.

Link to comment
Share on other sites

Not exactly the answer you're looking for, but under XP (and I assume 2k3), you could use the command line utility SCHTASKS.  Win2K and above also has the AT command, but it's no where near as powerful.  Check (gasp) XP's HELP for details on SCHTASKS or simply type SCHTASKS at a command line.

<{POST_SNAPBACK}>

Thanks for the advice but I'm working with a Win2K network (800 clients) and the AT command is not strong enough for the required options

gilk

Link to comment
Share on other sites

  • 3 months later...

Thanks for the advice but I'm working with a Win2K network (800 clients) and the AT command is not strong enough for the required options

gilk

<{POST_SNAPBACK}>

If you're running from an XP (or I assume it's available on a Win2k3 server too), you can use schtasks to query a remote Win2k computer:

schtasks /query /S remotecomputer /U user /P password

where user and password are the user ID and password for the remote computer with sufficient rights to perform the operation if needed.

The output would be something like this (and could be redirected to a text file for reading):

TaskName Next Run Time Status

======== ============ ===============

Task1 At system start up

Task2 At logon time

Task3 Never Could not start

and possibly even use it to create the task if needed. See XP/2K3 help for details.

Also, tasks are saved as .job files under @WindowsDir\Tasks, so from the list above you'd have:

@WindowsDir\Tasks\Task1.job

@WindowsDir\Tasks\Task2.job

@WindowsDir\Tasks\Task3.job

If you're unsure of what the windows directory is on a remote computer, you can read it from its registry with:

RegRead ( '\\remotecomputer\HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'SystemRoot' )

Unfortunately, you can't just copy a .job file to the remote computer - it looses it's security info.

JerryD

Link to comment
Share on other sites

Hello fellow AutoITers

Ive been trying to automate the creation of a scheduled task..

To do that I want to verify that the task doesnt already exist,

So I tried searching the list of scheduled tasks with the following:

But no matter if the task exists or not and where it is in the list of tasks, the returned value is always 1

Ideas anyone ?

gilk

<{POST_SNAPBACK}>

You should use the ControlListView ( "Scheduled Tasks", "", "Syslistview321", "FindItem", "My Task" )

command for that

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