BenfnJovi Posted May 31, 2009 Share Posted May 31, 2009 I need to create an application that will run in the forground and control a webpage, including text input. It will be used on a touch screen based machine. For my first version, I've started by creating a GUI with the IE embedded function and I've gotten all my buttons that point to links to work fine. However, I cant get the buttons that represent a keystroke to translate to the appropriate text box within the webpage. It acts as though when the button is pressed, the embedded IE looses focus. Any help on this would be greatly appreciated. I have about three days to get it working and I've only been using AutoIt for about a week...lol Sorry for being a newb. Getting back to my topic title,... after I get the first version working and in use... I want to create a GUI that will take over the entire screen and translate the buttons pressed in the GUI, to the webpage running in the background and also display a text box that represents whats being inputed into the IE text boxes...(For example: login, dollar amount taken in, and dollar amount owed ...etc) Thank you in advance for any advice or any suggestions on appropriate functions. Link to comment Share on other sites More sharing options...
BenfnJovi Posted May 31, 2009 Author Share Posted May 31, 2009 Here is my code... I started with the example in the Help feature. The webpage that I will be using must be kept confidential is the reason I used msn for this example. expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $oIE, $GUIActiveX, $GUI_Button_MakeCard, $GUI_Button_AddCredits Local $GUI_Button_Home, $GUI_Button_Logout, $msg, $GUI_Button_5, $GUI_Button_10, $GUI_Button_20, $GUI_Button_50 $oIE = ObjCreate("Shell.Explorer.2") GUICreate("J&M POS", 800, 600, (@DesktopWidth - 800) / 2, (@DesktopHeight - 600) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $GUIActiveX = GUICtrlCreateObj ($oIE,2,4,800,400) $GUI_Button_MakeCard = GUICtrlCreateButton("Create Card", 20, 420, 100, 50) $GUI_Button_AddCredits = GUICtrlCreateButton("Add Credits", 120, 420, 100, 50) $GUI_Button_Home = GUICtrlCreateButton("Home", 220, 420, 100, 50) $GUI_Button_Logout = GUICtrlCreateButton("Logout", 320, 420, 100, 50) $GUI_Button_5 = GUICtrlCreateButton("$5", 520, 420, 100, 50) $GUI_Button_10 = GUICtrlCreateButton("$10", 620, 420, 100, 50) $GUI_Button_20 = GUICtrlCreateButton("$20", 520, 470, 100, 50) $GUI_Button_50 = GUICtrlCreateButton("$50", 620, 470, 100, 50) GUISetState() $oIE.navigate("http://www.msn.com/") While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Home $oIE.navigate("http://www.msn.com/") Case $msg = $GUI_Button_MakeCard $oIE.navigate("http://www.msn.com/") Case $msg = $GUI_Button_AddCredits $oIE.navigate("http://www.msn.com/") ;The send is the first problem I need to get around. The keystroke isn't sent to the embedded Browser. I've tried winactivate but it just opened a new IE window and then inputed the text. send ("{enter}") Case $msg = $GUI_Button_Logout $oIE.navigate("httop://www.msn.com/") Case $msg = $GUI_Button_5 ;I only need these to be sent to the cursor in the input box which apears automatically(like the search bar on msn.com)... I've tried winactivate but it just opened a new IE window and then inputed the text. What am I missing? Send("5") Case $msg = $GUI_Button_10 send ("10") Case $msg = $GUI_Button_20 send ("20") Case $msg = $GUI_Button_50 send ("50") EndSelect WEnd GUIDelete() EndFunc Link to comment Share on other sites More sharing options...
BenfnJovi Posted June 2, 2009 Author Share Posted June 2, 2009 I got it...Here is what I got to work..thanks anyway! expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Include <WinAPI.au3> #include <IE.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $oIE, $GUIActiveX, $GUI_Button_MakeCard, $GUI_Button_AddCredits, $GUI_Button_Print, $GUI_Button_CashoutCard Local $GUI_Button_Logout, $GUI_Button_CloseShift, $msg, $GUI_Button_5, $GUI_Button_10, $GUI_Button_15, $GUI_Button_20, $GUI_Button_25, $GUI_Button_50, $GUI_Button_100 Local $font, $GUI_Button_OpenShift $oIE = ObjCreate("Shell.Explorer.2") GUICreate("J&M POS", 1024, 768, (@DesktopWidth - 1024) / 2, (@DesktopHeight - 768) / 2, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN)) $GUIActiveX = GUICtrlCreateObj ($oIE,2,4,1024,420) $GUI_Button_Logout = GUICtrlCreateButton("Logout", 350, 490, 110, 50) $GUI_Button_CloseShift = GUICtrlCreateButton("Close Shift", 350, 540, 110, 50) $GUI_Button_OpenShift = GUICtrlCreateButton("OpenShift", 350, 440, 110, 50) $font = "Times New Roman" GUISetFont(14, 600, 0, $font) $GUI_Button_MakeCard = GUICtrlCreateButton("Create Card", 20, 440, 140, 75) $GUI_Button_AddCredits = GUICtrlCreateButton("Add Credits", 170, 440, 140, 75) $GUI_Button_CashoutCard = GUICtrlCreateButton("Cashout Card", 20, 550, 140, 75) $font = "Times New Roman" GUISetFont(16, 600, 0, $font) $GUI_Button_5 = GUICtrlCreateButton("$5", 680, 440, 100, 75) $GUI_Button_10 = GUICtrlCreateButton("$10", 790, 440, 100, 75) $GUI_Button_15 = GUICtrlCreateButton("$15", 900, 440, 100, 75) $GUI_Button_20 = GUICtrlCreateButton("$20", 680, 525, 100, 75) $GUI_Button_25 = GUICtrlCreateButton("$25", 790, 525, 100, 75) $GUI_Button_50 = GUICtrlCreateButton("$50", 900, 525, 100, 75) $GUI_Button_100 = GUICtrlCreateButton("$100", 790, 610, 100, 75) $GUI_Button_Print = GUICtrlCreateButton("Print", 900, 610, 100, 75) GUISetState() $oIE.navigate("/aladmin/mainLogon.jsp") ;_WinAPI_SetFocus($oIE) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $GUI_Button_Logout $oIE.navigate("/aladmin/common.do?mainmenu=Logoff") Case $msg = $GUI_Button_MakeCard $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Case $msg = $GUI_Button_CashoutCard $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=CashOutCard") Case $msg = $GUI_Button_AddCredits $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=AddCredits") Case $msg = $GUI_Button_OpenShift $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=OpenShift") Case $msg = $GUI_Button_CloseShift $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=CloseShift") Case $msg = $GUI_Button_5 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("5") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") ;send("^p") Case $msg = $GUI_Button_10 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("10") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_15 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("15") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_20 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("20") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_25 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("25") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_50 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("50") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_100 $oIE.navigate("/aladmin/common.do?mainmenu=POS&submenu=SellNew") _IELoadWait ($oIE) send("{ENTER}") _IELoadWait ($oIE) send ("+{TAB 7}") Send("100") send("{TAB 6}") send("{ENTER}") _IELoadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") Case $msg = $GUI_Button_Print _IELOadWait ($oIE) _IEAction ($oIE, "PrintDefault") $oIE.navigate("/aladmin/close_pos_window.do") EndSelect WEnd GUIDelete() EndFunc Link to comment Share on other sites More sharing options...
momolau Posted June 2, 2009 Share Posted June 2, 2009 http://www.top50watches.comhttp://www.flyi...ryblog.comROLEX http://www.flyingzg.com/rolex-c-41.htmlLouis Vuitton bags http://www.eluxuryblog.com/louis-vuitton-bags-c-1.htmlALAIN SILBERSTEIN http://www.flyingzg.com/alain-silberstein-c-7.html ALANGE SOHNE http://www.flyingzg.com/alange-sohne-c-8.html ANONIMO http://www.flyingzg.com/anonimo-c-9.html AUDEMARS PIGUET http://www.flyingzg.com/audemars-piguet-c-10.html BALL http://www.flyingzg.com/ball-c-184.html BAUME MERCIER http://www.flyingzg.com/baume-mercier-c-11.html Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now