Sign in to follow this  
Followers 0
cshrem

Automating DOS programs

7 posts in this topic

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

Share this post


Link to post
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.


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

hey thanks. Can you be more specific or lead me in the right direction ?

Share this post


Link to post
Share on other sites

hey thanks. Can you be more specific or lead me in the right direction ?

look around in your program, a lot of times there's a status bar that contains cursor position which can be read with StatusbarGetText()

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
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.

Share this post


Link to post
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

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

wow pixelchecksum() might be the solution!! thanks!!!

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  
Followers 0