Jump to content

IE Kiosk GUI - Print W/O dialog?


 Share

Recommended Posts

Here's the story:

The company I work for (kind of like an amusement park, but with only 1 ride) wants me to set up some touchscreen kiosks for guests to check in with - here's what I've got so far (URLs changed to protect the not-so-innocent):

#include <ButtonConstants.au3>
#include <IE.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>

; #INDEX# =======================================================================================================================
; Title .........: Full-Screen IE-based Kiosk Web Browser w/ Virtual Keyboard
; AutoIt Version : 3.3.6
; Language ......: English
; Description ...: Kiosk software for touchscreens
; Author(s) .....: CanHasDIY, special thanks to Orion @ autoitscripts.com for the keyboard stuff!
; ===============================================================================================================================

;;;;;;;;;;;;;;;;;;;;;;;;;;Create Browser Window;;;;;;;;;;;;;;;;;;;;;;;;;;;;

$GUI = GUICreate("TITLE OF WINDOW", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
_IECreateEmbedded( )
$object = ObjCreate("Shell.Explorer.2")
$object_ctrl = GUICtrlCreateObj($object, 1, 1, 1279, 670)
$Pic1 = GUICtrlCreatePic("RIGHTIMAGE.bmp", 640, 670, 640, 355)
$Pic2 = GUICtrlCreatePic("LEFTIMAGE.bmp", 0, 670, 640, 355)

_IENavigate($object, "http://www.example.com")
GUISetState()

;;;;;;;;;;;;;;;;;;;;;;;;;; Create Virtual Keyboard;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

            $WS_EX_NOACTIVATE = 0x08000000
            $MA_NOACTIVATE = 3
            $MA_NOACTIVATEANDEAT = 4

            HotKeySet("{ESC}", "On_Exit")

            $hGUI = GUICreate("keyboard", 840, 350, 210, 673, $WS_POPUPWINDOW, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST, $WS_EX_NOACTIVATE))
            $dummy1 = GUICtrlCreateDummy()

            $1 = GUICtrlCreateButton("1", 0, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\1.bmp")
            $2 = GUICtrlCreateButton("2", 70, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\2.bmp")
            $3 = GUICtrlCreateButton("3", 140, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\3.bmp")
            $4 = GUICtrlCreateButton("4", 210, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\4.bmp")
            $5 = GUICtrlCreateButton("5", 280, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\5.bmp")
            $6 = GUICtrlCreateButton("6", 350, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\6.bmp")
            $7 = GUICtrlCreateButton("7", 420, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\7.bmp")
            $8 = GUICtrlCreateButton("8", 490, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\8.bmp")
            $9 = GUICtrlCreateButton("9", 560, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\9.bmp")
            $0 = GUICtrlCreateButton("0", 630, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\0.bmp")
            $Minus = GUICtrlCreateButton("-", 700, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\-.bmp")
            $Equal = GUICtrlCreateButton("=", 770, 0, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\=.bmp")
            $q = GUICtrlCreateButton("q", 0, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\Q.bmp")
            $w = GUICtrlCreateButton("w", 70, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\W.bmp")
            $e = GUICtrlCreateButton("e", 140, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\E.bmp")
            $r = GUICtrlCreateButton("r", 210, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\R.bmp")
            $t = GUICtrlCreateButton("t", 280, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\T.bmp")
            $y = GUICtrlCreateButton("y", 350, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\Y.bmp")
            $u = GUICtrlCreateButton("u", 420, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\U.bmp")
            $i = GUICtrlCreateButton("i", 490, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\I.bmp")
            $o = GUICtrlCreateButton("o", 560, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\O.bmp")
            $p = GUICtrlCreateButton("p", 630, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\P.bmp")
            $LeftBrackets = GUICtrlCreateButton("[", 700, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\[.bmp")
            $RightBrackets = GUICtrlCreateButton("]", 770, 70, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\].bmp")
            $a = GUICtrlCreateButton("a", 0, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\A.bmp")
            $s = GUICtrlCreateButton("s", 70, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\S.bmp")
            $d = GUICtrlCreateButton("d", 140, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\D.bmp")
            $f = GUICtrlCreateButton("f", 210, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\F.bmp")
            $g = GUICtrlCreateButton("g", 280, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\G.bmp")
            $h = GUICtrlCreateButton("h", 350, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\H.bmp")
            $j = GUICtrlCreateButton("j", 420, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\J.bmp")
            $k = GUICtrlCreateButton("k", 490, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\K.bmp")
            $l = GUICtrlCreateButton("l", 560, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\L.bmp")
            $Colon = GUICtrlCreateButton(";", 630, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\;.bmp")
            $Apostrophe = GUICtrlCreateButton("'", 700, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\'.bmp")
            $LeftSlash = GUICtrlCreateButton("\", 770, 140, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\LeftSlash.bmp")
            $z = GUICtrlCreateButton("z", 0, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\Z.bmp")
            $x = GUICtrlCreateButton("x", 70, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\X.bmp")
            $c = GUICtrlCreateButton("c", 140, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\C.bmp")
            $v = GUICtrlCreateButton("v", 210, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\V.bmp")
            $b = GUICtrlCreateButton("b", 280, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\B.bmp")
            $n = GUICtrlCreateButton("n", 350, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\N.bmp")
            $m = GUICtrlCreateButton("m", 420, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\M.bmp")
            $Comma = GUICtrlCreateButton(",", 490, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\,.bmp")
            $Dot = GUICtrlCreateButton(".", 560, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\..bmp")
            $bslash = GUICtrlCreateButton("/", 630, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\bslash.bmp")
            $back = GUICtrlCreateButton("back", 700, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\back.bmp")
            $enter = GUICtrlCreateButton("enter", 770, 210, 70, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\enter.bmp")
            $LeftShift = GUICtrlCreateButton("Shift", 0, 280, 140, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\Shift.bmp")
            $RightShift = GUICtrlCreateButton("Shift", 700, 280, 140, 70, $BS_BITMAP)
            GUICtrlSetImage(-1, "keys\Shift.bmp")
            GUICtrlCreateButton("space", 140, 280, 560, 70, $BS_BITMAP)
            $Space = GUICtrlSetImage(-1, "keys\space.bmp")


            $dummy2 = GUICtrlCreateDummy()
            GUISetState()

            GUIRegisterMsg($WM_MOUSEACTIVATE, 'WM_EVENTS')



            While 1
                $msg = GUIGetMsg()
                Switch $msg
                    Case $GUI_EVENT_CLOSE
                        Exit
                    Case $dummy1 To $dummy2
                        Local $sText = ControlGetText($hGUI, "", $msg)
                        ; Write key
                        If $sText = "space" Then
                            Send("{SPACE}")
                        ElseIf $sText = "bslash" Then
                            Send("/")
                        ElseIf $sText = "back" Then
                            Send("{Backspace}")
                        ElseIf $sText = "enter" Then
                            Send("{ENTER}")
                        ElseIf $sText = "Shift" Then
                            Send("{SHIFTDOWN}")
                            GUICtrlDelete($LeftShift)
                            GUICtrlDelete($RightShift)
                            GUICtrlDelete($4)
                            GUICtrlDelete($1)
                            GUICtrlDelete($2)
                            GUICtrlDelete($3)
                            GUICtrlDelete($5)
                            GUICtrlDelete($6)
                            GUICtrlDelete($7)
                            GUICtrlDelete($8)
                            GUICtrlDelete($9)
                            GUICtrlDelete($0)
                            GUICtrlDelete($Minus)
                            GUICtrlDelete($Equal)
                            GUICtrlDelete($LeftBrackets)
                            GUICtrlDelete($RightBrackets)
                            GUICtrlDelete($LeftSlash)
                            GUICtrlDelete($Apostrophe)
                            GUICtrlDelete($Colon)
                            GUICtrlDelete($Comma)
                            GUICtrlDelete($Dot)
                            GUICtrlDelete($bslash)
                            $4 = GUICtrlCreateButton("4", 210, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\$.bmp")
                            $1 = GUICtrlCreateButton("1", 0, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\!.bmp")
                            $2 = GUICtrlCreateButton("2", 70, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\@.bmp")
                            $3 = GUICtrlCreateButton("3", 140, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\#.bmp")
                            $5 = GUICtrlCreateButton("5", 280, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\%.bmp")
                            $6 = GUICtrlCreateButton("6", 350, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\^.bmp")
                            $7 = GUICtrlCreateButton("7", 420, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\&.bmp")
                            $8 = GUICtrlCreateButton("8", 490, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\star.bmp")
                            $9 = GUICtrlCreateButton("9", 560, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\(.bmp")
                            $0 = GUICtrlCreateButton("0", 630, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\).bmp")
                            $Minus = GUICtrlCreateButton("-", 700, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\_.bmp")
                            $Equal = GUICtrlCreateButton("=", 770, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\+.bmp")
                            $LeftBrackets = GUICtrlCreateButton("[", 700, 70, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\{.bmp")
                            $RightBrackets = GUICtrlCreateButton("]", 770, 70, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\}.bmp")
                            $LeftSlash = GUICtrlCreateButton("\", 770, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\slash2.bmp")
                            $Apostrophe = GUICtrlCreateButton("'", 700, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\par.bmp")
                            $Colon = GUICtrlCreateButton(";", 630, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\colon2.bmp")
                            $Comma = GUICtrlCreateButton(",", 490, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\,2.bmp")
                            $Dot = GUICtrlCreateButton(".", 560, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\.2.bmp")
                            $bslash = GUICtrlCreateButton("/", 630, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\question.bmp")
                            $LeftShiftd = GUICtrlCreateButton("Shiftd", 0, 280, 140, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\Shiftd.bmp")
                            $RightShiftd = GUICtrlCreateButton("Shiftd", 700, 280, 140, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\Shiftd.bmp")
                        ElseIf $sText = "Shiftd" Then
                            Send("{SHIFTUP}")
                            GUICtrlDelete($LeftShiftd)
                            GUICtrlDelete($RightShiftd)
                            GUICtrlDelete($4)
                            GUICtrlDelete($1)
                            GUICtrlDelete($2)
                            GUICtrlDelete($3)
                            GUICtrlDelete($5)
                            GUICtrlDelete($6)
                            GUICtrlDelete($7)
                            GUICtrlDelete($8)
                            GUICtrlDelete($9)
                            GUICtrlDelete($0)
                            GUICtrlDelete($Minus)
                            GUICtrlDelete($Equal)
                            GUICtrlDelete($LeftBrackets)
                            GUICtrlDelete($RightBrackets)
                            GUICtrlDelete($LeftSlash)
                            GUICtrlDelete($Apostrophe)
                            GUICtrlDelete($Colon)
                            GUICtrlDelete($Comma)
                            GUICtrlDelete($Dot)
                            GUICtrlDelete($bslash)
                            $4 = GUICtrlCreateButton("4", 210, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\4.bmp")
                            $1 = GUICtrlCreateButton("1", 0, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\1.bmp")
                            $2 = GUICtrlCreateButton("2", 70, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\2.bmp")
                            $3 = GUICtrlCreateButton("3", 140, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\3.bmp")
                            $5 = GUICtrlCreateButton("5", 280, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\5.bmp")
                            $6 = GUICtrlCreateButton("6", 350, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\6.bmp")
                            $7 = GUICtrlCreateButton("7", 420, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\7.bmp")
                            $8 = GUICtrlCreateButton("8", 490, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\8.bmp")
                            $9 = GUICtrlCreateButton("9", 560, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\9.bmp")
                            $0 = GUICtrlCreateButton("0", 630, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\0.bmp")
                            $Minus = GUICtrlCreateButton("-", 700, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\-.bmp")
                            $Equal = GUICtrlCreateButton("=", 770, 0, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\=.bmp")
                            $LeftBrackets = GUICtrlCreateButton("[", 700, 70, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\[.bmp")
                            $RightBrackets = GUICtrlCreateButton("]", 770, 70, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\].bmp")
                            $LeftSlash = GUICtrlCreateButton("\", 770, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\LeftSlash.bmp")
                            $Apostrophe = GUICtrlCreateButton("'", 700, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\'.bmp")
                            $Colon = GUICtrlCreateButton(";", 630, 140, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\;.bmp")
                            $Comma = GUICtrlCreateButton(",", 490, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\,.bmp")
                            $Dot = GUICtrlCreateButton(".", 560, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\..bmp")
                            $bslash = GUICtrlCreateButton("/", 630, 210, 70, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\bslash.bmp")
                            $LeftShift = GUICtrlCreateButton("Shift", 0, 280, 140, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\Shift.bmp")
                            $RightShift = GUICtrlCreateButton("Shift", 700, 280, 140, 70, $BS_BITMAP)
                            GUICtrlSetImage(-1, "keys\Shift.bmp")

                        Else
                            Send($sText)
                        EndIf

                EndSwitch
            WEnd

            Func WM_EVENTS($hWndGUI, $MsgID, $WParam, $LParam)
                Switch $hWndGUI
                    Case $hGUI
                        Switch $MsgID
                            Case $WM_MOUSEACTIVATE
                                ; Check mouse position
                                Local $aMouse_Pos = GUIGetCursorInfo($hGUI)
                                If $aMouse_Pos[4] <> 0 Then
                                    Local $word = _WinAPI_MakeLong($aMouse_Pos[4], $BN_CLICKED)
                                    _SendMessage($hGUI, $WM_COMMAND, $word, GUICtrlGetHandle($aMouse_Pos[4]))
                                    SoundPlay("Type.wav")
                                EndIf
                                Return $MA_NOACTIVATEANDEAT
                        EndSwitch
                EndSwitch
                Return $GUI_RUNDEFMSG
            EndFunc   ;==>WM_EVENTS

            Func On_Exit()
                Exit
            EndFunc   ;==>On_Exit

;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Keyboard Script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
    EndSelect
WEnd

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;End Browser Script;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

I want this program/script to automatically print without invoking the print dialog (or at the very least, without letting the user interact w/ the print dialog) when a Javascript "Print" button is clicked on a particular URL (let's call it http://www.example.com/print for arguments' sake). The problem is, from what I've read, it's neigh impossible to suppress the Print Dialog in IE locally.

Any help offered will be much appreciated; and no, I don't want you to code it for me, I just need to be pointed in the right direction...

Also, any constructive input regarding the GUI itself is welcome (Big thanks to Orion for his virtual keyboard script!); I'd eventually like to see this script propagated around the globe as an Open-Source alternative to expensive, purpose-built kiosk software.

Thanks (and sorry) in advance!

C.H.DIY - Unofficial AutoIT Neophyte

Edited by CanHasDIY

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

Link to comment
Share on other sites

... Forgot to attach the file...

My Bad...

I haven't studied your code, but if you want to print the page that is displayed in IE then all you have to do is to save the body as an html file and pass that file to this function.

Func _PrintHTML($p_file);jamesmg print function
    If FileExists($p_file) Then RunWait(@COMSPEC&' /c rundll32.exe ' & @SystemDir & '\mshtml.dll,PrintHTML "' & $p_file & '"',@TempDir,@SW_HIDE)
EndFun
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I haven't studied your code, but if you want to print the page that is displayed in IE then all you have to do is to save the body as an html file and pass that file to this function.

Func _PrintHTML($p_file);jamesmg print function
    If FileExists($p_file) Then RunWait(@COMSPEC&' /c rundll32.exe ' & @SystemDir & '\mshtml.dll,PrintHTML "' & $p_file & '"',@TempDir,@SW_HIDE)
EndFun

How would I go about getting AutoIT to communicate with the webpage/Javascript?

Better yet, what part of the helpfile should I be looking to for answers? I'd rather learn it for myself... If I can figure out where I'm going wrong in the browser/AutoIT communications dept, I can probably re-write the script to be a lot cleaner and more effective...

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

Link to comment
Share on other sites

How would I go about getting AutoIT to communicate with the webpage/Javascript?

Better yet, what part of the helpfile should I be looking to for answers? I'd rather learn it for myself... If I can figure out where I'm going wrong in the browser/AutoIT communications dept, I can probably re-write the script to be a lot cleaner and more effective...

I was thinking of _IEDocReadHTML, but if the display is partly created by a java script then I don't think that would work and I misunderstood that you needed to intercept the Print button in the browser document.

Are you using an embedded IE because you want to design the display as a you would a web page, or is the design something which exists and you have to deal with?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I was thinking of _IEDocReadHTML, but if the display is partly created by a java script then I don't think that would work and I misunderstood that you needed to intercept the Print button in the browser document.

Are you using an embedded IE because you want to design the display as a you would a web page, or is the design something which exists and you have to deal with?

The document in question is a mix of Javascript and Coldfusion; I can post the relevant portions of the source if you think it would help.

As for the reason why I'm using embedded IE, it's a combination of factors - The document is going to be served from an intranet Coldfusion server, plus the fact that I'm not all too familiar with AutoIT GUI creation (up to this point I've only used AutoIT to automate various system and network administration processes). If you can think of an easier way to make this work I'm all ears.

BTW, Thanks for helping me get this worked out.

Edited by CanHasDIY

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

Link to comment
Share on other sites

Problem Solved!

We ended up finding an ActiveX control (plus some corresponding Javascript) that allows us to print w/o the print dialog popping up; OK, so it took a bit more than adding an ActiveX control - I also had to add the domain to the 'Local Intranet' zone under the Security tab - but by golly it's workin'!

Here's the js/activex code if anyone is curious:

<script language="javascript" type="text/javascript">
   // <!CDATA[
   function Button1_onclick() {
       window.print();
   }
   // ]]>
</script>
<script language="VBScript">
   Sub Print()
       OLECMDID_PRINT = 6
       OLECMDEXECOPT_DONTPROMPTUSER = 2
       OLECMDEXECOPT_PROMPTUSER = 1
       call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
   End Sub
      document.write "<object ID='WB' WIDTH=0 HEIGHT=0 CLASSID='CLSID:8856F961-340A-11D0-A96B-00C04FD705A2'></object>"
</script>

# Don't forget the "Print" button!

<input type="button" id="Button1" onclick="Button1_onclick()" value="Print" class="button" />

Thanks for the help, martin!

P.S. I would still greatly appreciate any constructive critique of mah kiosk script that anyone would like to offer...

Edited by CanHasDIY

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

Link to comment
Share on other sites

The document in question is a mix of Javascript and Coldfusion; I can post the relevant portions of the source if you think it would help.

As for the reason why I'm using embedded IE, it's a combination of factors - The document is going to be served from an intranet Coldfusion server, plus the fact that I'm not all too familiar with AutoIT GUI creation (up to this point I've only used AutoIT to automate various system and network administration processes). If you can think of an easier way to make this work I'm all ears.

BTW, Thanks for helping me get this worked out.

Maybe I'm steering you in the wrong direction. Perhaps you shouldn't worry about the print dialog but just react to it. If the operator of the kiosk hits the Print button and something flashes up and disappears I doubt it will worry him. When that happens to me I usually think "Ah, good, something is happening." As an example, try this

#include <windowsconstants.au3>
$gui = GUICreate("",400,400,100,100);,$WS_POPUP)
GUISetFont(20)
GUICtrlCreatelabel("Printing......",10,100)
GUICtrlCreatelabel("...... please wait",40,200)

winwaitactive("Print")
$ws = WinGetPos("Print")
winmove($gui,"",$ws[0],$ws[1],$ws[2],$ws[3])
GUISetState(@SW_SHOW,$Gui)
WinSetOnTop($gui,"",1)
ControlSend("Print","","[CLASS:ComboBox;INSTANCE:1]","Cute");Select Cute pdf, you could Send("Epson abc100") for example
ControlClick("Print","", "[CLASS:Button;INSTANCE:10]")
sleep(2000)

EDIT: I hadn't seen your last post which looks good. Also, the script here was for Firefox not IE. :(

Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Maybe I'm steering you in the wrong direction. Perhaps you shouldn't worry about the print dialog but just react to it. If the operator of the kiosk hits the Print button and something flashes up and disappears I doubt it will worry him. When that happens to me I usually think "Ah, good, something is happening." As an example, try this

#include <windowsconstants.au3>
$gui = GUICreate("",400,400,100,100);,$WS_POPUP)
GUISetFont(20)
GUICtrlCreatelabel("Printing......",10,100)
GUICtrlCreatelabel("...... please wait",40,200)

winwaitactive("Print")
$ws = WinGetPos("Print")
winmove($gui,"",$ws[0],$ws[1],$ws[2],$ws[3])
GUISetState(@SW_SHOW,$Gui)
WinSetOnTop($gui,"",1)
ControlSend("Print","","[CLASS:ComboBox;INSTANCE:1]","Cute");Select Cute pdf, you could Send("Epson abc100") for example
ControlClick("Print","", "[CLASS:Button;INSTANCE:10]")
sleep(2000)

EDIT: I hadn't seen your last post which looks good. Also, the script here was for Firefox not IE. :(

S'all good, I was planning on giving the Firefox UDF a go once I got the IE version of the kiosk working (Yea, I hate IE too, but the boss loves it and you gotta do what you gotta do); that way the term "Open Kiosk Browser" is a bit less of a misnomer.

Also planned (granted there's enough interest in the project to justify spending time on it):

- management interface

- multiple key styles for virtual keyboard

- anything else that suits my fancy

Open to suggestions...

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

Link to comment
Share on other sites

Now that printing is figured out, I've got a couple of new issues:

1) I need to embed the keyboard into the GUI window so that when I move the IE window to a new screen (trying out a multiscreen setup) the keyboard follows

2) I need each instance of the keyboard to interact only with the instance of IE that it is attached to

Thanks ahead of time for the help, and let me know if I should start a new thread for the new questions.

Be nice to the newbies... we were all there once...[size="3"]Being right too soon is socially unacceptable. - R. Heinlein[/size]My Projects:OpenKiosk Browser

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