Jump to content

Automating DOS programs


 Share

Recommended Posts

hey all!

heard some good things about au3 so I started learning it last week.

I work for a company that uses a very old but extremely secure custom built DOS program to run the backend of the company.

SCREENSHOT:

Posted Image

we sell electornics on our 10 retail websites and run a wholesale and distribution chain as well. I wanted to figure out a way to automated these events.

the first challenging process was marking an order as "drop shipped"

It involves going into the order, changing some settings, hitting a bunch of keys and thats it.

my code is below, it works great. but I still have to enter some information.

I was hoping someone could help me with the following

1) stopping the script in the middle and exiting.

2) the script pauses in the middle, asks me to enter text, then it pastes that text into the field its on.

3) After some commands, theres like a 10 second wait time until the next screen loads, the title is still the same so WinWaitActive wont work, so I use the Sleep(), is there a better way?

thanks!

;
; AutoIt Version: 3.0
; Language:       English/Any
; Platform:       Win9x/NT/XP (Tested)
; Author:         Charlie Shrem 
;
; Script Function:
;   Drop ships and order in Arcust
; To use: hit control+enter on the order and enter correct order price, then start the script. 

opt('SendKeyDelay', 500)
; run("C:\Documents and Settings\Charlie268\Desktop\GOD.BAT") 
WinWaitActive("C:\WINDOWS\system32\cmd.exe", "", 5)
;;;;;;;;;;;;;;;;;;;;;;;;;;; experiment 
Send("{CTRLDOWN}") 
Send("{ENTER}")
Send("{CTRLUP}")
Sleep(3000)
Send("{PGDN}")
Sleep(2000)
Send("{ENTER}")
Send("{ENTER}")
Send("9.98");;;; Instead of doing it in the code, I'd like for the script to pop up and ask me what value to put in. 
Send("{PGDN}")
Send("{PGDN}")
Sleep(3000)
Send("{F11}")
Send("S")
Send("STEAL1") ; enter drop ship vendor 
Send("{ENTER}")
Send("{PGDN}")
Sleep(2000)
Send("{F10}")
Send("{ENTER}")
Send("{PGDN}")
Send("{PGDN}")
Send("{PGDN}")
Send("{PGDN}")
Sleep(3000)
Send("{RIGHT}")
Send("{ENTER}")
Sleep(2000)
Send("{ENTER}")
Sleep(30000) ; shipping 
Send("{ESCAPE}") ; upS export may show up 
Send("{ESCAPE}") ; ask to be printed
Sleep(1500) 
Send("{PGDN}")
Sleep(1000)
Send("{RIGHT}")
Send("{ENTER}")
Exit
Link to comment
Share on other sites

when i've had to automate dos programs in the past, i've typically done it by parsing out the screen, or using a status bar with the cursor position in the status bar to check at every step instead of using times that may fluctuate based on too many outside variables.

Link to comment
Share on other sites

Thanks, the issue is there is no status or progress bar.

any idea of the stopping issue and the user input? the [pasi

I tried the pasuing and escaping functions and I would assume that making a hotkey then a function with Exit() in it would work, but it didnt.

Link to comment
Share on other sites

Thanks, the issue is there is no status or progress bar.

any idea of the stopping issue and the user input? the [pasi

I tried the pasuing and escaping functions and I would assume that making a hotkey then a function with Exit() in it would work, but it didnt.

that should work, depending on what code you have running, but at best it will stop the script at the point where it registers the hotkey that could be after a mistake is made. if you have a title section that you can use to verify that it's on the right screen, you could use pixelchecksum() to verify the correct screen before continuing
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...