Sign in to follow this  
Followers 0
sysadmin

It runs half way then stops

4 posts in this topic

Ok.... after many hours of searching and trial an error (plus some help from people) I have gotten most of this thing figured out. It runs half way through the script and then stops when it is supposed to input data from excel. I just cant figure out where the link is broken.

#include <File.au3>
#include <Array.au3>
#include <Excel.au3>

local $oExcel = _ExcelBookOpen("C:\Users\mcrown\Documents\searchresultstest.xls")
$aArray1 = _ExcelReadSheetToArray($oExcel,1,1,0,1,True)
_ExcelBookClose($oExcel)
_ArrayDisplay($aArray1)
$rows = UBound($aArray1)-1

WinActive("CORRIDOR", "")
WinSetState("CORRIDOR","",@SW_MAXIMIZE)


WinActivate("CORRIDOR", "")
send("!t")
send("{down 2}")
send("{right}")
send("{down 3}")
send("{ENTER}")

WinWaitActive("CORRIDOR", "", 5)
WinActivate("Current Parts in Inventory Search", "")

WinWaitActive("CORRIDOR", "", 5)
ControlCommand("Current Parts in Inventory Search", "", "SysTabControl323", "TabRight", "")
send("{TAB}")

for $c = 1 to $rows
ControlClick("Current Parts in Inventory Search", "Lot number", 1070, "left")
WinWaitActive("Current Parts in Inventory", "Lot Number", 5)
ControlSend("Current Parts in Inventory Search", "Lot Number", 1070, $aArray1[$c][0])
ControlClick("Current Parts in Inentory Search", "Scan", 1062, "left")
ControlClick("Current Parts in Inventory Search", "open", 1663, "left")

send("{TAB 7}")
send("Lowcountry Trading IV, LLC")
send("{TAB}")
send("Lowcountry Trading IV, LLC")

WinActivate("Edit Lot", "")
WinWaitActive("Edit Lot", "", 3)
ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
ControlCommand("Edit Lot", "", "SysTabControl321", "TabRight", "")
next

Yes, I know I've probably added a lot of strings that are unnecessary, but I'm still learning.

Share this post


Link to post
Share on other sites



At first glance, I would guess it's stopping at one of the WinWaitActive() functions, Try writing in some

ConsoleWrite()
lines before and after those to be sure it isn't stopping there. If it is stopping there, make sure you specify your
WinTitleMatchMode
it can be found in the help file. I believe by default it only matches the window starting at the beginning, and only does partial match. Feel free to correct me if anything I said is...foolish :)

Share this post


Link to post
Share on other sites

There is an Excel UDF that would probably make this a lot easier than trying to manually jump around the screen to various locations on a spreadsheet.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Well, I'm not trying to jump around to various locations. I need to go down in sequence on one column. The navigation through my GUI works fine I just dont think it is building the array from the Excel spread sheet. If I could just get this part nailed down I can start writing all of the other scripts I need to. For some reason this part is confusing the crap outa me.

Edited by sysadmin

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