Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/04/2017 in all areas

  1. As you can see you have done a right-mouse-click on an au3 file and selected always open with notepad. There is a hint in that output how it can be fixed. Jos
    1 point
  2. To exchange data between autoit and javascript you need to set some settings in both environments. Take a look at the code lines marked with ; <--- to get an idea of the changes I've made. (p.s. Also have a look here for some further infos) #include-once #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <IE.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 801, 601, 192, 124) GUISetState(@SW_SHOW) Global $gmap, $oLat_Long ; <--- global variables (reference to the browser control and the location) map() Global $ohJS = $gmap.document.parentwindow.JSglobal ; <--- create a reference to javascript (JSglobal must be previously created in the html page) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch If $ohJS.lat_long <> $oLat_Long Then ; <--- check if location has changed $oLat_Long = $ohJS.lat_long ; <--- get reference to the coordinates object MsgBox(0,"AutoIt", "Following variables comes from javascript" & @CRLF & "and are read from within AutoIt" & @CRLF & @CRLF & "Location is:" & @CRLF & "Latitude: " & $ohJS.lat_long.lat() & @CRLF & "Longitude: " & $ohJS.lat_long.lng() ) ; <-- get coordinates EndIf WEnd Func map() $apikey = "AIzaSyBPQwec2vusz4JGzcBL__mJL2t1ZeIOYOA" $html = _ "<!DOCTYPE html>" & @CRLF & _ "<html>" & @CRLF & _ " <head>" & @CRLF & _ " <meta http-equiv=""X-UA-Compatible"" content=""IE=edge"" />" & @CRLF & _ ; <--- set up the browser control mode " <script type=""text/javascript"">" & @CRLF & _ ; <--- create some global variables " var JSglobal = (1,eval)(""this"");" & @CRLF & _ ; <--- this will be referenced from AutoIt " var lat_long;" & @CRLF & _ ; <--- temporary storage for coordinates " </script>" & @CRLF & _ " <meta name=""viewport"" content=""initial-scale=1.0, user-scalable=no"">" & @CRLF & _ " <meta charset=""utf-8"">" & @CRLF & _ " <title>On Click Draw Markers</title>" & @CRLF & _ "<style>" & @CRLF & _ " /* Always set the map height explicitly to define the size of the div" & @CRLF & _ " * element that contains the map. */" & @CRLF & _ " #map {" & @CRLF & _ " height: 100%;" & @CRLF & _ " }" & @CRLF & _ " /* Optional: Makes the sample page fill the window. */" & @CRLF & _ " html, body {" & @CRLF & _ " height: 100%;" & @CRLF & _ " margin: 0;" & @CRLF & _ " padding: 0;" & @CRLF & _ " }" & @CRLF & _ " #description {" & @CRLF & _ " font-family: Roboto;" & @CRLF & _ " font-size: 15px;" & @CRLF & _ " font-weight: 300;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #infowindow-content .title {" & @CRLF & _ " font-weight: bold;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #infowindow-content {" & @CRLF & _ " display: none;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #map #infowindow-content {" & @CRLF & _ " display: inline;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " .pac-card {" & @CRLF & _ " margin: 10px 10px 0 0;" & @CRLF & _ " border-radius: 2px 0 0 2px;" & @CRLF & _ " box-sizing: border-box;" & @CRLF & _ " -moz-box-sizing: border-box;" & @CRLF & _ " outline: none;" & @CRLF & _ " box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);" & @CRLF & _ " background-color: #fff;" & @CRLF & _ " font-family: Roboto;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #pac-container {" & @CRLF & _ " padding-bottom: 12px;" & @CRLF & _ " margin-right: 12px;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " .pac-controls {" & @CRLF & _ " display: inline-block;" & @CRLF & _ " padding: 5px 11px;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " .pac-controls label {" & @CRLF & _ " font-family: Roboto;" & @CRLF & _ " font-size: 13px;" & @CRLF & _ " font-weight: 300;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #pac-input {" & @CRLF & _ " background-color: #fff;" & @CRLF & _ " font-family: Roboto;" & @CRLF & _ " font-size: 15px;" & @CRLF & _ " font-weight: 300;" & @CRLF & _ " margin-left: 12px;" & @CRLF & _ " padding: 0 11px 0 13px;" & @CRLF & _ " text-overflow: ellipsis;" & @CRLF & _ " width: 400px;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #pac-input:focus {" & @CRLF & _ " border-color: #4d90fe;" & @CRLF & _ " }" & @CRLF & _ "" & @CRLF & _ " #title {" & @CRLF & _ " color: #fff;" & @CRLF & _ " background-color: #4d90fe;" & @CRLF & _ " font-size: 25px;" & @CRLF & _ " font-weight: 500;" & @CRLF & _ " padding: 6px 12px;" & @CRLF & _ " }" & @CRLF & _ " #target {" & @CRLF & _ " width: 345px;" & @CRLF & _ " }" & @CRLF & _ " </style>" & @CRLF & _ "" & @CRLF & _ "<script src=""https://maps.googleapis.com/maps/api/js?key="&$apikey&"&libraries=places&callback=initMap"" async defer></script>" & @CRLF & _ "<script>" & @CRLF & _ "var map;" & @CRLF & _ "function initMap() {" & @CRLF & _ " var lat_lng = {lat: 43.88967769200741, lng: 8.039529919624328};" & @CRLF & _ " map = new google.maps.Map(document.getElementById('map'), {" & @CRLF & _ " zoom: 15," & @CRLF & _ " center: lat_lng," & @CRLF & _ " mapTypeId: google.maps.MapTypeId.TERRAIN" & @CRLF & _ " });" & @CRLF & _ " // This event listener will call addMarker() when the map is clicked." & @CRLF & _ " map.addListener('click', function(event) {" & @CRLF & _ " addMarker(event.latLng);" & @CRLF & _ " });" & @CRLF & _ " //search autocomplete" & @CRLF & _ " var input = document.getElementById('pac-input');" & @CRLF & _ " var autocomplete = new google.maps.places.Autocomplete(input);" & @CRLF & _ " map.controls[google.maps.ControlPosition.TOP_LEFT].push(input);" & @CRLF & _ " autocomplete.addListener('place_changed', function() {" & @CRLF & _ " var XlatLng = new google.maps.LatLng(autocomplete.getPlace().geometry.location.lat(), autocomplete.getPlace().geometry.location.lng());" & @CRLF & _ " addMarker(XlatLng)" & @CRLF & _ " });" & @CRLF & _ "}" & @CRLF & _ "var markers = [];" & @CRLF & _ "// Adds a marker to the map and push to the array." & @CRLF & _ "function addMarker(location) {" & @CRLF & _ " var marker = new google.maps.Marker({" & @CRLF & _ " position: location," & @CRLF & _ " map: map" & @CRLF & _ " });" & @CRLF & _ " markers.push(marker);" & @CRLF & _ " for (var i = 0; i < markers.length; i++) {" & @CRLF & _ " if (markers[i].getPosition() != location) {" & @CRLF & _ " markers[i].setMap(null);" & @CRLF & _ " //Remove the marker from array." & @CRLF & _ " markers.splice(i, 1)" & @CRLF & _ " }" & @CRLF & _ " }" & @CRLF & _ " map.panTo(location);" & @CRLF & _ " lat_long = location;" & @CRLF & _ ; <--- store 'location' to a temp variable (it will be read from AutoIt) " alert('Hello from Javascript' + String.fromCharCode(13) + String.fromCharCode(13) + lat_long);" & @CRLF & _ "}" & @CRLF & _ " </script>" & @CRLF & _ " </head>" & @CRLF & _ " <body>" & @CRLF & _ " <input id=""pac-input"" class=""controls"" type=""text"" placeholder=""Search Box"">" & @CRLF & _ " <div id=""map""></div>" & @CRLF & _ " </body>" & @CRLF & _ "</html>" $gmap = _IECreateEmbedded() $gmap_ctrl = GUICtrlCreateObj($gmap, 5, 5, 750, 550) _IENavigate($gmap, "about:blank", 0) _IEDocWriteHTML($gmap, $html) EndFunc
    1 point
  3. Neutro

    AS400 tasks automation

    Welcome to the AS400 world PTFs are the windows updates of AS400, so IBM are providing them Fyi all moderns AS400 are virtual and run on an IBM hypervisior (the same way a VM runs on ESXi), so I recommend you backup your virtual AS400 image before trying anything
    1 point
  4. Just run this script in SciTE to show the current settings: #include <WindowsConstants.au3> #include <EditConstants.au3> #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=C:\Program Files (x86)\AutoIt3\Icons\au3.ico #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;*********************************************************** ; Scriptname: Get_AU3_Settings.au3 ; Script to display Registry setting for SciTE & AutoIt3 ; reporting possible issues with these settings ;*********************************************************** #include <StaticConstants.au3> #include <GUIConstantsEx.au3> _Check_Au3_Registry() ; Func _Check_Au3_Registry() Local $TotalMsg,$UserData Display_Console("******************************************************************************************************************************************" & @CRLF, $TotalMsg) Local $FixedOpen = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3", "Application") Local $FixedOpenW7 = RegRead("HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3\Userchoice", "ProgId") If $FixedOpen <> "" Then Display_Console("!* Found always open with :" & $FixedOpen & @CRLF, $TotalMsg) Display_Console('!* Fixed by removing Registry Hyve: "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3" Key:"Application"' & @CRLF, $TotalMsg) EndIf If $FixedOpenW7 <> "" Then Display_Console("!* Found always open with Win7 :" & $FixedOpenW7 & @CRLF, $TotalMsg) Display_Console('!* Fixed by removing Registry key : "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.au3\Userchoice"' & @CRLF, $TotalMsg) EndIf Local $au3prof = RegRead("HKCR\.au3", "") If $au3prof <> "AutoIt3Script" And $au3prof <> "AutoIt3ScriptBeta" Then Display_Console('!* Registry key: "HKCR\.au3" - "Default" is currently set to ' & $au3prof, $TotalMsg) Display_Console(' ==> This should be changed to "AutoIt3Script" (or "AutoIt3ScriptBeta")' & @CRLF, $TotalMsg) ;~ RegWrite("HKCR\.au3","","REG_SZ","AutoIt3Script") Else Display_Console("* HKCR\.au3 Default :" & $au3prof & @CRLF, $TotalMsg) EndIf Local $RegKeyBase = "HKCR\" & $au3prof & "\shell" Display_Console("* HKCR\.au3 ShellNew :" & @WindowsDir & "\SHELLNEW\" & RegRead("HKCR\.au3\Shellnew", "Filename"), $TotalMsg) If FileExists(@WindowsDir & "\SHELLNEW\" & RegRead("HKCR\.au3\Shellnew", "Filename")) Then Display_Console(" (File Exists)" & @CRLF, $TotalMsg) Else Display_Console(" (*** File is Misssing!)" & @CRLF, $TotalMsg) EndIf Display_Console("******************************************************************************************************************************************" & @CRLF, $TotalMsg) Display_Console("* Explorer shell options:" & @CRLF, $TotalMsg) Display_Console("* " & $RegKeyBase & ": " & @CRLF, $TotalMsg) Display_Console("* => Default Action:" & RegRead($RegKeyBase, "") & @CRLF, $TotalMsg) Local $var, $var2 For $i = 1 To 30 $var = RegEnumKey($RegKeyBase, $i) If @error <> 0 Then ExitLoop Display_Console("* " & StringLeft($var & " ", 22), $TotalMsg) $var2 = RegEnumKey($RegKeyBase & "\" & $var, 1) Display_Console(" => " & $var2, $TotalMsg) Display_Console(":" & RegRead($RegKeyBase & "\" & $var & "\" & $var2, "") & @CRLF, $TotalMsg) Next Display_Console("******************************************************************************************************************************************" & @CRLF, $TotalMsg) Display_Console("* User SciTE info:" & @CRLF, $TotalMsg) If EnvGet("SCITE_USERHOME") <> "" Then $UserData = EnvGet("SCITE_USERHOME") Display_Console("* SCITE_USERHOME:" & $UserData & ": " & @CRLF, $TotalMsg) ElseIf EnvGet("SCITE_HOME") <> "" Then $UserData = EnvGet("SCITE_HOME") Display_Console("* SCITE_HOME:" & $UserData & ": " & @CRLF, $TotalMsg) Else $UserData = @ScriptDir Display_Console("* Portable:" & $UserData & ": " & @CRLF, $TotalMsg) EndIf If Not FileExists($UserData) Then Display_Console("* Directory missing: " & $UserData, $TotalMsg) Else ; Check directory structure If Not FileExists($UserData & "\Au3Stripper") Then Display_Console("* Directory missing: " & $UserData & "\Au3Stripper" & @CRLF, $TotalMsg) If Not FileExists($UserData & "\AutoIt3Wrapper") Then Display_Console("* Directory missing: " & $UserData & "\AutoIt3Wrapper" & @CRLF, $TotalMsg) If Not FileExists($UserData & "\CodeWizard") Then Display_Console("* Directory missing: " & $UserData & "\CodeWizard" & @CRLF, $TotalMsg) If Not FileExists($UserData & "\SciTE Jump") Then Display_Console("* Directory missing: " & $UserData & "\SciTE Jump" & @CRLF, $TotalMsg) If Not FileExists($UserData & "\SciTEConfig") Then Display_Console("* Directory missing: " & $UserData & "\SciTEConfig" & @CRLF, $TotalMsg) If Not FileExists($UserData & "\Tidy") Then Display_Console("* Directory missing: " & $UserData & "\Tidy" & @CRLF, $TotalMsg) ; check key files If Not FileExists($UserData & "\abbrev.properties") Then Display_Console("* File missing: " & $UserData & "\Aabbrev.properties" & @CRLF, $TotalMsg) Else If Not FileGetSize($UserData & "\abbrev.properties") Then Display_Console("* File empty: " & $UserData & "\Abbrev.properties" & @CRLF, $TotalMsg) EndIf If Not FileExists($UserData & "\au3abbrev.properties") Then Display_Console("* File missing: " & $UserData & "\au3abbrev.properties" & @CRLF, $TotalMsg) Else If Not FileGetSize($UserData & "\au3abbrev.properties") Then Display_Console("* File empty: " & $UserData & "\au3abbrev.properties" & @CRLF, $TotalMsg) EndIf If Not FileExists($UserData & "\SciTEUSer.properties") Then Display_Console("* No SciTEUSer.properties yet" & @CRLF, $TotalMsg) Else Display_Console("* SciTEUSer.Properties: " & @CRLF, $TotalMsg) Display_Console("*-----------------------------------------------------------------------------------------" & @CRLF, $TotalMsg) Display_Console(FileRead($UserData & "\SciTEUSer.properties") & @CRLF, $TotalMsg) EndIf EndIf Display_Console("******************************************************************************************************************************************" & @CRLF, $TotalMsg) ClipPut($TotalMsg) GUICreate(".au3 registry settings", 1000, 600) GUICtrlCreateEdit($TotalMsg, 1, 1, 998, 560,$ES_READONLY+$WS_VSCROLL+$ES_AUTOVSCROLL) GUICtrlSetFont(-1, Default, Default, Default, "Courier New") Local $HReg_Exit = GUICtrlCreateButton("Exit", 450, 570, 50, 25) GUICtrlCreateLabel("* information is stored on the clipboard.", 10, 575) GUISetState(@SW_SHOW) Do $msg = GUIGetMsg() Until $msg = $GUI_EVENT_CLOSE Or $msg = $HReg_Exit GUIDelete() EndFunc ;==>_Check_Au3_Registry ; Func Display_Console($msg, ByRef $TotalMsg) ;~ ConsoleWrite($msg) $TotalMsg &= $msg EndFunc ;==>Display_Console Jos
    1 point
  5. try to remove this line of your listing: " <head> <!-- www.techstrikers.com -->" & @CRLF & _ and change it with this 2 lines: " <head>" & @CRLF & _ " <meta http-equiv=""X-UA-Compatible"" content=""IE=edge"" />" & @CRLF & _ ... Let us know the results ...
    1 point
  6. spudw2k

    format csv file

    Here's a way/demo: #include <Excel.au3> $oExcel = _Excel_Open(False) ;Open Excel hidden $oWorkbook = _Excel_BookOpenText($oExcel, "C:\temp\cards.csv") ;Open CSV $oWorkbook.Worksheets(1).Columns("A").NumberFormat = "#,##0.00" ;Set Column A Number Format $oWorkbook.Worksheets(1).Columns("G").NumberFormat = "#,##0.00" ;Set Column G Number Format _Excel_BookSave($oWorkbook) ;Save CSV _Excel_Close($oExcel) ;Close Excel
    1 point
  7. Not sure what I will need this for yet, but I know I will. Just got assigned t he AS400 and do not know a thing about it. First things first, gotta go figure out where to get the PTF's and how to install them.
    1 point
  8. Hi @Deye, As I said this is a TCP Server library, not a HTTP Server library (HTTP is a specified protocol inside TCP). With this library you can create servers of virtually any protocol, although of course you must follow the specs of the creators of the protocol you want to recreate (or even create your own protocol). Depending on the protocol specs, it can demand more or less work. I've wrote a simple example of form data getting using just this library, easy to adapt to your needs. However when developing any kind of server of any protocol, be 100% sure you're able to code it on a secure way (hackers do exist and are around). #cs Run this script Point your browser to http://localhost:8081/ #ce #include "TCPServer.au3" _TCPServer_OnReceive("received") _TCPServer_DebugMode(True) _TCPServer_SetMaxClients(10) _TCPServer_Start(8081) Func received($iSocket, $sIP, $sData, $sParam) $sMethod = StringLeft($sData, StringInStr($sData, " ")-1) ; the first header comes in the format: GET / HTTP/1.1 or POST / HTTP/1.1 $sFile = StringLeft($sData, StringInStr($sData, " ", 2)) ; this is to get the file (after the method - /) - we will not use on this sample but it is useful If $sMethod = "GET" Then _TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _ ; HTTP headers "Content-Type: text/html" & @CRLF & @CRLF & _ ; plus 2 line breaks "<h1>Form example</h1>" & @CRLF & _ ; then HTML code "<form method=""post"">" & @CRLF & _ "<input type=""text"" name=""test"" placeholder=""Type something"" />" & @CRLF & _ "<input type=""number"" name=""somenumber"" placeholder=""Number"" />" & @CRLF & _ "<input type=""submit"">" & @CRLF & _ "</form>") ; you could even send a file: #cs _TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _ ; HTTP headers "Content-Type: text/html" & @CRLF & @CRLF & _ ; plus 2 line breaks FileRead("yourfile.html")) #ce _TCPServer_Close($iSocket) ElseIf $sMethod = "POST" Then ; the form data is at the last line of the request data, URL encoded $sFormdata = StringSplit($sData, @CRLF) $sFormdata = $sFormdata[$sFormdata[0]] ; get last line ; parse the data $aData = ParseStr($sFormdata) ; sends some headers plus 2 line breaks as http specs says ; (browsers understand 2 line breaks as the separation between headers and HTML code) _TCPServer_Send($iSocket, "HTTP/1.0 200 OK" & @CRLF & _ ; HTTP headers "Content-Type: text/html" & @CRLF & @CRLF) ; plus 2 line breaks ; sends some HTML code _TCPServer_Send($iSocket, "<!DOCTYPE html>" & @CRLF) _TCPServer_Send($iSocket, "<html>" & @CRLF) _TCPServer_Send($iSocket, "<body>" & @CRLF) _TCPServer_Send($iSocket, "<h1>Form data</h1>" & @CRLF) _TCPServer_Send($iSocket, "<ul>" & @CRLF) ; shows user data on the page For $i = 1 To $aData[0][0] ; protects against XSS vulnerability $sKey = htmlspecialchars($aData[$i][0]) $sValue = htmlspecialchars($aData[$i][1]) _TCPServer_Send($iSocket, "<li><b>" & $sKey & ":</b> " & $sValue & "</li>" & @CRLF) Next ; ends sending html _TCPServer_Send($iSocket, "<a href=""/"">Go back</a>" & @CRLF) _TCPServer_Send($iSocket, "</body>" & @CRLF) _TCPServer_Send($iSocket, "</html>") ; closes socket _TCPServer_Close($iSocket) EndIf EndFunc ;==>received While 1 Sleep(100) WEnd ; =========== internal use only ============== #cs @author Jefrey @link https://www.autoitscript.com/forum/topic/188052-phps-parse_url-and-parse_str-ported-to-autoit3/ #ce Func ParseStr($sStr) Local $aExplode = StringSplit($sStr, "&"),$aExplode2 Local $aResult[$aExplode[0]+1][2] For $i = 1 To $aExplode[0] $aExplode2 = StringSplit($aExplode[$i], "=") $aResult[$i][0] = $aExplode2[1] $aResult[$i][1] = $aExplode2[2] ; URL decode $aResult[$i][1] = StringReplace($aResult[$i][1], "+", " ") Local $matches = StringRegExp($aResult[$i][1], "\%([abcdefABCDEF0-9]{2})", 3) If IsArray($matches) Then For $match In $matches $aResult[$i][1] = StringReplace($aResult[$i][1], "%" & $match, BinaryToString('0x' & $match)) Next EndIf Next $aResult[0][0] = $aExplode[0] Return $aResult EndFunc #cs @author Jefrey very basic work based on php.net/htmlspecialchars #ce Func htmlspecialchars($sStr) $sStr = StringReplace($sStr, '&', '&amp;') $sStr = StringReplace($sStr, '"', '&quot;') $sStr = StringReplace($sStr, "'", "&apos;") $sStr = StringReplace($sStr, "<", "&lt;") $sStr = StringReplace($sStr, ">", "&gt;") Return $sStr EndFunc
    1 point
  9. Hi, @Deye! Actually what you are trying to do is to create a HTTP server. Note that this UDF supports TCP protocol in a generic state. This means that while you can of course create a HTTP server with it, you will not find everything ready to use as it just takes care about the network part. Sending the form is as easy as: https://github.com/jesobreira/TCPServerUDF/blob/master/example HTTP Server.au3#L20 (notice the HTML on the lines 20-23). However for parsing the user request as well as form data, you will need to handle and parse the HTTP headers sent by the browser. It's not something so hard to understand, but depending on what you want to offer, it's a bite of work. Basically it's just string parsing, nothing that you won't solve with a few StringSplit()s, comparisons and regexp - but a lot of them. If you want to create a full-featured webserver (good luck!), I suggest you to read the HTTP specs: https://www.w3.org/Protocols/Specs.html If what you want is something simple, I suggest you to use Chrome Dev Tools (Ctrl + Shift + J), go to "Network" tab and get familiarized with the HTTP headers sent and received by the browser. You'll see that it's not hard at all. Using a sniffer (Smartsniff or Socketsniff, or even Wireshark although it might be too advanced for simple analysis) against your browser is also very learningful; you can see how the headers and HTML are sent. If you need any further help feel free to comment on this thread!
    1 point
  10. xroot

    Roman (Again)

    Yes, overline characters are covered by Unicode. Here is a little test. global const $dbar = ChrW(0x33F) ;DOUBLE OVERLINE global const $bar = ChrW(0x305) ;OVERLINE Func I_Quit() Exit EndFunc Func To_Roman($iDec) local $roman = "" local $io[25][2] = [[1000000000,"M" & $dbar], _ [500000000,"D" & $dbar], _ [100000000,"C" & $dbar], _ [50000000,"L" & $dbar], _ [10000000,"X" & $dbar], _ [5000000,"V" & $dbar], _ [1000000,"M" & $bar], _ [500000,"D" & $bar], _ [100000,"C" & $bar], _ [50000,"L" & $bar], _ [10000,"X" & $bar], _ [5000,"V" & $bar], _ [1000,"M"], _ [900,"CM"], _ [500,"D"], _ [400,"CD"], _ [100,"C"], _ [90,"XC"], _ [50,"L"], _ [40,"XL"], _ [10,"X"], _ [9,"IX"], _ [5,"V"], _ [4,"IV"], _ [1,"I"]] For $i = 0 To Ubound($io) - 1 While $iDec >= $io[$i][0] $iDec -= $io[$i][0] $roman &= $io[$i][1] WEnd Next Return $roman EndFunc HotKeySet("{ESC}","I_Quit") local $iNumber = 3457898377 SplashTextOn("Roman Numbers For:" & $iNumber,To_Roman($iNumber),@DesktopWidth,60,-1,-1,-1,default,24) While True wEnd
    1 point
  11. The Open Hardware Monitor is a free open source software that monitors temperature sensors, fan speeds, voltages, load and clock speeds of a computer. I found this has a WMI implementation ( http://openhardwaremonitor.org/documentation/ ) and thought it would be nice to post here. Some code to get started on Hardware ; Generated by AutoIt ScriptOMatic ; Hardware $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $OutputTitle = "" $Output = "" $Output = $Output & '<html><head><title>ScriptOMatic HTML Output</title></head><body> <style>table {font-size: 10pt; font-family: arial;} th {background-color: buttonface; font-decoration: bold;} </style><table BORDER="1"><tr><th> Property </th><th> Value </th></tr>' $OutputTitle &= '<tr bgcolor="yellow"><td>' & "Computer</td><td>&nbsp;" & $strComputer & "</td></tr>" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\OpenHardwareMonitor") $colItems = $objWMIService.ExecQuery("SELECT * FROM Hardware", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then Local $Object_Flag = 0 For $objItem In $colItems $Object_Flag = 1 $Output &= "<tr><td>HardwareType</td><td>&nbsp;" & $objItem.HardwareType & "</td></tr>" & @CRLF $Output &= "<tr><td>Identifier</td><td>&nbsp;" & $objItem.Identifier & "</td></tr>" & @CRLF $Output &= "<tr><td>InstanceId</td><td>&nbsp;" & $objItem.InstanceId & "</td></tr>" & @CRLF $Output &= "<tr><td>Name</td><td>&nbsp;" & $objItem.Name & "</td></tr>" & @CRLF $Output &= "<tr><td>Parent</td><td>&nbsp;" & $objItem.Parent & "</td></tr>" & @CRLF $Output &= "<tr><td>ProcessId</td><td>&nbsp;" & $objItem.ProcessId & "</td></tr>" & @CRLF Next If $Object_Flag = 0 Then Msgbox(1,"WMI Output",$OutputTitle) FileWrite(@TempDir & "\Hardware.HTML", $Output ) Run(@Comspec & " /c start " & @TempDir & "\Hardware.HTML" ) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Hardware" ) Endif Some code to get started on Sensor ; Generated by AutoIt ScriptOMatic $wbemFlagReturnImmediately = 0x10 $wbemFlagForwardOnly = 0x20 $colItems = "" $strComputer = "localhost" $OutputTitle = "" $Output = "" $Output = $Output & '<html><head><title>ScriptOMatic HTML Output</title></head><body> <style>table {font-size: 10pt; font-family: arial;} th {background-color: buttonface; font-decoration: bold;} </style><table BORDER="1"><tr><th> Property </th><th> Value </th></tr>' $OutputTitle &= '<tr bgcolor="yellow"><td>' & "Computer</td><td>&nbsp;" & $strComputer & "</td></tr>" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\OpenHardwareMonitor") $colItems = $objWMIService.ExecQuery("SELECT * FROM Sensor", "WQL", _ $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) then Local $Object_Flag = 0 For $objItem In $colItems $Object_Flag = 1 $Output &= "<tr><td>Identifier</td><td>&nbsp;" & $objItem.Identifier & "</td></tr>" & @CRLF $Output &= "<tr><td>Index</td><td>&nbsp;" & $objItem.Index & "</td></tr>" & @CRLF $Output &= "<tr><td>InstanceId</td><td>&nbsp;" & $objItem.InstanceId & "</td></tr>" & @CRLF $Output &= "<tr><td>Max</td><td>&nbsp;" & $objItem.Max & "</td></tr>" & @CRLF $Output &= "<tr><td>Min</td><td>&nbsp;" & $objItem.Min & "</td></tr>" & @CRLF $Output &= "<tr><td>Name</td><td>&nbsp;" & $objItem.Name & "</td></tr>" & @CRLF $Output &= "<tr><td>Parent</td><td>&nbsp;" & $objItem.Parent & "</td></tr>" & @CRLF $Output &= "<tr><td>ProcessId</td><td>&nbsp;" & $objItem.ProcessId & "</td></tr>" & @CRLF $Output &= "<tr><td>SensorType</td><td>&nbsp;" & $objItem.SensorType & "</td></tr>" & @CRLF $Output &= "<tr><td>Value</td><td>&nbsp;" & $objItem.Value & "</td></tr>" & @CRLF Next If $Object_Flag = 0 Then Msgbox(1,"WMI Output",$OutputTitle) FileWrite(@TempDir & "\Sensor.HTML", $Output ) Run(@Comspec & " /c start " & @TempDir & "\Sensor.HTML" ) Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Sensor" ) Endif have fun.
    1 point
  12. Could you please try this version? #include <Constants.au3> #include <Excel.au3> #include <Debug.au3> _DebugSetup() _DebugCOMError() Local $sFilePath1 = $CmdLine[1] Local $sSheet = $CmdLine[2] Local $sButton = $CmdLine[3] Local $oExcel = _Excel_Open() If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error _Excel_Open" & @CRLF & "@error = " & @error & ", @extended = " & @extended) Local $oWorkbook = _Excel_BookOpen($oExcel, $sFilePath1) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error _Excel_BookOpen: " & $sFilePath1 & @CRLF & "@error = " & @error & ", @extended = " & @extended) $oWorkbook.Sheets.Item($sSheet).Activate If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error Excel.Sheets.Item.Activate: " & $sSheet & @CRLF & "@error = " & @error & ", @extended = " & @extended) $sButton = "Autotask_Service_Workbook_Daily.xlsm!TicketDetailTableRefresh" $oExcel.Run($sButton) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error Excel.Run: " & $sButton & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_BookClose($oWorkbook, False) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error _Excel_BookClose: " & $sFilePath1 & @CRLF & "@error = " & @error & ", @extended = " & @extended) _Excel_Close($oExcel) If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "Error _Excel_Close" & @CRLF & "@error = " & @error & ", @extended = " & @extended) The naming of the Application and Workbook objects led my to the wron assumtions. You need to use the Run method on the Apllication object, not te Workbook.
    1 point
  13. Zedna

    If folder exists...

    Then use FileGetAttrib() to clarify file/directory status. $folder="C:\Testing\xyz" IF FileExist($folder) and StringInStr(FileGetAttrib($folder),"D") Then MsgBox(0,"Folder Found","The folder " & $folder & " exists")
    1 point
  14. *SOLUTION* Don't use $WS_VISIBLE when creating the GUI. After perusing MHZ example with my code, the only difference I could pick, was that he had used $WS_POPUP, whereas I had used some regular commands such as clipsiblings, sysmenu, etc and what proved to be the problem $WS_VISIBLE. Maybe there should be a comment about this in the help file, as it just didn't occur to me without some sort of comparison to go by. Anyway thanks Zedna & MHZ. For those who want to know, the relevant code for the GUI is GUICtrlCreatePic($picture, 0, 0, 320, 240) GUICtrlSetState(Default, $GUI_DISABLE)and the label GUICtrlSetBkColor(Default, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetColor(Default, 0xFFFFFF)obviously any variables, dimensions & color need to be modified to suit your own.
    1 point
×
×
  • Create New...