Jump to content
Sign in to follow this  
alfa

Why Does It Stop ?

Recommended Posts

alfa

Hello

I am having a problem with this.

You will see a msgbox with WhyDoesItStopBeforeThis. The scripts stops just before it. It doesnt execute the parts after that. Any one have any idea why it might happen ?

Thanks In advance

#include <_PDH_ProcessCounters.au3>
#include <clipboard.au3>
#Include <Excel.au3>
#Include <Array.au3>
#Include <File.au3>

;   --------------------    HOTKEY FUNCTION & VARIABLE --------------------

Global $bHotKeyPressed=False

Func _EscPressed()
    $bHotKeyPressed=True
EndFunc

;   --------------------    MAIN PROGRAM CODE   --------------------

HotKeySet("{Esc}", "_EscPressed")

_PDH_Init()
Local $poCounter,$hSplash,$sProcess,$iProcessID
Local $iCounterValue,$sSplashText,$iTemp

ShellExecute ("iexplore.exe")
sleep (7000)
$sProcess="iexplore.exe"     ; change to "autoit3_x64.exe" for 64-bit process :)
$PID = ProcessExists($sProcess)
$iProcessID=$PID

$poCounter=_PDH_ProcessObjectCreate($sProcess,$iProcessID)
_PDH_ProcessObjectAddCounters($poCounter,6) ; "% Processor Time"

;~ ; successful? Then enter loop

Func _sleepUntilXX()
If @error=0 And IsArray($poCounter) Then
    $iCounterValue=Round(_PDH_ProcessObjectUpdateCounters($poCounter,0)/$_PDH_iCPUCount)
    Do
        Sleep(200)
        $iCounterValue=_PDH_ProcessObjectUpdateCounters($poCounter,0)
        If @error=32 Then ExitLoop      ; Process can no longer be found
        $iCounterValue=Round($iCounterValue/$_PDH_iCPUCount)
            If $iCounterValue > 30 Then
                Sleep (100)
            EndIf
    Until $iCounterValue = 0
EndIf
EndFunc


If FileExists("C:\Documents and Settings\aozben\Desktop\Cap Rep\*.xls") Then
    FileDelete("C:\Documents and Settings\aozben\Desktop\Cap Rep\*.xls")
EndIf
_ClipBoard_SetData ("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy")

Send ("{Tab}")
send ("^v")
send ("{enter}")
WinWaitActive ("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer")
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "List12")
Send ("{down 10}")
Sleep (1000)
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "List4")
Send ("{down}")
sleep (1000)
Send ("^a")
sleep (1000)
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn25")
Sleep(2000)
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn1")
Sleep (2000)
WinWaitActive("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer")
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel39")
Sleep (500)
MouseClickDrag("left", 60, 604, 72, 300, 1)
WinWaitActive ("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer")
Sleep (1000)

MouseClick("left", 249, 887, 1, 0)
MouseClick("right", 249, 887, 1, 0)
MouseClick("left", 281, 900, 1, 0)      ;LO silindi
_sleepUntilXX()
MouseClickDrag("left", 86, 646, 435, 889,0) ;infolvl2 eklendi
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel4")
sleep (500)
MouseClick("left", 54,229,1,0)
MouseClick("left", 188,230,1,0)
WinWaitActive("Export Section")
Send ("C:\Documents and Settings\aozben\Desktop\Cap Rep\TK_LO_Cap_Rep.xls")
Send ("{TAB}")
Send ("{down 3}")
Send("!s")
Sleep(500)
Send("!y")

;; TK_LO_Cap_Rep.xls bitti

Sleep (1000)
MouseClickDrag("left", 74, 469, 329,885,0)  ;OST Eklendi
_sleepUntilXX()
MouseClickDrag("left", 69, 357, 367,885,0)  ;Style Eklendi
_sleepUntilXX()
MouseClickDrag("left", 77, 374, 407,885,0)  ;Metarial# Eklendi
_sleepUntilXX()
MouseClickDrag("left", 75, 759, 476,885,0)  ;Item Desc Eklendi
_sleepUntilXX()
MouseClickDrag("left", 71, 583, 545,885,0)  ;Buy Mounth Eklendi
_sleepUntilXX()
MouseClickDrag("left", 78, 598, 614,885,0)  ;Buy Date Eklendi
_sleepUntilXX()
MouseClickDrag("left", 72, 565, 673,885,0)  ;Gac Eklendi
_sleepUntilXX()
MouseClickDrag("left", 74, 678, 195,900,0)  ;Cbc1 Eklendi
_sleepUntilXX()
MouseClickDrag("left", 74, 900, 237,900,0)  ;MSC Eklendi
_sleepUntilXX()
MouseClickDrag("left", 74, 726, 276,900,0)  ;CBC3 Eklendi
_sleepUntilXX()
MouseClickDrag("left", 74, 934, 317,900,0)  ;Region Eklendi
_sleepUntilXX()
MouseClickDrag("left", 74, 438, 370,900,0)  ;Season Eklendi
_sleepUntilXX()
MouseClick("left", 453, 900, 1, 0)
MouseClick("right", 453, 900, 1, 0)
MouseClick("right", 471, 914, 1, 0) ;Info Lvl1 silindi
_sleepUntilXX()
MouseClickDrag("left", 74, 517, 869,920, 0) ;Derived Ost Qty Eklendi
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel4")
sleep (500)
MouseClick("left", 54,229,1,0)
MouseClick("left", 188,230,1,0)
WinWaitActive("Export Section")
Send ("{TAB}")
Send ("{down 3}")
Send("!s")
Sleep(500)
Send("!y")

