Sign in to follow this  
Followers 0
Beetlebailey

Having issue with

4 posts in this topic

Hello forum world,

I have recently made a small tool for the call center I work in to launch different internet applications and some pc .exe's as well.

The second page is left for any feedback they may have for me. The idea is that when they click "submit" it sends me anything they've typed into the edit box.

I have the scripting right for the email generation, but can't get the function to run properly. Line 177 has the back button scripting and is suppose to trigger the Submit() function when the button is clicked, but it doesn't seem to work.

Any ideas?

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         Ryan Bailey

 Script Function:
CS Application Launcher

#ce ----------------------------------------------------------------------------

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <INet.au3>
#include <IE.au3>
#include <Word.au3>
#include <excel.au3>
#include <ScreenCapture.au3>


opt("MustDeclareVar" , 1)

MainGUI()

;Name the Variables
Func MainGUI()
    Global  $Feedback , $HFlogo2 , $Page1 , $hGUI2 , $gui2 , $hBmp , $SeondaryGUI ,  $Page2 , $hBmp , $Screen , $mygui , $newmsg , $Label3 , $Submit , $Edit , $Amysis , $CareManager , $CSA , $HealthX , $Kronos , $Google , $NCR , $NICEPerform , $NICEWFM , $MP , $ReportManager , $RXCLAIM
    Global  $RxPortal , $ie , $Calc , $Password ,$IE , $Button14 , $HFHPAPP , $Button16 , $Label1 , $Label2 ,$Notepad , $Word , $Excel , $Groupwise, $Messenger , $HFlogo , $Button21 , $Pic1 , $CSapps , $msg

;Create the main GUI

$mygui = GUICreate("Customer Service Omni-Tool", 514, 711, 258, 173)
GUISetCursor (2)
GUISetFont(10, 800, 0, "MS Sans Serif")
GUISetBkColor(0xA6CAF0)


;Assign the Variables
$Amysis = GUICtrlCreateButton("Amysis", 16, 72, 139, 25)
$CareManager = GUICtrlCreateButton("Care Manager", 16, 104, 139, 25)
$CSA = GUICtrlCreateButton("CSA", 16, 136, 139, 25)
$HealthX = GUICtrlCreateButton("Health X", 16, 168, 139, 25)
$Kronos = GUICtrlCreateButton("Kronos", 16, 200, 139, 25)
$Google = GUICtrlCreateButton("Google", 16, 232, 139, 25)
$NCR = GUICtrlCreateButton("NCR", 16, 264, 139, 25)
$NICEPerform = GUICtrlCreateButton("NICE Perform", 16, 296, 139, 25)
$NICEWFM = GUICtrlCreateButton("NICE WFM ", 16, 328, 139, 25)
$MP = GUICtrlCreateButton("Market Prominence", 16, 360, 139, 25)
$ReportManager = GUICtrlCreateButton("Report Manager", 16, 392, 139, 25)
$RXCLAIM = GUICtrlCreateButton("Rx Claim", 16, 424, 139, 25)
$IE = GUICtrlCreateButton("Internet Explorer", 16, 552, 139, 25)
$Dashboard = GUICtrlCreateButton("Dashboard", 16, 488, 139, 25)
$HFHPAPP = GUICtrlCreateButton("HP App page", 16, 520, 139, 25)
$Screen = GUICtrlCreatePic("S:\Health Plans\Operations\RYANB\UBER\CS App Launcher\Images\Camera.jpg", 176, 288, 100, 60)
$RxPortal = GUICtrlCreateButton("RxPortal", 16, 456, 139, 25)
$Calc = GUICtrlCreateButton("Calculator", 192, 232, 83, 25)
$Label1 = GUICtrlCreateLabel("Applications", 8, 32, 141, 29)
GUICtrlSetFont(-1, 18, 800, 2, "Modern No. 20")
$Label2 = GUICtrlCreateLabel("Tools", 200, 32, 62, 29)
GUICtrlSetFont(-1, 18, 800, 2, "Modern No. 20")
$Notepad = GUICtrlCreateButton("Notepad", 192, 72, 83, 25)
$Word = GUICtrlCreateButton("Word", 192, 104, 83, 25)
$Excel = GUICtrlCreateButton("Excel", 192, 136, 83, 25)
$Groupwise = GUICtrlCreateButton("Groupwise", 192, 168, 83, 25)
$HFlogo = GUICtrlCreatePic("S:\Health Plans\Operations\RYANB\UBER\CS App Launcher\Images\HF logo.jpg", 288, 10, 180, 60)
$Messenger = GUICtrlCreateButton("Messenger", 192, 200, 83, 25)
$calendar = GUICtrlCreateMonthCal ("Calendar", 192 , 520 , 292 , 172 )
$Edit1 = GUICtrlCreateEdit("", 288, 72, 217, 353)
GUICtrlSetData(-1, "Notes:")
$Page2 = GUICtrlCreateButton("Feedback", 288, 432, 211, 57)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Password = GUICtrlCreatePic ("S:\Health Plans\Operations\RYANB\UBER\CS App Launcher\Images\word.jpg" , 24 , 624 , 116 , 76)
$Label3 = GUICtrlCreateLabel("Password Keeper", 24, 605, 136, 22)
GUISetState()


