Hey guys, I have recently been appointed to create a method of automating some testing done on computers that will ensure that users have the correct read/write ability. This will be compiled to an exe and then used on about 20 desktops over and over again. As you can see it's very crude and rudimentary, it's also my first script
It works, however, I need it to be a little more robust and functioning on foreign environments, such as different drive names.
CODE$answer = MsgBox(4, "Executable Script", "This script will run an array of programs and test user read-write permissions. Run?")
If $answer = 7 Then
MsgBox(0, "Canceled", "Script Canceled")
Exit
EndIf
Run( "C:\Program Files\Microsoft Office\Office10\winword.exe")
WinWaitActive("Microsoft Word")
AutoItSetOption("SendKeyDelay", 20)
Send("I am a new user, hear me roar. I will save to a file.")
Sleep(2000)
Send("{CTRLDOWN}")
Send("s")
Send("{CTRLUP}")
Send("testscript.doc")
Send("{Enter}")
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\winword.exe")
WinWaitActive("Microsoft Word")
Send("{CTRLDOWN}")
Send("o")
Send("{CTRLUP}")
Sleep(250)
Send("testscript.doc")
Sleep(500)
Send("{Enter}")
Sleep(5000)
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\Excel.exe")
WinWaitActive("Microsoft Excel - Book1")
Send("Data")
Send("{Tab}")
Send("Column")
Send("{DOWN}")
SEND("{LEFT}")
SEND("Row")
SEND("{TAB}")
SEND("Test")
Send("{CTRLDOWN}")
Send("s")
Send("{CTRLUP}")
Send("Testscript.xls")
Send("{Enter}")
Sleep(500)
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\Excel.exe")
WinWaitActive("Microsoft Excel - Book1")
Send("{CTRLDOWN}")
Send("o")
Send("{CTRLUP}")
Sleep(250)
Send("testscript.xls")
Sleep(500)
Send("{Enter}")
Sleep(5000)
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\Powerpnt.exe")
WinWaitActive("Microsoft PowerPoint - [Presentation1]")
SEND("{TAB}")
SEND("I am writing a test script, isn't this fun?")
Send("{CTRLDOWN}")
Send("s")
Send("{CTRLUP}")
Send("Testscript.ppt")
Send("{Enter}")
Sleep(500)
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\Powerpnt.exe")
WinWaitActive("Microsoft PowerPoint - [Presentation1]")
Send("{CTRLDOWN}")
Send("o")
Send("{CTRLUP}")
Sleep(250)
Send("testscript.ppt")
Sleep(500)
Send("{Enter}")
Sleep(5000)
Send("!f")
Send("x")
Sleep(4000)
Run("C:\Program Files\Microsoft Office\Office10\Outlook.exe")
Sleep(1500)
WinActivate("Inbox - Microsoft Outlook", "")
WinWaitActive("Inbox - Microsoft Outlook")
Send("{CTRLDOWN}")
Send("n")
Send("{CTRLUP}")
Send("Dave")
Send("{TAB}")
SEND("{TAB}")
Send("Script works")
Sleep(1000)
Send("{TAB}")
Send("This is how you have a wholesome conversation with a guy named Dave")
Send("!{F4}")
Send("{TAB}")
Send("{Enter}")
Send("!{F4}")
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
AutoItSetOption("SendKeyDelay", 20)
Send("All microsoft products are working as intended.")
Sleep(6000)
WinKill("Untitled - Notepad")
Now this script works and does what it's supposed to do, however sometimes it will goof up while it's running and mistype a word in the savefile box (It has done this twice so far). It will sometimes write testscrpt.doc and then when it tries to open it, the script goes berserk. Is there any way of controlling the script?
Also I would like for the script to delete the files that it has created after it is done so we can run the script multiple times and not have to worry about rewrites.
I know this is a lot to ask but if you could point me in the write direction I would greatly appreciate it.
BTW I can't get to the ruddy help files from work because of this stupid .exe protection and you can't link a file to another file.