Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/03/2016 in all areas

  1. Easy To Use - Bass Example (by nend) with _BASSChannelGetTags() nend says : #include <Bass.au3> #include <BassConstants.au3> Global $BASS_PAUSE_POS Func Example() Local $MusicHandle _Audio_init_start() $MusicHandle = _Set_url("http://ice1.somafm.com/groovesalad-128.mp3") _Set_volume(50) _Audio_play($MusicHandle) while 1 ConsoleWrite(_Get_streamtitle($MusicHandle) & @CRLF) Sleep(1000) WEnd _Audio_init_stop($MusicHandle) EndFunc Example() Func _Audio_init_start() If _BASS_STARTUP(@ScriptDir & "\bass.dll") Then If _BASS_Init(0, -1, 44100, 0) Then If _BASS_SetConfig($BASS_CONFIG_NET_PLAYLIST, 1) = 0 Then SetError(3) EndIf Else SetError(2) EndIf Else SetError(@error) EndIf EndFunc Func _Set_buffer($buffer) _BASS_SetConfig($BASS_CONFIG_NET_BUFFER, $buffer) EndFunc Func _Audio_stop($MusicHandle) _BASS_ChannelStop($MusicHandle) EndFunc Func _Audio_play($MusicHandle) _BASS_ChannelPlay($MusicHandle, 1) EndFunc Func _Audio_pause($MusicHandle) If _Get_playstate($MusicHandle) = 2 Then $BASS_PAUSE_POS = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) _BASS_ChannelPause($MusicHandle) ElseIf _Get_playstate($MusicHandle) = 3 Then _Audio_play($MusicHandle) _BASS_ChannelSetPosition($MusicHandle, $BASS_PAUSE_POS, $BASS_POS_BYTE) EndIf EndFunc Func _Audio_init_stop($MusicHandle) _BASS_StreamFree($MusicHandle) _BASS_Free() EndFunc Func _Set_url($file) If FileExists($file) Then $MusicHandle = _BASS_StreamCreateFile(False, $file, 0, 0, 0) Else $MusicHandle = _BASS_StreamCreateURL($file, 0, 1) EndIf If @error Then Return SetError(1) EndIf Return $MusicHandle EndFunc Func _Get_pos($MusicHandle) $current = _BASS_ChannelGetPosition($MusicHandle, $BASS_POS_BYTE) Return Round(_Bass_ChannelBytes2Seconds($MusicHandle, $current)) EndFunc Func _Get_len($MusicHandle) $current = _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE) Return Round(_Bass_ChannelBytes2Seconds($MusicHandle, $current)) EndFunc Func _Set_pos($MusicHandle, $seconds) _BASS_ChannelSetPosition($MusicHandle, _BASS_ChannelSeconds2Bytes($MusicHandle, $seconds), $BASS_POS_BYTE) EndFunc Func _Set_volume($volume) _BASS_SetConfig($BASS_CONFIG_GVOL_STREAM, $volume * 100) EndFunc Func _Get_volume() Return _BASS_GetConfig($BASS_CONFIG_GVOL_STREAM) / 100 EndFunc Func _Get_bitrate($MusicHandle) $a = Round(_Bass_ChannelBytes2Seconds($MusicHandle, _BASS_ChannelGetLength($MusicHandle, $BASS_POS_BYTE))) $return = Round(_BASS_StreamGetFilePosition($MusicHandle, $BASS_FILEPOS_END) * 8/ $a/ 1000) If StringInStr($return, "-") Then $return = _BASS_StreamGetFilePosition($MusicHandle, $BASS_FILEPOS_END) * 8 / _BASS_GetConfig($BASS_CONFIG_NET_BUFFER) EndIf Return $return EndFunc Func _Get_playstate($MusicHandle) Switch _BASS_ChannelIsActive($MusicHandle) Case $BASS_ACTIVE_STOPPED $returnstate = 1 Case $BASS_ACTIVE_PLAYING $returnstate = 2 Case $BASS_ACTIVE_PAUSED $returnstate = 3 Case $BASS_ACTIVE_STALLED $returnstate = 4 EndSwitch Return $returnstate EndFunc Func _Get_streamtitle($MusicHandle) $pPtr = _BASS_ChannelGetTags($MusicHandle, $BASS_TAG_META) $sStr = _BASS_PtrStringRead($pPtr) If StringInStr($sStr, ";") Then $infosplit = StringSplit($sStr, ";") $infosplit[1] = StringReplace($infosplit[1], "'", "") $infosplit[1] = StringReplace($infosplit[1], "StreamTitle=", "") If StringInStr($infosplit[1], "-") Then Return $infosplit[1] EndIf EndIf EndFunc You need : 1 dll : bass.dll source : http://www.un4seen.com/bass.html (v2.4.12.1) 2 au3 : bass.au3 source : bass related forum post (patch 9.2/Constant from 9.0)
    1 point
  2. Dhilip89

    HTML Entity UDF

    Hello, I just made an UDF for Encoding/Decoding the string and HTML Entity Number. HTML.au3: #include-once #include <Array.au3> Dim $Entity[65536] $Entity[34] = "quot" $Entity[38] = "amp" $Entity[39] = "apos" $Entity[60] = "lt" $Entity[62] = "gt" $Entity[160] = "nbsp" $Entity[161] = "iexcl" $Entity[162] = "cent" $Entity[163] = "pound" $Entity[164] = "curren" $Entity[165] = "yen" $Entity[166] = "brvbar" $Entity[167] = "sect" $Entity[168] = "uml" $Entity[169] = "copy" $Entity[170] = "ordf" $Entity[171] = "laquo" $Entity[172] = "not" $Entity[173] = "shy" $Entity[174] = "reg" $Entity[175] = "macr" $Entity[176] = "deg" $Entity[177] = "plusmn" $Entity[178] = "sup2" $Entity[179] = "sup3" $Entity[180] = "acute" $Entity[181] = "micro" $Entity[182] = "para" $Entity[183] = "middot" $Entity[184] = "cedil" $Entity[185] = "sup1" $Entity[186] = "ordm" $Entity[187] = "raquo" $Entity[188] = "frac14" $Entity[189] = "frac12" $Entity[190] = "frac34" $Entity[191] = "iquest" $Entity[192] = "Agrave" $Entity[193] = "Aacute" $Entity[194] = "Acirc" $Entity[195] = "Atilde" $Entity[196] = "Auml" $Entity[197] = "Aring" $Entity[198] = "AElig" $Entity[199] = "Ccedil" $Entity[200] = "Egrave" $Entity[201] = "Eacute" $Entity[202] = "Ecirc" $Entity[203] = "Euml" $Entity[204] = "Igrave" $Entity[205] = "Iacute" $Entity[206] = "Icirc" $Entity[207] = "Iuml" $Entity[208] = "ETH" $Entity[209] = "Ntilde" $Entity[210] = "Ograve" $Entity[211] = "Oacute" $Entity[212] = "Ocirc" $Entity[213] = "Otilde" $Entity[214] = "Ouml" $Entity[215] = "times" $Entity[216] = "Oslash" $Entity[217] = "Ugrave" $Entity[218] = "Uacute" $Entity[219] = "Ucirc" $Entity[220] = "Uuml" $Entity[221] = "Yacute" $Entity[222] = "THORN" $Entity[223] = "szlig" $Entity[224] = "agrave" $Entity[225] = "aacute" $Entity[226] = "acirc" $Entity[227] = "atilde" $Entity[228] = "auml" $Entity[229] = "aring" $Entity[230] = "aelig" $Entity[231] = "ccedil" $Entity[232] = "egrave" $Entity[233] = "eacute" $Entity[234] = "ecirc" $Entity[235] = "euml" $Entity[236] = "igrave" $Entity[237] = "iacute" $Entity[238] = "icirc" $Entity[239] = "iuml" $Entity[240] = "eth" $Entity[241] = "ntilde" $Entity[242] = "ograve" $Entity[243] = "oacute" $Entity[244] = "ocirc" $Entity[245] = "otilde" $Entity[246] = "ouml" $Entity[247] = "divide" $Entity[248] = "oslash" $Entity[249] = "ugrave" $Entity[250] = "uacute" $Entity[251] = "ucirc" $Entity[252] = "uuml" $Entity[253] = "yacute" $Entity[254] = "thorn" $Entity[255] = "yuml" $Entity[338] = "OElig" $Entity[339] = "oelig" $Entity[352] = "Scaron" $Entity[353] = "scaron" $Entity[376] = "Yuml" $Entity[402] = "fnof" $Entity[710] = "circ" $Entity[732] = "tilde" $Entity[913] = "Alpha" $Entity[914] = "Beta" $Entity[915] = "Gamma" $Entity[916] = "Delta" $Entity[917] = "Epsilon" $Entity[918] = "Zeta" $Entity[919] = "Eta" $Entity[920] = "Theta" $Entity[921] = "Iota" $Entity[922] = "Kappa" $Entity[923] = "Lambda" $Entity[924] = "Mu" $Entity[925] = "Nu" $Entity[926] = "Xi" $Entity[927] = "Omicron" $Entity[928] = "Pi" $Entity[929] = "Rho" $Entity[931] = "Sigma" $Entity[932] = "Tau" $Entity[933] = "Upsilon" $Entity[934] = "Phi" $Entity[935] = "Chi" $Entity[936] = "Psi" $Entity[937] = "Omega" $Entity[945] = "alpha" $Entity[946] = "beta" $Entity[947] = "gamma" $Entity[948] = "delta" $Entity[949] = "epsilon" $Entity[950] = "zeta" $Entity[951] = "eta" $Entity[952] = "theta" $Entity[953] = "iota" $Entity[954] = "kappa" $Entity[955] = "lambda" $Entity[956] = "mu" $Entity[957] = "nu" $Entity[958] = "xi" $Entity[959] = "omicron" $Entity[960] = "pi" $Entity[961] = "rho" $Entity[962] = "sigmaf" $Entity[963] = "sigma" $Entity[964] = "tau" $Entity[965] = "upsilon" $Entity[966] = "phi" $Entity[967] = "chi" $Entity[968] = "psi" $Entity[969] = "omega" $Entity[977] = "thetasym" $Entity[978] = "upsih" $Entity[982] = "piv" $Entity[8194] = "ensp" $Entity[8195] = "emsp" $Entity[8201] = "thinsp" $Entity[8204] = "zwnj" $Entity[8205] = "zwj" $Entity[8206] = "lrm" $Entity[8207] = "rlm" $Entity[8211] = "ndash" $Entity[8212] = "mdash" $Entity[8216] = "lsquo" $Entity[8217] = "rsquo" $Entity[8218] = "sbquo" $Entity[8220] = "ldquo" $Entity[8221] = "rdquo" $Entity[8222] = "bdquo" $Entity[8224] = "dagger" $Entity[8225] = "Dagger" $Entity[8226] = "bull" $Entity[8230] = "hellip" $Entity[8240] = "permil" $Entity[8242] = "prime" $Entity[8243] = "Prime" $Entity[8249] = "lsaquo" $Entity[8250] = "rsaquo" $Entity[8254] = "oline" $Entity[8260] = "frasl" $Entity[8364] = "euro" $Entity[8465] = "image" $Entity[8472] = "weierp" $Entity[8476] = "real" $Entity[8482] = "trade" $Entity[8501] = "alefsym" $Entity[8592] = "larr" $Entity[8593] = "uarr" $Entity[8594] = "rarr" $Entity[8595] = "darr" $Entity[8596] = "harr" $Entity[8629] = "crarr" $Entity[8656] = "lArr" $Entity[8657] = "uArr" $Entity[8658] = "rArr" $Entity[8659] = "dArr" $Entity[8660] = "hArr" $Entity[8704] = "forall" $Entity[8706] = "part" $Entity[8707] = "exist" $Entity[8709] = "empty" $Entity[8711] = "nabla" $Entity[8712] = "isin" $Entity[8713] = "notin" $Entity[8715] = "ni" $Entity[8719] = "prod" $Entity[8721] = "sum" $Entity[8722] = "minus" $Entity[8727] = "lowast" $Entity[8730] = "radic" $Entity[8733] = "prop" $Entity[8734] = "infin" $Entity[8736] = "ang" $Entity[8743] = "and" $Entity[8744] = "or" $Entity[8745] = "cap" $Entity[8746] = "cup" $Entity[8747] = "int" $Entity[8756] = "there4" $Entity[8764] = "sim" $Entity[8773] = "cong" $Entity[8776] = "asymp" $Entity[8800] = "ne" $Entity[8801] = "equiv" $Entity[8804] = "le" $Entity[8805] = "ge" $Entity[8834] = "sub" $Entity[8835] = "sup" $Entity[8836] = "nsub" $Entity[8838] = "sube" $Entity[8839] = "supe" $Entity[8853] = "oplus" $Entity[8855] = "otimes" $Entity[8869] = "perp" $Entity[8901] = "sdot" $Entity[8968] = "lceil" $Entity[8969] = "rceil" $Entity[8970] = "lfloor" $Entity[8971] = "rfloor" $Entity[9001] = "lang" $Entity[9002] = "rang" $Entity[9674] = "loz" $Entity[9824] = "spades" $Entity[9827] = "clubs" $Entity[9829] = "hearts" $Entity[9830] = "diams" ;=============================================================================== ; ; Function Name: _HTMLEncode() ; Description: Encode the normal string into HTML Entity Number ; Parameter(s): $String - The string you want to encode. ; ; Requirement(s): AutoIt v3.2.4.9 or higher (Unicode) ; Return Value(s): On Success - Returns HTML Entity Number ; On Failure - Nothing ; ; Author(s): Dhilip89 ; ;=============================================================================== Func _HTMLEncode($Str) $StrLen = StringLen($Str) Local $Encoded If $StrLen = 0 Then Return '' For $i = 1 To $StrLen $StrChar = StringMid($Str, $i, 1) $Encoded &= '&#' & AscW($StrChar) & ';' Next Return $Encoded EndFunc ;==>_HTMLEncode ;=============================================================================== ; ; Function Name: _HTMLDecode() ; Description: Decode the HTML Entity Number into normal string ; Parameter(s): $HTMLEntityNum - The HTML Entity Number you want to decode. ; ; Requirement(s): AutoIt v3.2.4.9 or higher (Unicode) ; Return Value(s): On Success - Returns decoded strings ; On Failure - Nothing ; ; Author(s): Dhilip89 ; ;=============================================================================== Func _HTMLDecode($Str) Local $Decoded If $Str = '' Then Return '' $X1 = StringRegExp($Str, '&#x(.*?);', 3) $X2 = StringRegExp($Str, '&#(.*?);', 3) $X3 = StringRegExp($Str, '&(.*?);', 3) For $i = 0 To UBound($X1) - 1 Step 1 $Str = StringReplace($Str, '&#x' & $X1[$i] & ';', ChrW(Dec($X1[$i]))) Next For $i = 0 To UBound($X2) - 1 Step 1 $Str = StringReplace($Str, '&#' & $X2[$i] & ';', ChrW($X2[$i])) Next For $i = 0 To UBound($X3) - 1 Step 1 $Str = StringReplace($Str, '&' & $X3[$i] & ';', ChrW(_ArraySearch($Entity, $X3[$i], 0, 0, 1))) Next $Decoded = $Str Return $Decoded EndFunc ;==>_HTMLDecode Download: HTML.au3
    1 point
  3. 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
  4. Kanashius

    Epub/Ebook management

    One year ago, I created an Epub/Ebook manager. Its good for short loadingtime and Detailed Information about the Books. With the manager it comes an full-reader with readout-function (TTS), using installed voices. This Program is used to Manage e-books/epubs. You can import directorys. A lot of information is read from the epub and saved in a database. Most important is the speed of loading books, because the management should be used for lots of epubs. All chargings are displayed. There is also an Sql-Console, if you want to edit a lot of entry, otherwise you can do a rightclick and edit every Element in another window. Also there is a Epub-Reader to read the epubs just with a doubleclick at any entry. Information saved in the database (if they can be read in the epub): identifier, author, description, title, genre, creationdate, path, speach Information about Epub-Reader: The Epub-Reader opens Epubs and they can be read chapter by chapter. At the left side there is a Listbox, where you can select the chapters There is also a read out function, reading your epub. (You can change Voice and Audiooutput, but you need to have installed a TTS-Speach). Also you can edit the font-size. I translated the Programm in english to post it here. If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. I have rewritten the complete Project in C++ (QT). The speed was improved >10x. There are also some other improvements. You can find it at my webside. For more information and direct executables, please visit my website: http://kanashius.de/?page=autoitBuchverwaltung Because i get Error -200 uploading the files, you need to visit my side to download. Maybe anyone of you have a suggestion to Upload it here.
    1 point
  5. You can do something like this here: #include <guiconstants.au3> #include <ButtonConstants.au3> #include <GuiMenu.au3> #include <String.au3> #include <WinAPIGdi.au3> $title = "GUI" $gui = GUICreate($title, 640, 480, -1, -1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "_Exit") $sec = @SEC $msec = @MSEC Local $box[10] Local $speed_x[UBound($box)], $speed_y[UBound($box)] For $i = 0 To UBound($box) - 1 $box[$i] = GUICtrlCreateLabel("", Random(0, 620, 1), Random(0, 460, 1), 20, 20) $random = Random(0, 1, 1) GUICtrlSetBkColor($box[$i], 0x000000) If $random = 1 Then $speed_x[$i] = 1 $speed_y[$i] = 1 ElseIf $random = 0 Then $speed_x[$i] = -1 $speed_y[$i] = -1 EndIf Next GUISetState() While 1 $s = @SEC $m = @MSEC For $i = 0 To UBound($box) - 1 $box_cp = ControlGetPos($gui, "", $box[$i]) If BitOR($box_cp[0] <= 0, $box_cp[0] + $box_cp[2] >= 640) Then $speed_x[$i] *= -1 If BitOR($box_cp[1] <= 0, $box_cp[1] + $box_cp[3] >= 480) Then $speed_y[$i] *= -1 Collision_Check($box_cp, $i) GUICtrlSetPos($box[$i], $box_cp[0] - $speed_x[$i], $box_cp[1] - $speed_y[$i]) Next Sleep(10) WEnd Func Collision_Check($aR1, $iPos) Local $i, $aR2 For $i = 0 To UBound($box) - 1 If $i = $iPos Then ContinueLoop $aR2 = ControlGetPos($gui, "", $box[$i]) If BitAND($aR1[0] + $aR1[2] / 2 + $aR2[2] / 2 > $aR2[0], _ $aR2[0] + $aR2[2] / 2 + $aR1[2] / 2 > $aR1[0], _ $aR1[1] + $aR1[3] / 2 + $aR2[3] / 2 > $aR2[1], _ $aR2[1] + $aR2[3] / 2 + $aR1[3] / 2 > $aR1[1]) Then Select Case ($aR2[0] + $aR2[2]) - $aR1[0] < 5 ; Left edge $speed_x[$i] *= -1 $speed_x[$iPos] *= -1 Return 1 Case ($aR2[1] + $aR2[3]) - $aR1[1] < 5 ; Upper edge $speed_y[$i] *= -1 $speed_y[$iPos] *= -1 Return 2 Case ($aR1[1] + $aR1[0]) - $aR1[2] < 5 ; Right edge $speed_x[$i] *= -1 $speed_x[$iPos] *= -1 Return 3 Case ($aR1[2] + $aR1[1]) - $aR1[3] < 5 ; Lower edge $speed_y[$i] *= -1 $speed_y[$iPos] *= -1 Return 4 EndSelect EndIf Next EndFunc ;==>Collision_Check Func _Exit() Exit EndFunc ;==>_Exit
    1 point
  6. try: Local $Aut2Exe = @ProgramFilesDir & "/AutoIt3/Aut2Exe/Aut2exe.exe" Runwait('"' & $Aut2Exe & '" /in "C:\Users\****\Desktop\Jarvis\NewCompile.au3" /out "C:\Users\****\Desktop\Jarvis\Program.exe"') Jos
    1 point
  7. This script will also retrieve the resource from the compiled script and write it to another file: #AutoIt3Wrapper_Res_File_Add=test.png,png #include <WinAPIRes.au3> #include <WinAPIInternals.au3> Local $bBytes = _GetResourceAsBytes("PNG") If @error Then ; Resource not found Else FileDelete("testOut.png") FileWrite("testOut.png", $bBytes) EndIf Func _GetResourceAsBytes($sResName, $seq=1) Local $hMod = _WinAPI_GetModuleHandle(Null) Local $hRes = _WinAPI_FindResource($hMod, $sResName, $seq) If @error Or Not $hRes Then Return SetError(1, 0, 0) Local $dSize = _WinAPI_SizeOfResource($hMod, $hRes) If @error Or Not $dSize Then Return SetError(2, 0, 0) Local $hLoad = _WinAPI_LoadResource($hMod, $hRes) If @error Or Not $hLoad Then Return SetError(3, 0, 0) Local $pData = _WinAPI_LockResource($hLoad) If @error Or Not $pData Then Return SetError(4, 0, 0) Local $tBuffer = DllStructCreate("byte[" & $dSize & "]") _WinAPI_MoveMemory(DllStructGetPtr($tBuffer), $pData, $dSize) Return DllStructGetData($tBuffer, 1) EndFunc Jos
    1 point
  8. Just: #AutoIt3Wrapper_Res_File_Add=test.png,png should do it.. Jos
    1 point
  9. Deye, Temporarily replace the image controls with coloured labels - then you can correctly locate everything before recoding the script to show the images in the final version. M23
    1 point
  10. JLogan3o13

    Optimized _ArraySort

    Here are the results I got, I did 1, 2, 4, 8, then 8 with penalty of 8. I was surprised by the penalty = 8 test. $iPenalty = 0, $iFirstTest = 1, $iLastTest = 1 Test # 1 : Rows = 512 : Columns = 32768 : Penalty = 0 143321.83322182 _ArraySort($aArray2D, 0, 0, 0, 0) 55373.6809426896 _ArraySort_NEW2($aArray2D, 0, 0, 0, 1) >Exit code: 0 Time: 356 $iPenalty = 0, $iFirstTest = 2, $iLastTest = 2 Test # 2 : Rows = 1024 : Columns = 16384 : Penalty = 0 142162.607119061 _ArraySort($aArray2D, 0, 0, 0, 0) 30920.2960152757 _ArraySort_NEW2($aArray2D, 0, 0, 0, 1) >Exit code: 0 Time: 409.1 $iPenalty = 0, $iFirstTest = 4, $iLastTest = 4 Test # 4 : Rows = 4096 : Columns = 4096 : Penalty = 0 164597.794412418 _ArraySort($aArray2D, 0, 0, 0, 0) 27695.3273390892 _ArraySort_NEW2($aArray2D, 0, 0, 0, 1) >Exit code: 0 Time: 592.3 $iPenalty = 0, $iFirstTest = 8, $iLastTest = 8 Test # 8 : Rows = 8388608 : Columns = 2 : Penalty = 0 1453897.91097751 _ArraySort($aArray2D, 0, 0, 0, 0) 1171085.54159816 _ArraySort_NEW2($aArray2D, 0, 0, 0, 1) >Exit code: 0 Time: 3380 $iPenalty = 8, $iFirstTest = 8, $iLastTest = 8 Test # 8 : Rows = 8388608 : Columns = 2 : Penalty = 8 1418870.40608513 _ArraySort($aArray2D, 0, 0, 0, 0) 1130443.45119282 _ArraySort_NEW2($aArray2D, 0, 0, 0, 1) >Exit code: 0 Time: 3303
    1 point
  11. UEZ

    Optimized _ArraySort

    Hmmm, the test array I used worked properly. I'm sure you will fix it.
    1 point
  12. I've got a bit of a head cold so I've been struggling to actually comprehend even some of my own code these last couple of days, otherwise I would try to get you started. I see you're using ControlGetPos, instead of doing that you could store the positions of the controls in an array and just use that array to update where the control will be moved to. Once you do that you can just loop through the array, checking the positions of all of the other boxes. If the position of the current control you're checking is going to collide with another, then you can adjust the direction. Hopefully this might help The main array that holds all of the positions of the heart is Global $heart_buffer[$MAX_HEART_COUNT][12] The main loop of the function is what changes the x and y coordinates of the hearts but this function is what sets the starting positions and sizes of each heart Func SetHeartStats(Const ByRef $iIndex)
    1 point
  13. Kanashius

    Epub/Ebook management

    Oh, I first wrote the Project in AutoIt, my first programming-language. Then I wanted to learn a new language (C/C++), so I took the project and rewrote it. I did not want to say, that AutoIt is bad. AutoIt is very cool and simple. A good language to get a cool Gui-Application very fast, or automate something. Only when its about speed, I would say, better use Java or C/C++. I'm more active at the german Autoit-Forum (autoit.de). So, do not think, I lost AutoIt out of my eyes With best regards, Kanashius PS: I must say, my webside look terrible^^ I'm working at a rework, but this time I want to make it better, so I take the time I need
    1 point
  14. you need to register a function to be called when the script receives the termination signal from the system. in this function, you can detect cause of termination by a built-in macro. this is how it can be done: OnAutoItExitRegister('OnExit') ; your script here (includes, globals, main loop, functions) While True Sleep(10) WEnd Func OnExit() Switch @exitMethod Case 0, 1, 2 ; do stuff related to normal exit Case 3 ; do stuff related to log off Case 4 ; do stuff related to shutdown/restart EndSwitch EndFunc ;==>OnExit look at the help file for relevant function OnAutoItExitRegister() and macro @exitMethod. keep in mind that the exit function should be very short and finish its job quickly, or Windows will kill your script if it does not respond in due time. so don't start opening IE windows or perform database maintenance here. do some logging, raise a flag, no more.
    1 point
  15. i think i understand better. look arroud that maybe (i think its exactly what u want) :
    1 point
  16. I know to do so with the built in Media Player is simple: $WMPLayer = ObjCreate("WMPlayer.OCX") $WMPLayer.openPlayer("C:\Users\JLogan3o13\Desktop\720p.mp4") For VLC specifically I would suggest looking at the UDF:
    1 point
  17. Hi ! I just test it and i don't know how you did it, but that's simply amazing !! I didn't change the key since I have to understand better how it works and how to create a script that would run ok on another environnements For an advice, maybe you could put every needed files in one zip, and some Tools to automate the crypt process. last advice, it's not easy to use codescanner ( treeview click interface ), a little more explanation would be interesting but at last, that's amazing. How much security can we guess with this ? Does it prevent decompilation ? i'll test with bigger script I have and try to report you. Hope some users will test it too, maybe afraid of all needed scripts, but as you said, once understood, it's easy Great job !
    1 point
  18. I have a question!!!!! Is it possible to re-create these graphs or say a dashboard of graphs from excel without having them displayed in excel? For example i am wanting to make an Autoit GUI where they can load the dashboard which is linked to shared spreadsheets that are constantly updated to give a real-time display of the data however not within excel and rather in the Autoit Window itself... is this possible? *sorry if this is in the wrong section*
    1 point
  19. panyndrom

    Drive Temperature

    I know this is an old topic. The difference in location can be expained. You have to fine the corresponding dataset by ID. Please see attached code. #RequireAdmin Dim $strComputer = "." Dim $objWMIService, $oMyError Dim $colTemp If Not @Compiled Then ConsoleWrite("HDD Temperature(s): " & _WMI_GetATAPISmartData() & @CRLF) EndIf Func _MyErrFunc() Local $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "COM Error Test", "We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1); to check for after this function returns EndFunc ;==>_MyErrFunc Func _WMI_GetATAPISmartData() #cs Data Structure 362 Bytes: Word Vendor Byte Vendordata[12] = ( byte ID; byte data[11]) data: 01 - Attribute ID 02 - Nom/Flag 03 - Status 04 - Value/% 05 - Worst/% 06 - Raw/Value 07 - Cycles 08 - VSD1 09 - VSD2 10 - VSD3 11 - VSD4 12 - VSD5 see: http://en.wikipedia.org/wiki/S.M.A.R.T. Attriubuts: 1 0x01 Read Error Rate 2 0x02 Throughput Performance 3 0x03 Spin-Up Time 4 0x04 Start/Stop Count 5 0x05 Reallocated Sectors Count 6 0x06 Read Channel Margin 7 0x07 Seek Error Rate 8 0x08 Seek Time Performance 9 0x09 Power-On Hours (POH) 10 0x0A Spin Retry Count 11 0x0B Recalibration Retries or Calibration Retry Count 12 0x0C Power Cycle Count 13 0x0D Soft Read Error Rate 180 0xB4 Unused Reserved Block Count Total 183 0xB7 SATA Downshift Error Count or Runtime Bad Block 184 0xB8 End-to-End error / IOEDC 185 0xB9 Head Stability 186 0xBA Induced Op-Vibration Detection 187 0xBB Reported Uncorrectable Errors 188 0xBC Command Timeout 189 0xBD High Fly Writes 190 0xBE Airflow Temperature (WDC) resp. Airflow Temperature Celsius (HP) 190 0xBE Temperature Difference from 100 191 0xBF G-sense Error Rate 192 0xC0 Power-off Retract Count or Emergency Retract Cycle Count (Fujitsu)[21] 193 0xC1 Load Cycle Count or Load/Unload Cycle Count (Fujitsu) 194 0xC2 Temperature resp. Temperature Celsius 195 0xC3 Hardware ECC Recovered 196 0xC4 Reallocation Event Count 197 0xC5 Current Pending Sector Count 198 0xC6 Uncorrectable Sector Count or Offline Uncorrectable or Off-Line Scan Uncorrectable Sector Count[21] 199 0xC7 UltraDMA CRC Error Count 200 0xC8 Multi-Zone Error Rate [28] 200 0xC8 Write Error Rate (Fujitsu) 201 0xC9 Soft Read Error Rate or TA Counter Detected 202 0xCA Data Address Mark errors or TA Counter Increased 203 0xCB Run Out Cancel 204 0xCC Soft ECC Correction 205 0xCD Thermal Asperity Rate (TAR) 206 0xCE Flying Height 207 0xCF Spin High Current 208 0xD0 Spin Buzz 209 0xD1 Offline Seek Performance 210 0xD2 Vibration During Write 211 0xD3 Vibration During Write 212 0xD4 Shock During Write 220 0xDC Disk Shift 221 0xDD G-Sense Error Rate 222 0xDE Loaded Hours 223 0xDF Load/Unload Retry Count 224 0xE0 Load Friction 225 0xE1 Load/Unload Cycle Count 226 0xE2 Load 'In'-time 227 0xE3 Torque Amplification Count 228 0xE4 Power-Off Retract Cycle 230 0xE6 GMR Head Amplitude 230 0xE6 Drive Life Protection Status 231 0xE7 Temperature 231 0xE7 SSD Life Left 232 0xE8 Endurance Remaining 232 0xE8 Available Reserved Space 233 0xE9 Power-On Hours 233 0xE9 Media Wearout Indicator 234 0xEA Average erase count AND Maximum Erase Count 235 0xEB Good Block Count AND System(Free) Block Count 240 0xF0 Head Flying Hours 240 0xF0 Transfer Error Rate (Fujitsu) 241 0xF1 Total LBAs Written 242 0xF2 Total LBAs Read 250 0xFA Read Error Retry Rate 254 0xFE Free Fall Protection #ce Local $oMyError = ObjEvent("AutoIt.Error", "_MyErrFunc") Local $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI") Local $s, $i, $strVendorSpecific, $colTemp $colTemp = $objWMIService.ExecQuery("SELECT * FROM MSStorageDriver_ATAPISmartData") For $objItem In $colTemp $strVendorSpecific = $objItem.VendorSpecific For $i = 2 To UBound($strVendorSpecific) - 1 Step 12 If $strVendorSpecific[$i] = 0xC2 Then ; find Vendor Parameter #194 - Temperatur $s &= " " & $strVendorSpecific[$i + 5] ; Raw/Value celsuis ContinueLoop 2 EndIf Next For $i = 2 To UBound($strVendorSpecific) - 1 Step 12 If $strVendorSpecific[$i] = 0xBE Then ; find Vendor Parameter #190 - Airflow Temperatur (if no tempetature is found) $s &= " " & $strVendorSpecific[$i + 5] ; Raw/Value celsuis ContinueLoop 2 EndIf Next Next Return $s EndFunc ;==>_WMI_GetATAPISmartData
    1 point
  20. FuryCell

    VCTemp

    VCTemp Site Hope some people find the tool or code useful. It is my first time dealing with dllstructs. Also, for people interested in interfacing with CoreTemp in their own scripts here is a link and a snippet of the related code in my app. http://www.alcpu.com/CoreTemp/developers.html $DLL = DllOpen("GetCoreTempInfo.dll") If $DLL=-1 Then MsgBox(0,"VCTemp:Error",'Failed to open "GetCoreTempInfo.dll". VCTemp will now exit.') Exit EndIf $Struct = DllStructCreate("uint[256];uint[128];uint;uint;float[256];float;float;float;float;char[100];BOOLEAN;BYTE") Func GetTemps($hDLL, $vStruct) Local $sReturn, $cTempFormat, $iCores, $iCounter $Ret=DllCall($hDLL, "BOOLEAN", "fnGetCoreTempInfoAlt", "ptr", DllStructGetPtr($vStruct)) If @Error Then Return ".ERROR." If $Ret[0]<>1 Then Return ".NODATA." $iCores = DllStructGetData($vStruct, 3) Switch DllStructGetData($vStruct, 11) Case 1 $cTempFormat = "F" Case 0 $cTempFormat = "C" EndSwitch For $iCounter = 1 To $iCores $sReturn &= Round(DllStructGetData($vStruct, 5, $iCounter)) & $cTempFormat If $iCounter <> $iCores Then $sReturn &= " " Next Return $sReturn EndFunc ;==>GetTemps
    1 point
×
×
  • Create New...