;Run the gui until window is closed
While 1
    $msg = GUIGetMsg()
        Select
    Case $msg = $GUI_EVENT_CLOSE 
        exit
    Case $msg = $Notepad
        Run ("notepad.exe")
    Case $msg = $HFlogo
        ShellExecute("https://www.youtube.com/watch?v=9cQgQIMlwWw")
    Case $msg = $Calc
        Run ("calc.exe")
    Case $msg = $Amysis
        ShellExecute ("http://hfhp-wcaa.dstcorp.net:8080/amisys-web/Controller?view=jsp/Pportal.jsp")
    Case $msg = $CareManager
        ShellExecute("https://apps-hfhp.healthedge.net/Citrix/XenApp/hfhp/auth/login.aspx")
    Case $msg = $CSA
        ShellExecute("http://hfhp-wccsa.dstcorp.net:8080/hfhp-PROD-csa/portal")
    Case $msg = $HealthX
        ShellExecute("https://secure.healthx.com/publicservice/loginv1/login.aspx?bc=c1503d12-e5a7-43ba-8dc8-4ce5cfc2b5e1&serviceid=8d6ab51b-6c4c-4735-a738-87341c01f849")
    Case $msg = $Kronos
        ShellExecute("http://hfvkron.health-first.org/wfc/logon/logonWFC.html")
    Case $msg = $Google
        ShellExecute ("https://www.google.com/?gws_rd=ssl")
    Case $msg = $NCR
        ShellExecute("http://hfepsprod1.priv.health-first.org/CVMEServer/Login.aspx")
    Case $msg = $NICEPerform
        ShellExecute("http://hfniceim1/NiceApplications/Desktop/WebPage/DeskTopWebForm.aspx")
    Case $msg = $NICEWFM
        ShellExecute("http://101.202.40.3/agent/")
    Case $msg = $MP
        run ("MPC4Cunlock.exe")
    Case $msg = $ReportManager
        ShellExecute("http://hfhpsql12p01.priv.health-first.org/Reports/Pages/Folder.aspx")
    Case $msg = $RXCLAIM
        ShellExecute("https://asp.rxclaim.catamaranrx.com/RxClaim.html")    
    Case $msg = $IE
        ShellExecute("http://intranet.health-first.org/")
    Case $msg = $HFHPAPP
        ShellExecute("http://intranet.health-first.org/departments/health_plans/apps/index.cfm")
    Case $msg = $Word
            $Word = _WordCreate (@ScriptDir & "\Test.doc", 1)
; Check @extended return value to see if attach was successful
If @extended Then
    MsgBox(0, "", "Attached to Existing Window")
Else
    MsgBox(0, "", "Created New Window")
EndIf
    Case $msg = $Excel
            $Excel = _ExcelBookNew()
    Case $msg = $Groupwise
        Run("grpwise.exe")  
    Case $msg = $Messenger
        run("C:\Program Files (x86)\Novell\Messenger\NMCL32.exe")
    Case $msg = $Screen
        $hBmp = _ScreenCapture_Capture("")
        $Screen = _ScreenCapture_SaveImage(@DesktopDir & "\new_screenshot.jpg", $hBmp)
        ExitLoop
    Case $msg = $Dashboard
        ShellExecute("https://10.8.3.27:8444/cuic/permalink/PermalinkViewer.htmx?viewId=B194CB921000013A02102C0A0A08031B&linkType=dashboard&uuid=9315d5a3-c745-406a-8ad9-43b27dc55749")
    Case $msg = $Password
        ShellExecute( "S:\Health Plans\Operations\RYANB\UBER\CS App Launcher\Files\BLANK Password Keeper.doc")
    Case $msg = $RxPortal
        ShellExecute("https://healthfirsttrain.rxportal.sxc.com/rxclaim/portal/memberLogin")
    ; Create screen shot to save to desktop
    case $msg = $Page1
        GUICtrlSetState ($gui2, $GUI_Disable)
    case $msg = $page2
        GUICtrlSetState ($mygui, $GUI_DISABLE)
        local $hGUI2 = gui2()
        $aMsg = GUIGetMsg($hGUI2)
        Switch $aMsg
        case $GUI_EVENT_CLOSE
            ExitLoop
        case $GUI_EVENT_CLOSE
            ExitLoop    
        EndSwitch
        GUICtrlSetState($Page2, $GUI_ENABLE)
        EndSelect
    WEnd
