Jump to content

GUI PartSurfer Automation (HP)


Recommended Posts

Hey guys, this would be under another forum, but I am in need of support.

First, the code

#include <GUIConstants.au3>
#include <IE.au3>
#include <DellFunctions.au3>
; Simple example: Embedding an Internet Explorer Object inside an AutoIt GUI
;
; The full example is available in the test\ActiveX directory (TestXInternet.au3)
;
; See also: http://msdn.microsoft.com/workshop/browser/webbrowser/reference/objects/internetexplorer.asp

$oIE = ObjCreate("Shell.Explorer.2")

; Create a simple GUI for our output
GUICreate ( "Embedded Web control Test", 800, 600,(@DesktopWidth-640)/2, (@DesktopHeight-580)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)
$GUIActiveX      = GUICtrlCreateObj   ( $oIE,     10, 40 , 780 , 500 )
$GUI_Button_Back    = GuiCtrlCreateButton   ("Back",     10, 550, 100,  30)
$GUI_Button_Forward = GuiCtrlCreateButton   ("Forward", 120, 550, 100,  30)
$GUI_Button_Home    = GuiCtrlCreateButton   ("Home",    230, 550, 100,  30)
$GUI_Button_Stop    = GuiCtrlCreateButton   ("Stop",    330, 550, 100,  30)
$GUI_Button_Service = GuiCtrlCreateButton   ("Service", 440, 550, 100,  30)

GUISetState ()   ;Show GUI

$oIE.navigate("http://www5.itrc.hp.com/service/ewarranty/warrantyInput.do?admit=552267591+1140789246792+28353475")
; Waiting for user to close the window
While 1
    $msg = GUIGetMsg()
    
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $GUI_Button_Home
            $oIE.navigate("http://www5.itrc.hp.com/service/ewarranty/warrantyInput.do?admit=552267591+1140789246792+28353475")
        Case $msg = $GUI_Button_Back
            $oIE.GoBack
        Case $msg = $GUI_Button_Forward
            $oIE.GoForward
        Case $msg = $GUI_Button_Stop
            $oIE.Stop
        Case $msg = $GUI_Button_service
        ServiceTag()
    EndSelect
    
Wend

GUIDelete ()

Exit

Func ServiceTag()
$strComputer= Inputbox("test", "test", "")
$serv_tag = _GetDellServTag($strComputer)

$o_form  = _IEFormGetObjByName($oIE, "ewarrantyWarrantyForm")
$o_tag    = _IEFormElementGetObjByName($o_form, "serialNumber1")
$o_country  = _IEFormGetObjByName($oIE, "country")
_IEFormElementSetValue($o_country, "US")
;_IEFormElementSetValue($o_country, "United States")
_IEFormElementSetValue($o_tag, $serv_tag)
Sleep(250)
_IEFormSubmit($o_form)

;MsgBox(0, $o_tag, $o_tag)
EndFunc

As you can see, I am using 2 external sources, which can be found using the search feature in the forums.

Much credit to people who help out here,

And thanks to Nuffilein805's post here for the initial GUI.

The purpose is to type in the Computer name on the Domain.. It fectches the Service Tag or Serial (HP) and then submits the form on HPs website.

My Problem: I cannot set it to goto United States before submitting the form..

Can anyone Help?

Thanks to everyone!

Links:

How to open an internet site with a script

Link to DellFunctions.au3

IE UDF

Link to comment
Share on other sites

It looks like you know what you are doing, so this this is probably just an "oops".

I think all you need to do is replace:

$o_country  = _IEFormGetObjByName($oIE, "country")

with

$o_country  = _IEFormElementGetObjByName($o_form, "country")

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

It looks like you know what you are doing, so this this is probably just an "oops".

I think all you need to do is replace:

$o_country  = _IEFormGetObjByName($oIE, "country")

with

$o_country  = _IEFormElementGetObjByName($o_form, "country")

Dale

Big Thanks Dale!! Fixed!

I am writing a Warranty Program that'll remotely determine the brand of computer by querying the Brand of Computer. Then goto the appropriate website and automatically submit the appropriate form.

Any chance on grabbing data from the embedded page? Like say if I wanted to store the Expiration date in a variable, is that possible?

Link to comment
Share on other sites

Any chance on grabbing data from the embedded page? Like say if I wanted to store the Expiration date in a variable, is that possible?

Yes, you can get to everything if you know how to ask for it. You may be able to use _IEFormElementGetValue() or you can use _IEBodyReadHTML() and parse the results... or you can study up on the DOM and find lots of other options.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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...