Jump to content
Sign in to follow this  

Run Script with Win Scheduler

Recommended Posts



first of all i have to say that i`m new to AutoIT. I wrote a script that allows me to start an .exe file with a parameter, to get the Data of a specific machine. I wait for all windows to exist and activate them.

Then i export the Data via the Menue (Alt+D [in German]-> e[xport]). All works fine on my System and also on the server it has to work on.

Now to the Problem, i connect to the Server over RemoteAdmin (WinXp). While I`m logged in the script runs without Problems. However if I schedule the Task no action is performed.

I wrote a little control scipt that writes into a file if command was performed. So it seems to me that if the script is running from Windows Scheduler in the background the window can`t be active and this way no Input can be done.

Anybody in here got an idea of how to start a script scheduled without being logged on?

The Server runs Win2000 by the way.

So every comment will be welcome, i hope you can help me with my problems.

As we would say in germany->

Mit freundlichen Grüßen


THX to the developers, never seen such a strong tool before.

Edited by chris_p

Share this post

Link to post
Share on other sites

The windows task scheduler is a funny one.

Ensure the schedule you create has been created with the correct username/password and logon rights required.

Ensure the machine is logged on, and not on screensaver if you are trying to manipulate an application in interactive mode.

If you require any help, let me know.

Edit: Typos

Edited by sandyd

----[ SandyD ]---

Share this post

Link to post
Share on other sites

Thanx, for the fast answer.

My problem is that all users on the server connect via remote admin, so no one is logged on at all time.

log and psw are correct, the Task runs and starts the application, winexist tells me so but winactivate wont work. Due to the fact that the scheduler runs his applications in the background.

:o scheduler makes me cry, would be nice if it would really logon and then run the scripts insted of running without GUI


Share this post

Link to post
Share on other sites

I'm pretty sure that if you are tyring to run a script that manipulates a window (using winactivate) via the scheduler, you are not going to get very far.

Are there any alternatives to what you are trying to do?, Can you explain what the script does, as we might me able to come up with another solution?

----[ SandyD ]---

Share this post

Link to post
Share on other sites

For sure

The script is used do gain access to the addressbook of different MFPs (printer).

After i found out how to start the application with parameters for the IP and the Name of the

device, the only thing the Autoscript has to do is to "press" (alt+d) (in english (alt+f) for file) then press

[e] for export data. Finally (Enter) for Saving file, once (LEFT) for answering Yes if we are promt to overwrite existing file and again (Enter).

So lets take a look at the code
; Run Adsbook

Run("C:\Program Files\RMAdmin\Pmudsmtn.exe -ip ******* -devname *****")

    WinWaitActive("Kennwort","",20000);Wait for passwordwindow

    Failure("Kennwortfenster Fenster gefunden"); cant find window
    If WinExists("Kennwort") Then
        WinActivate("Kennwort", ""); password window
        Send("IWontTell{ENTER}"); send psw
    WinWaitActive("Adressverwaltungsprogramm - Informationen werden geladen","",60000); loadingscreen 
    WinWaitClose("Adressverwaltungsprogramm - Informationen werden geladen","",120000);loadingscreen has to finish
    If WinExists("Adressverwaltungsprogramm") Then
        Failure("Adrsverwaltungsprg geladen")
        WinActivate("Adressverwaltungsprogramm", "")
        Send("!d"); Kontextmenue Datei aufrufen
        Send("e"); Eintrag Exportieren waehlen
        Send("{ENTER}"); Speichern Bestätigen
        WinClose("Adressverwaltungsprogramm", "")

Func Failure($value)

        $file = FileOpen("Error.txt", 1)

; Check if file opened for writing OK
        If $file = -1 Then
          ;MsgBox(0, "Error", "Unable to open file.")
        $begin = TimerInit()
        FileWrite($file, $begin)
        FileWriteLine($file, $value)

As i said the script works .... but not with a scheduled task

Edited by chris_p

Share this post

Link to post
Share on other sites

OK, looking at your code, you are using the Send(...) command.

This will not work if you are not logged in as the window to send to is not visible.

Have you tried using ControlClick, ControlSend etc?

This may work, cant think of anything else at the moment.

Anyone else wanna have try?

----[ SandyD ]---

Share this post

Link to post
Share on other sites

Unfortunately the menue got no Control id or name :geek: .

Can the application Pmudsmtn.exe run in a silent mode, with commandline switches and no GUI? If not, I don't think you are going to be able to do this (by design) without logging on and getting a GUI shell running.

Alternatively, is the file type that Pmudsmtn.exe operates on usable without the application? If it keeps it's data as a CSV, XML, or some known format, you can get to the data directly from the data file without any GUI activity at all.


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post

Link to post
Share on other sites

That`s exactly what its all about, i need the Addressbook of these Printers, but there is no way (for me) to gain them. The only application which is able to get them is this .exe. It loads the .csv out of the printer on start.