EndFunc

Func gui2()
$gui2 = GUICreate("Customer Service Launcher", 514, 548, 304, 168)
GUISetCursor (2)
GUISetFont(10, 800, 0, "MS Sans Serif")
GUISetBkColor(0xA6CAF0)
$HFlogo2 = GUICtrlCreatePic("C:\Users\ry207033\Desktop\HF logo.jpg", 288, 8, 212, 60)
$Page1 = GUICtrlCreateButton("Back", 8, 488, 123, 41)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("Application Issues and Feedback", 8, 8, 270, 24)
GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif")
$Feedback = GUICtrlCreateEdit("", 24, 136, 465, 337)
GUICtrlSetBkColor(-1, 0xF4F7FC)
$Submit = GUICtrlCreateButton("Submit", 368, 488, 123, 41)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("Please leave feedback including Aplication/Time/Date/and issue ", 24, 104, 458, 20)
GUISetState(@SW_SHOW)

While 1
        Select
        $msg = GUIGetMsg()
        case $msg =$Submit 
            Submit()
       If $msg = $Page1 Then ExitLoop
        EndSelect   
WEnd
        
    GUIDelete();    ; will return 1
EndFunc   


Func Submit()
    Dim $DeskSize, $winarray, $timer, $x, $wHandle, $ie, $newmsg, $continue2, $tries
    GUICtrlSetData("","Your request is being sent... " & @CRLF & _ 
    "It is normal for your PC to freeze while transmitting your request."  & @CRLF & _ 
    "Transmission should not take longer than 1 minute")

    BlockInput(1)
    ;hide the desktop

    $DeskSize = WinGetPos("Program Manager")
    _ScreenCapture_Capture("c:\program files\CS App Launcher\desktop.bmp",0,0,$DeskSize[2],$DeskSize[3])
    SplashImageOn("","c:\program files\CS App Launcher\desktop.bmp",$DeskSize[2],$DeskSize[3],-3,-29)
    WinSetState("[CLASS:Shell_TrayWnd]","",@SW_HIDE)

    $winarray = WinList("[Title:Mail; CLASS:OFMailView]")
    For $x = 1 to $winarray[0][0] step 1
        WinSetState($winarray[$x][1],"",@SW_HIDE)
    Next
    WinMenuSelectItem("[Title:Novell GroupWise; Class:OFCalView]","","&File","&New","&Mail")
    $timer = 0
    While 1
        Sleep(100)
        $winarray = WinList("[Title:Mail; CLASS:OFMailView]")
        For $x = 1 to $winarray[0][0] step 1
            If BitAnd(WinGetState($winarray[$x][1]),2) Then
                $wHandle = WinGetHandle($winarray[$x][1])
                ExitLoop
            EndIf
        Next
        If $wHandle > 0 Then
            ExitLoop
        ElseIf $timer >= 10 Then
            ;if a user has the groupwise file menu hidden a new mail is not being created so the retry function had to be created using the controlsend method for creating a new mail.
            retry()
;~          $errormsg = "Application timed out while trying to create a new mail window."
;~          error_close()
        Else
            $timer = $timer + .15
        EndIf
    WEnd
    $winarray = WinList("[Title:Mail; CLASS:OFMailView]")
    For $x = 1 to $winarray[0][0] step 1
        WinSetState($winarray[$x][1],"",@SW_SHOW)
    Next
;~  $wTitle = "[Title:Mail To: ryan.bailey@health-first.org; CLASS:OFMailView]"
    ControlClick($wHandle,"",32772,"left",1,5,5)
    Sleep(100)
    ControlSend($wHandle,"",32772,"{DOWN}")
    ControlSend($wHandle,"",32772,"{DOWN}")
    ControlSend($wHandle,"",32772,"{ENTER}")
    For $x = 1 to 4 step 1
        ControlSend($wHandle,"","","{TAB}")
    Next
    ControlSend($wHandle,"","","ryan.bailey@health-first.org")
