Jump to content

Suddenly Send() will not work


Recommended Posts

Has anyone had this problem. Suddenly send() will not work. I can open the excel spreadsheet, but when I try to Send("^+i") the script stops.

Anyone?

#include <GUIConstants.au3>

GUICreate("UPS Report Generator",300,200)

;;;;;;;;;;;check boxes;;;;;;;;;;;;;;;;;;;;;;

GuiCtrlCreateGroup("Selection Group", 50, 10)

$value1 = GuiCtrlCreateCheckbox("Seperate by Shipper for Analysis", 60, 30, 170)

GuiCtrlSetState(1, $GUI_CHECKED)

$value2 = GuiCtrlCreateCheckbox("Seperate by Shipper for State", 60, 55, 170)

GuiCtrlSetState(1, $GUI_CHECKED)

$value3 = GuiCtrlCreateCheckbox("Run State Reports", 60, 80, 170)

GuiCtrlSetState(-1, $GUI_CHECKED)

$value4 = GuiCtrlCreateCheckbox("Run Weight Reports", 60, 105, 170)

GuiCtrlSetState(-1, $GUI_CHECKED)

$value5 = GuiCtrlCreateCheckbox("CD's to Client", 60, 130, 170)

GuiCtrlSetState(1, $GUI_CHECKED)

GUICtrlCreateGroup ("",-99,-99,1,1) ;close group

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$okbutton = GuiCtrlCreateButton ("OK",50,160,70,20)

$cancelbutton = GuiCtrlCreateButton ("Cancel",180,160,70,20)

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE Or $msg = $cancelbutton

ExitLoop

Case $msg = $okbutton

If GuiCtrlread($value1) = $GUI_Checked Then

$shipper = "s"

else

$shipper = ""

EndIf

If GuiCtrlread($value2) = $GUI_Checked Then

$seperate_state = "s"

else

$seperate_state = ""

EndIf

If GuiCtrlread($value3) = $GUI_Checked Then

$state = 1

else

$state = 0

EndIf

If GuiCtrlread($Value4) = $GUI_Checked Then

$weight = 1

else

$weight = 0

EndIf

If GuiCtrlread($value5) = $GUI_Checked Then

$cd = 1

else

$cd = 0

EndIf

$PID1 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv analysis.xls"')

WinWait("Microsoft Excel - upseinv analysis.xls","")

Send("^+i")

Send($shipper)

Send("{ENTER}")

ProcessWaitClose($PID1)

Sleep(500)

$PID2 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinvsum.xls"')

WinWait("Microsoft Excel - upseinvsum.xls","")

Send("^+i")

ProcessWaitClose($PID2)

Sleep(500)

$PID3 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv misc.xls"')

WinWait("Microsoft Excel - upseinv misc.xls","")

Send("^+i")

ProcessWaitClose($PID3)

Sleep(500)

$PID4 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv purecno summary.xls"')

WinWait("Microsoft Excel - upseinv purecno summary.xls","")

Send("^+i")

ProcessWaitClose($PID4)

Sleep(500)

If $state = 1 Then

$PID5 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv state dist shipper.xls"')

WinWait("Microsoft Excel - upseinv state dist shipper.xls","")

Send("^+i")

Send($seperate_state)

Send("{ENTER}")

Send("a")

Send("{ENTER}")

ProcessWaitClose($PID5)

Sleep(500)

EndIF

If $weight = 1 Then

$PID6 = Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv dist analysis.xls"')

WinWait("Microsoft Excel - upseinv dist analysis.xls","")

Send("^+i")

Send("a")

Send("{ENTER}")

ProcessWaitClose($PID6)

Sleep(500)

EndIF

Run('C:\Program Files\Microsoft Office\Office\EXCEL.EXE "C:\fedxrem\upseinv audit report.xls"')

WinWait("Microsoft Excel - upseinv audit report.xls","")

Send("^+i")

If $cd = 1 Then

CDTray("d:", "open")

MsgBox(0, "Write CD", "Please write your files to CD.")

EndIF

EndSelect

WEnd

GUIDelete()

Exit

Edited by NSearch
Link to comment
Share on other sites

I had been modifying the code that I posted, and that is when it stopped working, but even the scripts that I wrote before will not run. Very strange. If anyone else has had this problem, please let me know.

Thankyou

Link to comment
Share on other sites

I had been modifying the code that I posted, and that is when it stopped working, but even the scripts that I wrote before will not run. Very strange. If anyone else has had this problem, please let me know.

Thankyou

<{POST_SNAPBACK}>

i THINK THE BEST THINGS YOU HAVE TO DO IS WORKING WITH COM OBJECT EXCEL ; IT WORKS PERFECTLY FOR ME WITH AN EXCEL OBJECT
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...