Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/02/2019 in all areas

  1. Gianni

    PDF viewer

    just an idea, are your clients equipped with PDF rendering by the browser?, if so then, according to what is explained here ( https://pdfobject.com/static/ ) , you can embed PDFs directly into the browser (I mean IE), thus, if we embed the webbrowser control into our AutoIt GUI, we can use it as a simple embeddable PDF viewer. The script below is a quick and dirty example of what I'm talking about. (just done a quick test and not an in depth testing, thus possible bugs could arise), of course making use of the PDFObject javascript should give more control over the embedded pdf. Hope it can be of use for you. #include <GUIConstantsEx.au3> #include <FileConstants.au3> Example() Func Example() Local $sPDF_path Local $Gui = GUICreate("PDF Viewer", 900, 600) GUISetBkColor(0xa0d0a0) Local $oIE_Obj = ObjCreate("Shell.Explorer.2") ; Instantiate a BrowserControl GUICtrlCreateObj($oIE_Obj, 5, 5, 780, 590); Place the BrowserControl on the GUI $oIE_Obj.navigate('about:blank') Local $hButtonLoad = GUICtrlCreateButton("Load pdf", 795, 5, 100, 295) Local $hButtonExit = GUICtrlCreateButton("Exit", 795, 300, 100, 295) GUISetState() While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE ExitLoop Case $idMsg = $hButtonLoad ; Display an open dialog to select a pdf document. $sPDF_path = FileOpenDialog("select a pdf document", @ScriptDir & "\", "pdf (*.pdf)", $FD_FILEMUSTEXIST) If Not @error Then $oIE_Obj.Stop() ; stop loadinh (if any in progress) $oIE_Obj.document.Write(MakeHTML($sPDF_path)) ; inject lising directly to the HTML document $oIE_Obj.document.execCommand("Refresh") EndIf Case $idMsg = $hButtonExit ExitLoop EndSelect WEnd GUIDelete() EndFunc ;==>Example Func MakeHTML($sPdfPath = '') Local $sHTML = '<html>' & @CRLF & _ '<head>' & @CRLF & _ '<meta http-equiv="X-UA-Compatible" content="IE=edge" />' & @CRLF & _ '</head>' & @CRLF & _ '<body>' & @CRLF & _ '<div class="container">' & @CRLF & _ ' <div class="pdf">' & @CRLF & _ ' <object data="' & $sPdfPath & '" type="application/pdf" width="100%" height="100%">' & @CRLF & _ ' <iframe src="' & $sPdfPath & '" width="100%" height="100%" style="border: none;">' & @CRLF & _ ' This browser does not support PDFs. Please download the PDF to view it: ' & @CRLF & _ ' <a href="' & $sPdfPath & '">Download PDF</a>' & @CRLF & _ ' </iframe>' & @CRLF & _ ' </object>' & @CRLF & _ ' </div>' & @CRLF & _ '</div>' & @CRLF & _ '</body>' & @CRLF & _ '</html>' Return $sHTML EndFunc ;==>MakeHTML
    1 point
  2. You could just use a string then Global $sListViewItem = "" For $i = 1 To $aFileList[0] $sListViewItem = IniRead($SaveLoc &'\'& $aFileList[$i], "Request Info", "ReqNum",'') $sListViewItem &= "|" & IniRead($SaveLoc &'\'& $aFileList[$i], "Request Info", "ItemNum",'') $sListViewItem &= "|" & IniRead($SaveLoc &'\'& $aFileList[$i], "Request Info", "RMANum",'') ; lots more rows GUICtrlCreateListViewItem($sListViewItem, $lv_S_Requests) Next
    1 point
  3. jugador

    Curl from Command Line

    sorry @Sidley, overlook your code. @Jos, Thanks for pointing out. btw how to tag '@ + name' not doing the job.
    1 point
  4. 1 point
  5. There is no good way to change the background color in a disabled listview. But the usual workaround of placing the listview in a child window and then disable the child window instead of the listview works well in this situation: #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> Example() Func Example() Local $hGui = GUICreate("listview items", 220, 250, 100, 200, -1) GUISetBkColor(0x00151515) Local $hChild = GUICreate( "", 200, 150, 10, 10, $WS_POPUP, $WS_EX_MDICHILD, $hGui ) Local $idListview = GUICtrlCreateListView("col1 |col2|col3 ", 0, 0, 200, 150) Local $idItem1 = GUICtrlCreateListViewItem("item2|col22|col23", $idListview) Local $idItem2 = GUICtrlCreateListViewItem("item1|col12|col13", $idListview) Local $idItem3 = GUICtrlCreateListViewItem("item3|col32|col33", $idListview) GUICtrlSetColor($idListview, 0x0000FF00) GUICtrlSetBkColor($idListview, 0x00151515) GUISetState( @SW_SHOW, $hChild ) GUISwitch( $hGui ) Local $idButton = GUICtrlCreateButton("Disable /enable", 45, 170, 120, 20) Local $iState GUISetState(@SW_SHOW) GUICtrlSetData($idItem2, "ITEM1") GUICtrlSetData($idItem3, "||COL33") $iState = 0 GUISetState( @SW_DISABLE, $hChild ) ;GUICtrlSetState($idListview, 128) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idButton IF $iState = 0 Then ;GUICtrlSetState($idListview, 64) GUISetState( @SW_ENABLE, $hChild ) $iState = 1 Else ;GUICtrlSetState($idListview, 128) Local $aIndex = _GUICtrlListView_GetSelectedIndices( $idListview, True ) _GUICtrlListView_SetItemSelected( $idListview, $aIndex[0] ? $aIndex[1] : -1, False ) GUISetState( @SW_DISABLE, $hChild ) $iState = 0 EndIf EndSwitch WEnd EndFunc When the child window becomes disabled, the listview is also disabled. But the background color does not change.
    1 point
  6. @boat_58 Use a different counter. Instead of $n, use $m, or the classic $i and $j. Add some ConsoleWrite() in each For so you can see what's going on. By the way, Mouse* functions are not the best solution to automate things. If you tell us what you are trying to automate, there could be a better solution that fits your needs
    1 point
×
×
  • Create New...