;~  ControlSend($wHandle,"","","Ryan Bailey")
    Sleep(200)
    ControlSend($wHandle,"","","{TAB}")
    ControlSend($wHandle,"","",$Feedback)

    
    WinMenuSelectItem($wHandle,"","&View","&HTML")
    $ie = _IEAttach($wHandle,"Embedded")
    $newmsg = "<HTML><BODY style=""background-image:url('http://photographyofgrace.com/3dTextures/LargeBackgrounds/BlueCanvasBackground.jpg');background-repeat:no-repeat;""><DIV style=""margin: 70px 70px 1px;""><TABLE cols=2 border=0>" & @CRLF & _ 
    "<TR><TD width=200><FONT face=""Candara"" size=4> Feedback: </FONT></TD><TD width=600><FONT face=""Candara"" size=4>" & $Feedback & "</FONT></TD></TR>" & @CRLF & _ 
    "</TABLE><BR><FONT face=""Vivaldi"" size=6>Created by: Ryan Bailey</FONT></DIV></BODY></HTML>"
    _IEDocWriteHTML($ie,$newmsg)

    WinWaitActive($wHandle,"",10)
    If WinActive($wHandle) = False Then
        $errormsg = "Problem occurred after attachments."
        error_close()
    EndIf
    ControlSend($wHandle,"","","{ALTDOWN}d")
    ControlSend($wHandle,"","","{ALTUP}")
    
    $continue = False
    $timer = 0
;~  While WinExists("Mail To: Ryan Bailey")
    While WinExists($wHandle) and $timer < 30
        Sleep(200)
        If WinExists("[Title:Spell Checker; CLASS:#32770]") and WinExists("[Title:Auto Spell; CLASS:#32770]") = False Then
            WinActivate("[Title:Spell Checker; CLASS:#32770]","")
            ControlClick("[Title:Spell Checker; CLASS:#32770]","","[ID:6]","left",1,39,12)
        ElseIf WinExists("[Title:Writing Tools; CLASS:#32770]") and WinExists("[Title:Auto Spell; CLASS:#32770]") = False Then
            WinActivate("[Title:Writing Tools; CLASS:#32770]")
            ControlClick("[Title:Writing Tools; CLASS:#32770]","","[ID:1001]","left",1,45,13)
        ElseIf WinExists("[Title:Auto Spell; CLASS:#32770]") Then
            WinActivate("[Title:Auto Spell; CLASS:#32770]")
            ControlClick("[Title:Auto Spell; CLASS:#32770]","","[ID:6]","left",1,39,12)
            $continue = True
        ElseIf WinExists("[Title:Signature; CLASS:#32770]") Then
            WinActivate("[Title:Signature; CLASS:#32770]")
            ControlClick("[Title:Signature; CLASS:#32770]","","[ID:7]","left",1,34,12)
        EndIf
        $timer = $timer + .2
    WEnd
    If $timer >= 30 Then
        $errormsg = "Final send execution failed."
        error_close()
    EndIf
    BlockInput(0)
    WinSetState("[CLASS:Shell_TrayWnd]","",@SW_SHOW)
    Exit
EndFunc

Func error_close()
    SplashOff()
    WinSetState("[CLASS:Shell_TrayWnd]","",@SW_SHOW)
    BlockInput(0)
    MsgBox(0,"Error","The application experienced an error while attempting to email your request. Please try again.",5)
    FileWriteLine("C:\Program Files\CS app launcher\errorLog.txt",_nowcalcdate() & " Application failed to execute for the following reason: " & $errormsg)
    Exit
EndFunc

Func retry()
    WinActivate("[Title:Novell GroupWise; Class:OFCalView]")
    ControlSend("[Title:Novell GroupWise; Class:OFCalView]","","","{CTRLDOWN}m")
    ControlSend("[Title:Novell GroupWise; Class:OFCalView]","","","{CTRLUP}")
    $timer = 0
    While 1
        Sleep(100)
        $winarray = WinList("[Title:Mail; CLASS:OFMailView]")
        For $x = 1 to $winarray[0][0] step 1
            If BitAnd(WinGetState($winarray[$x][1]),2) Then
                $wHandle = WinGetHandle($winarray[$x][1])
                ExitLoop
            EndIf
        Next
        If $wHandle > 0 Then
            ExitLoop
        ElseIf $timer >= 10 Then
            $errormsg = "Application timed out while trying to create a new mail window."
            error_close()
        Else
            $timer = $timer + .15
        EndIf
    WEnd
EndFunc
    

Func forceexit()
    Exit
EndFunc

    
; send email for feedback note to rayn.bailey@health-first.org

This probably won't run right on an external PC bc it pulls images from a private network drive

Share this post


Link to post
Share on other sites



Shouldn't that be:

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $Submit
            Submit()
        Case $msg = $Page1
            ExitLoop
    EndSelect
WEnd

Jos :)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

holy cow bells...so I did it that way before and I got nothing. Just did it again to no avail BUT I added GUIDelete() right before the end of the function and it worked.

Thank you mucho mucho again Je maintiendrai!!

Share this post


Link to post
Share on other sites

Thank you mucho mucho again Je maintiendrai!!

You're welcome ...and the name is Jos.

"Je maintiendrai" has a total different meaning which I am sure you will figure out easily. :)

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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