Jump to content
Sign in to follow this  
lhk69

ControlClick - Working / Not Working

Recommended Posts

lhk69

Why does this ONLY work when I put the debug message box in??? By not work, I mean the following SEND keys are never sent. It seems to just skip that. The result is always a 1, so it should execute. It only works correctly when I have the msgbox there.

Anybod have idea? I am still new and am probably not doing this right.

Below is the code section that is in question, the code at the bottom is the ENTIRE code.

$v_Activated = WinWaitActive("Remedy User - Server_Turnover (Modify)","")
$v_Clicked = ControlClick("Remedy User - Server_Turnover (Modify)","","[CLASS:#32770; INSTANCE:3]")
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$v_Clicked' & @lf & @lf & 'Return:' & @lf & $v_Clicked) ;### Debug MSGBOX

Sleep(3000)

If $v_Clicked = 1 then
    Send("{SHIFTDOWN}{CTRLDOWN}{END}{CTRLUP}{SHIFTUP}")
    Sleep(1000)
    Send("{ALTDOWN}t{ALTUP}p")
endif

Sleep(500)

$v_Activated = WinWaitActive("Remedy User - Report -- NOA-Server_Turnover (adeda30p.ami.alcoa.com)","")

Send("{DOWN}Server Turnover{ALTDOWN}R{ALTUP}EF" & @DesktopDir & "\report.rep" & "{ALTDOWN}s{ALTUP}y")
sleep(5000)

ProcessWaitClose ( $v_Activated )

v_Report_Exist = FileExists("C:\Documents and Settings\All Users\Application Data\Remedy6.3\Home\ARCmds\Server Turnovers.arr")

If $v_Report_Exist = 0 Then
     FileInstall("C:\temp\Server Turnovers.arr", "C:\Documents and Settings\All Users\Application Data\Remedy6.3\Home\ARCmds\Server Turnovers.arr")
Else
    ;MsgBox(4096, "Report was there", "Exists")
EndIf

$v_Output_Exist = FileExists(@DesktopDir & "\report.rep")

If $v_Output_Exist = 1 Then
    FileDelete(@DesktopDir & "\report.rep")
     ;MsgBox(4096, "ERROR!!!!", "Its gone now..")
Else
    ;MsgBox(4096, "Report was there", "Exists")
EndIf


;$v_UserName = InputBox("Remedy User Name","Please enter your Remedy User Name")
;$v_UserPass = InputBox("Remedy Password","Please enter your Remedy Password","","*")


$remedy = Run("C:\Program Files\AR System\User\aruser.exe",@WindowsDir,@SW_HIDE)
;sleep(3000)
;WinSetState("Login - Remedy User","",@SW_HIDE)

WinWaitActive("Login - Remedy User","Preference &Server:")
Send("USER{TAB}PASSWORD{TAB}{TAB}{TAB}{TAB}{ENTER}")
;Send($v_UserName & "{TAB}" & $v_UserPass & "{TAB}{TAB}{TAB}{TAB}{ENTER}")


WinWaitActive("Remedy User - Home Page (Search)")
sleep(1000)
Send("{CTRLDOWN}o{CTRLUP}")
WinWaitActive("Object List","")

Send("{SHIFTDOWN}noa{SHIFTUP}{SPACE}{SHIFTDOWN}s{SHIFTUP}erver{SPACE}turnover{SPACE}form{ENTER}")
WinWaitActive("Remedy User - NOA-Server_Turnover (New)","")
Send("{F3}")

WinWaitActive("Remedy User - Server_Turnover (Search)","")
Send('{ALTDOWN}s{ALTUP}Platform = "MS Server"{CTRLDOWN}{ENTER}{CTRLUP}')

$v_Activated = WinWaitActive("Remedy User - NOA-Server_Turnover (Modify)","")
$v_Clicked = ControlClick("Remedy User - Server_Turnover (Modify)","","[CLASS:#32770; INSTANCE:3]")
;MsgBox(262144,'Debug line ~' & @ScriptLineNumber,'Selection:' & @lf & '$v_Clicked' & @lf & @lf & 'Return:' & @lf & $v_Clicked) ;### Debug MSGBOX

Sleep(3000)

If $v_Clicked = 1 then
    Send("{SHIFTDOWN}{CTRLDOWN}{END}{CTRLUP}{SHIFTUP}")
    Sleep(1000)
    Send("{ALTDOWN}t{ALTUP}p")
endif

Sleep(500)

$v_Activated = WinWaitActive("Remedy User - Report -- -Server_Turnover (server.com)","")

Send("{DOWN}Server Turnover{ALTDOWN}R{ALTUP}EF" & @DesktopDir & "\report.rep" & "{ALTDOWN}s{ALTUP}y")
sleep(5000)

ProcessWaitClose ( $v_Activated )

ProcessClose ( $remedy )


$v_Output_Exist = FileExists(@DesktopDir & "\report.rep")

If $v_Output_Exist = 0 Then
     MsgBox(4096, "ERROR!!!!", "For some reason - the report did not get created.  Please try again.")
Else
    MsgBox(4096, "Success", "Report was successfully created" & @crlf & @crlf & "You can thank me later")
EndIf
Edited by lhk69

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  

×