There is even no way to obtain data throug the console using this exe. Even the producer of these printers dont know how to get is (or wont tell me) :o

But thanx again !

Edited by chris_p

Share this post

Link to post
Share on other sites

Of course the manufacturer is not going to tell you their industrial secrets! You may have to do some reverse engineering here. Beware as some countries view this as illegal activity.

How does the exe talk to the printer? FTP, TCP? Maybe worth having a look there, and seeing if you can peel it off the printer direct. Hex dump and disassembling the exe code may be a worthwhile exercise.

What printers are they (make and model please)? Is the exe part of the driver package for this machine? Anywhere we can have a peek at the exe (a downloads page would be nice)?

Looking at the bigger picture, how often does the address book change on each MFP? Is it worth going to the effort of adding this to the background scheduler, or could you do this another way?

Share this post

Link to post
Share on other sites

A lot of questions worth an answer :sorcerer:

I think the way the printers talk is TCP. But who knows ;) I took a look into the exe to see the Hex Code and a lot of time i found "TCP". There are also a lot of .dll files where the interesting code seems to be in.

The printers are from NRG (Nashuatec) type: DSm622


The used addressbooktool is in a utilitypackage called SmartDeviceMonitor for Admin.

pmudsmtn.exe -ip -devname JohnDoe opens the printer.

The story isn`t just about getting the Abook for backup. We have to admin about 500 printer all over germany. So a manual verification is a bad idea :zorro: .

All MFP (MultiFunctions Printer) got just one password with wich you can change everything in a printer.

So if we would give this password away, the user would be able to admin the Abook but also change the Ip, Domain, Colorsettings.... "According to Murphy" it would result in chaos.

So all administration have to be done by a system that hides the passwort.

The Idea:

1. Get the Abook from printer (works fine with AutoIT but not on server, winactive problem while not beeing logged in)

2. Parse the .CSV Data and import it into a Database.

3. Give the user a webinterface to view the Abooks Data (hope to do this much better than NRG who seems not to know that its better so be able to sort by alphabet because noone will remind all UniqueIDs :huggles: )

4. parse changes to the Abook from Webinterface into a CSV.

5. Import the CSV to the Printer via AutoIT.

I know that it`s a very strange way but we have tried a lot even wrote a big script to emulate post and get into the NRG webinterface. But NRG made their parameter that strange ... , therefor we produced to many malfunctions -> Which would make my boss :o during qualitycheck.

Again to my friend the scheduler...

The server I would like to run AutoIT is placed in a buling wich is secured like fort knocks and unfortunately not that near. So there is no way for me to gain a "Hardware Access" to the server.

-> no real login

-> no activewindow

-> no good :geek:

Could you tell me how reverseengineering works and maybe tell me some programms to use ?

Or how to view TCP Data ? The printer got an FTP running in his unknown inside maybe the Abooks csv is reachable over this way? But for me is no way to see these Data

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.