;2.Rapor Bitti

_sleepUntilXX()
MouseClick("left", 798, 922, 1, 0)
MouseClick("right", 798, 922, 1, 0)
MouseClick("right", 819, 933, 1, 0) ;Derived Est QTY silindi
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel4")
sleep (500)
MouseClick("left", 54,229,1,0)
MouseClick("left", 188,230,1,0)
WinWaitActive("Export Section")
Send ("C:\Documents and Settings\aozben\Desktop\Cap Rep\5519_capacity_report_short_gila.xls")
Send ("{TAB}")
Send ("{down 3}")
Send("!s")
Sleep(500)
Send("!y")
_sleepUntilXX()
;3.Rapor Bitti


ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel47")
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "List4")
Sleep (1000)
Send ("{PGDN}")
MouseClick("left", 675, 474, 1, 0)
MsgBox (0, "Select Season", "Select Season and clik OK")
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn25")
_sleepUntilXX()
ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn1")
_sleepUntilXX()
MouseClickDrag("left", 390, 900, 291, 885,1)    ;Season Moved
_sleepUntilXX()
MouseClick("left", 483, 885, 1, 0)
_sleepUntilXX()
MouseClick("right", 483, 885, 1, 0)
_sleepUntilXX()
MouseClick("left", 506, 901, 1, 0) ;Metarial# silindi
_sleepUntilXX()
MouseClickDrag("left", 550, 886, 867, 888, 1)   ;Buy Month Moved
_sleepUntilXX()
MouseClick("left", 819, 885, 1, 0)
_sleepUntilXX()
MouseClick("right", 819, 885, 1, 0)
_sleepUntilXX()
MouseClick("left", 840, 894, 1, 0) ; Make Month silindi
_sleepUntilXX()
MouseClick("left", 555, 887, 1, 0)
_sleepUntilXX()
MouseClick("right", 555, 887, 1, 0)
_sleepUntilXX()
MouseClick("left", 577, 896, 1, 0) ; Buy Date silindi
_sleepUntilXX()
MouseClickDrag("left", 79, 633, 237, 900,1) ;Season Moved
_sleepUntilXX()

ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel4")
sleep (500)
MouseClick("left", 54,229,1,0)
MouseClick("left", 188,230,1,0)
WinWaitActive("Export Section")
$season1 = InputBox ("Season", "Write in Season name")
Send (" C:\Documents and Settings\aozben\Desktop\Cap Rep\"&$season1&".xls")
Send ("{TAB}")
Send ("{down 3}")
Send("!s")
Sleep(500)
Send("!y")

;season rapor bitti

Dim $season[1]
$x = 1
$yesNO = MsgBox(4, "Another Season", "Do you need an other Season ?")

Do
    ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel47")
    Sleep (1000)
    MsgBox(0, "Select Season", "Select Season and clik OKz")
    ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn25")
    _sleepUntilXX()
    ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn1")
    _sleepUntilXX()
    ControlClick("\\istanbul-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "Panel4")
    Sleep(500)
    MouseClick("left", 54, 229, 1, 0)
    MouseClick("left", 188, 230, 1, 0)
    WinWaitActive("Export Section")

    $input = InputBox("Season", "Write in Season name")
    _ArrayAdd($season, $input)
    Send(" C:\Documents and Settings\aozben\Desktop\Cap Rep\" & $season[$x] & ".xls")
    Send("{TAB}")
    Send("{down 3}")
    Send("!s")
    Sleep(500)
    Send("!y")
    $yesNO = MsgBox(4, "Another Season", "Do you need an other Season ?")
    $x += 1
Until $yesNO = 7

_sleepUntilXX()

ShellExecute("TK_LO_Cap_Rep.xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\")
Sleep(1000)
ShellExecute("5519_capacity_report_short.xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\")
Sleep(1000)
ShellExecute ($season1&".xls","" ,"C:\Documents and Settings\aozben\Desktop\Cap Rep\")
Sleep (1000)
For $x = 1 To UBound($season)
    ShellExecute($season[$x] & ".xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\")
    Sleep(1000)
Next

MsgBox(0, "neden", "WhyDoesItStopBeforeThis")
Sleep (1000)
MsgBox(0, "neden", "Sonra")

$oExcel = ObjGet("","Excel.Application")
$oExcel.Visible = 1
$oExcel.WorkBooks("TK_LO_Cap_Rep.xls").Activate
Send("^i")
Sleep (5000)
$oExcel.WorkBooks("5519_capacity_report_short.xls").Activate
Send("^i")
Sleep (5000)
$oExcel.WorkBooks($season1&".xls").Activate
Send("^i")
Sleep (5000)
For $x = 1 To UBound($season)
    $oExcel.WorkBooks($season[$x]&".xls").Activate
    Sleep (50)
    Send ("^i")
    Sleep(5000)
Next
Sleep (5000)
Send("^u")
Sleep (60000)

MsgBox (0, "alov", "heeee")

ShellExecute("TK_LO_Cap_Rep.xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\1\")
Sleep(1000)
ShellExecute("5519_capacity_report_short_gila.xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\")
Sleep (1000)
;~ Sleep (5000)
Send("^i")
_ExcelSheetDelete ($oExcel, "5519_capacity_report_short")
Sleep (1000)
_ExcelSheetMove ($oExcel, "5519_capacity_report_short_gila", "TK_LO_Cap_Rep", False)
Sleep (500)
Sleep (1000)
Send ("!fa")
WinWaitActive ("Save As")
;~ Sleep (3000)
Send ("c:\Documents and Settings\aozben\Desktop\Cap Rep\1\TK_LO_Cap_Rep_Gila.xls")
Send ("{Enter}")
Sleep (3000)

Dim $a, $d, $f, $s
$a = String(@MDAY)
$s = String(@MON)
$d = String (@YEAR)
$f = String($a&"-"&$s&"-"&$d)

if $s = ("01") Then
    $g = ("Jan")
EndIf
if $s = ("02") Then
    $g = ("Feb")
EndIf
if $s = ("03") Then
    $g = ("Mar")
EndIf
if $s = ("04") Then
    $g = ("Apr")
EndIf
if $s = ("05") Then
    $g = ("May")
EndIf
if $s = ("06") Then
    $g = ("June")
EndIf
if $s = ("07") Then
    $g = ("July")
EndIf
if $s = ("08") Then
    $g = ("Aug")
EndIf
if $s = ("09") Then
    $g = ("Sep")
EndIf
if $s = ("10") Then
    $g = ("Oct")
EndIf
if $s = ("11") Then
    $g = ("Nov")
EndIf
if $s = ("12") Then
    $g = ("Dec")
EndIf

FileCopy ("c:\Documents and Settings\aozben\Desktop\Cap Rep\1\*.xls", "\\istanbul-svr-01\production\Capacity&BuyPlans\"&$d&"\"&$g&"\"&$f&"\", 8)

If Not ProcessExists ("outlook.exe") Then
    ShellExecute ("c:\Program Files\Microsoft Office\Office14\OUTLOOK.EXE")
    WinWaitActive ("","Microsoft Outlook")
    Send("^n")
Else
    WinActivate ("", "Microsoft Outlook")
    Send("^n")
EndIf

Sleep (5000)

WinWaitActive("Untitled - Message (HTML)")
ControlClick("Untitled - Message (HTML)", "", "RichEdit20WPT1")
Send ("gila")
Send ("{tab}")
Sleep (500)
ControlClick("Untitled - Message (HTML)", "", "RichEdit20WPT4")
Send ("Capacity")
Send ("{Enter}")
Send ("\\istanbul-svr-01\production\Capacity&BuyPlans\"&$d&"\"&$g&"\"&$f&"\")
Send ("{Enter}")
Send ("Altina koydum")
;~ Send ("!s")
ProcessClose ("excel.exe")
MsgBox (0, "Capacity Bitti" , $f)

_PDH_ProcessObjectDestroy($poCounter)
_PDH_UnInit()

Share this post


Link to post
Share on other sites
alfa

Here it is.

C:\Program Files\AutoIt3\Projects\Capacity.au3 (253) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
ShellExecute($season[$x] & ".xls", "", "C:\Documents and Settings\aozben\Desktop\Cap Rep\")
ShellExecute(^ ERROR

Share this post


Link to post
Share on other sites
bogQ

probably

For $x = 1 To UBound($season) - 1

on line 252 is needed

Edited by bogQ

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
alfa

Thank you very much.

Can i ask why did it need that -1 ?

I am not so good in this so pardon my asking.

Share this post


Link to post
Share on other sites
tlman12

Thank you very much.

Can i ask why did it need that -1 ?

I am not so good in this so pardon my asking.

because an array starts at 0 but a ubound returns the "ammount" of elements an in array so a an array that contains 10 elements would actually be numbered 0 to 9 and if you try to use $array[10] it would fail

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.