Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/12/2013 in all areas

  1. WinHttp.au3: #include-once Global Const $HTTP_STATUS_OK = 200 Func HttpPost($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("POST", $sURL, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send($sData) If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Func HttpGet($sURL, $sData = "") Local $oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1") $oHTTP.Open("GET", $sURL & "?" & $sData, False) If (@error) Then Return SetError(1, 0, 0) $oHTTP.Send() If (@error) Then Return SetError(2, 0, 0) If ($oHTTP.Status <> $HTTP_STATUS_OK) Then Return SetError(3, 0, 0) Return SetError(0, 0, $oHTTP.ResponseText) EndFunc Example 1: #include "WinHttp.au3" Global $MD5 = HttpPost("http://www.afk-manager.ir/test/post.php", "password=WeWantThisAsMd5") MsgBox(64, "MD5", $MD5) Example 2: #include "WinHttp.au3" Global $sGet = HttpGet("http://www.google.com/") FileWrite("Google.txt", $sGet) Speed compare: [WinHttp.WinHttpRequest.5.1 GET] 1 = 422.961162765649 2 = 455.738280639636 3 = 441.821516504421 4 = 390.538648365335 Total = 1711.059608275041 Average = 427.7649020687603 [WinHttp.WinHttpRequest.5.1 POST] 1 = 826.436200956633 2 = 872.366642546045 3 = 871.266802895081 4 = 875.792832686324 Total = 3445.862479084083 Average = 861.4656197710208 [HTTP UDF GET] 1 = 984.282912132673 2 = 813.896511915435 3 = 781.158836566862 4 = 791.901235916364 Total = 3371.239496531334 Average = 842.8098741328335 [HTTP UDF POST] 1 = 788.734835486743 2 = 975.688234142967 3 = 785.810779035388 4 = 847.537193542955 Total = 3397.771042208053 Average = 849.4427605520133 [InetRead GET] 1 = 672.120733570292 2 = 595.221462195098 3 = 561.122261209642 4 = 738.180516302658 Total = 2566.64497327769 Average = 641.6612433194225 Tests result: Server 2003 32bit OK Server 2003 64bit Not Tested Server 2008 32bit Not Tested Server 2008 64bit OK XP 32bit OK XP 64bit Not Tested Vista 32bit Not Tested Vista 64bit Not Tested 7 32bit OK 7 64bit OK 8 32bit OK 8 64bit OK Are you interested? Check this out: http://msdn.microsoft.com/en-us/library/windows/desktop/aa384106(v=vs.85).aspx
    1 point
  2. This is a modification of a script that was originally posted back in 2006, that was itself a modification of a script in the same thread, which was a modification of another script linked in that thread. All credits remain in the header as to who contributed to this. The only credit I take in this script is modifying parts of it to: 1.make it a bit faster, by removing a ReDim that was inside a loop 2.add support for OSs other than XP because of the number of file properties returned 3.add support for the future if the number of file properties returned changes again with future versions of Windows Please take note, this script will only work if you know the name of the property you're trying to retrieve. These properties are dependent upon the OS version, the OS language, and the file's properties. This function does not take any of these things into account, if you want to use this and make it OS neutral, you'll have to do that in your script, because it doesn't get done in here. Fortunately, if you access this function and leave the parameter $FGP_Property blank, it will return an array of all the properties that Windows knows about, and in the language that Windows is running in. Windows XP only returns 38 properties, Windows 7 returns 288, Windows 8 returns 290. The same properties can have different names depending on which OS you're using this with. Update Sept. 6, 2017 Changed the code slightly to make sure the return includes all properties, the last update cut off some of the properties at the end, and increased the $iPropertyCount to 500 (from 300) because of Windows 10 file property count increase. Update: Jun-25-2013 I have tweaked this function again, a small update. Added a new parameter to the function, $iPropertyCount, with a default setting of 300. This parameter was previously hard coded inside the function, now you are able to adjust it to the setting you desire/require. This value is used to determine how many file properties will be searched for the value passed in $FGP_PROPERTY, or the maximum amount of properties that will be returned in the array if $FGP_PROPERTY is a blank string. The $FGP_PROPERTY parameter will now accept the Default keyword in place of a blank string, which tells the function to return an array of all known properties, up to the setting of $iPropertyCount. Update: Feb-11-2013 I have updated this function again. Now it has a single point of return, except for error exceptions, instead of multiple places that it returned from previously. I've renamed the variables used so that they'll be less chance of a name collision with someone's script. Fixed a small bug that added a blank line to the end of the array returned when getting all properties. Changed the return value on an error from 0 to an empty string. NOTE: This is a repost of a thread I had already posted last year. I went looking for it today to update the code in it, and found that it had disappeared. New code #include <File.au3> ; only used for the example script, not needed for the UDF #include <Array.au3> ; only used for the example script, not needed for the UDF #include <Constants.au3> ; only used for the MsgBox, not needed for the UDF $sFolder = FileSelectFolder("Select a folder to scan", "") $sFolder &= "" $aFiles = _FileListToArray($sFolder, "*.exe") For $I = 1 To $aFiles[0] $aDetails = _FileGetProperty($sFolder & "\" & $aFiles[$I]) ; Returns an array with all properties of the file _ArrayDisplay($aDetails) Next Global $sDetails = _FileGetProperty($sFolder & "\" & $aFiles[$aFiles[0]], "date modified") MsgBox($MB_SYSTEMMODAL, "Date Modified", $sDetails) ;=============================================================================== ; Function Name.....: _FileGetProperty ; Description.......: Returns a property or all properties for a file. ; Version...........: 1.0.2 ; Change Date.......: 05-16-2012 ; AutoIt Version....: 3.2.12.1+ ; Parameter(s)......: $FGP_Path - String containing the file path to return the property from. ; $FGP_PROPERTY - [optional] String containing the name of the property to return. (default = "") ; $iPropertyCount - [optional] The number of properties to search through for $FGP_PROPERTY, or the number of items ; returned in the array if $FGP_PROPERTY is blank. (default = 300) ; Requirements(s)...: None ; Return Value(s)...: Success: Returns a string containing the property value. ; If $FGP_PROPERTY is blank, a two-dimensional array is returned: ; $av_array[0][0] = Number of properties. ; $av_array[1][0] = 1st property name. ; $as_array[1][1] = 1st property value. ; $av_array[n][0] = nth property name. ; $as_array[n][1] = nth property value. ; Failure: Returns an empty string and sets @error to: ; 1 = The folder $FGP_Path does not exist. ; 2 = The property $FGP_PROPERTY does not exist or the array could not be created. ; 3 = Unable to create the "Shell.Application" object $objShell. ; Author(s).........: - Simucal <Simucal@gmail.com> ; - Modified by: Sean Hart <autoit@hartmail.ca> ; - Modified by: teh_hahn <sPiTsHiT@gmx.de> ; - Modified by: BrewManNH ; URL...............: http://www.autoitscript.com/forum/topic/34732-udf-getfileproperty/page__view__findpost__p__557571 ; Note(s)...........: Modified the script that teh_hahn posted at the above link to include the properties that ; Vista and Win 7 include that Windows XP doesn't. Also removed the ReDims for the $av_ret array and ; replaced it with a single ReDim after it has found all the properties, this should speed things up. ; I further updated the code so there's a single point of return except for any errors encountered. ; $iPropertyCount is now a function parameter instead of being hardcoded in the function itself. ;=============================================================================== Func _FileGetProperty($FGP_Path, $FGP_PROPERTY = "", $iPropertyCount = 500) If $FGP_PROPERTY = Default Then $FGP_PROPERTY = "" $FGP_Path = StringRegExpReplace($FGP_Path, '["'']', "") ; strip the quotes, if any from the incoming string If Not FileExists($FGP_Path) Then Return SetError(1, 0, "") ; path not found Local Const $objShell = ObjCreate("Shell.Application") If @error Then Return SetError(3, 0, "") Local Const $FGP_File = StringTrimLeft($FGP_Path, StringInStr($FGP_Path, "\", 0, -1)) Local Const $FGP_Dir = StringTrimRight($FGP_Path, StringLen($FGP_File) + 1) Local Const $objFolder = $objShell.NameSpace($FGP_Dir) Local Const $objFolderItem = $objFolder.Parsename($FGP_File) Local $Return = "", $iError = 0 If $FGP_PROPERTY Then For $I = 0 To $iPropertyCount If $objFolder.GetDetailsOf($objFolder.Items, $I) = $FGP_PROPERTY Then $Return = $objFolder.GetDetailsOf($objFolderItem, $I) EndIf Next If $Return = "" Then $iError = 2 EndIf Else Local $av_ret[$iPropertyCount + 1][2] = [[0]] For $I = 1 To $iPropertyCount If $objFolder.GetDetailsOf($objFolder.Items, $I) Then $av_ret[$I][0] = $objFolder.GetDetailsOf($objFolder.Items, $I - 1) $av_ret[$I][1] = $objFolder.GetDetailsOf($objFolderItem, $I - 1) ;~ $av_ret[0][0] += 1 $av_ret[0][0] = $I EndIf Next ReDim $av_ret[$av_ret[0][0] + 1][2] If Not $av_ret[1][0] Then $iError = 2 $av_ret = $Return Else $Return = $av_ret EndIf EndIf Return SetError($iError, 0, $Return) EndFunc ;==>_FileGetProperty Warning, old code below.
    1 point
  3. There's no reason to use ByRef here. You're not actually sending the function anything so I'm not surprised when it doesn't even run. Perhaps this might be closer to what you're trying to achieve. Global $c ShellExecute("file.pro", "", "C:\FlashPro\", "", @SW_MAXIMIZE) Sleep(4000) ;MsgBox(0, "StringCompare Result (mode 2):", $x) $c = tst() Sleep(1000) ControlClick("FlashPro", "", 3218) ;ok button MsgBox(0, "StringCompare Result (mode 2):", $c) Func tst() Local $sReady = ControlGetText("FlashPro", "Ready", 59393) ;status bar $x = StringCompare($sReady, "Ready", 2) While $x <> 0 Local $sReady = ControlGetText("FlashPro", "Ready", 59393) $x = StringCompare($sReady, "Ready", 2) $c = $c + 1 If $c = 50 Then ExitLoop ; btw this will execute in about 100 ms so not sure what it's purpose is. WEnd Return $x EndFunc NOTE: I didn't test this, I am only changing the way the function is accessed and the value returned.
    1 point
  4. wraithdu

    Themes for SciTE

    I wanted to post a light and dark theme I made based on Solarized - http://ethanschoonover.com/solarized I'd appreciate some feedback, as I'm not 100% sold on the color distribution I came up with. It's pretty close though. I usually work in light themes, but the dark one came out really nice. #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # http://ethanschoonover.com/solarized # Solarized Light #------------------------------------------------------------ #Background style.au3.32=style.*.32=$(font.base),back:#FDF6E3 #CaretLineBackground caret.line.back=#EEE8D5 #Selection Foreground/background and Alpha selection.fore=#268BD2 selection.alpha=50 selection.back=#586E75 # Brace highlight style.au3.34=fore:#859900,back:#FDF6E3 # Brace incomplete highlight style.au3.35=fore:#93A1A1,italics,back:#FDF6E3 #White space style.au3.0=fore:#657B83,back:#FDF6E3 #Comment line style.au3.1=fore:#93A1A1,italics,back:#FDF6E3 #Comment block style.au3.2=fore:#93A1A1,italics,back:#FDF6E3 #Number style.au3.3=fore:#2AA198,back:#FDF6E3 #Function style.au3.4=fore:#268BD2,back:#FDF6E3 #Keyword style.au3.5=fore:#859900,back:#FDF6E3 #Macro style.au3.6=fore:#586E75,bold,back:#FDF6E3 #String style.au3.7=fore:#DC322F,back:#FDF6E3 #Operator style.au3.8=fore:#657B83,back:#FDF6E3 #Variable style.au3.9=fore:#657B83,back:#FDF6E3 #Sent keys style.au3.10=fore:#D33682,back:#FDF6E3 #Pre-Processor style.au3.11=fore:#B58900,back:#FDF6E3 #Special style.au3.12=fore:#6C71C4,italics,back:#FDF6E3 #Abbrev-Expand style.au3.13=fore:#DC322F,back:#FDF6E3 #Com Objects style.au3.14=fore:#CB4B16,italics,back:#FDF6E3 #Standard UDF's style.au3.15=fore:#0080FF,back:#FDF6E3 # Margins # Fold Margin fold.margin.colour=#EEE8D5 fold.margin.highlight.colour=#EEE8D5 # Fold Line fold.highlight.colour=#DC322F # Line Number Margin style.au3.33=$(font.monospaced),fore:#93A1A1,back:#EEE8D5 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-# # http://ethanschoonover.com/solarized # Solarized Dark #------------------------------------------------------------ #Background style.au3.32=style.*.32=$(font.base),back:#002B36 #CaretLineBackground caret.line.back=#073642 #Selection Foreground/background and Alpha selection.fore=#268BD2 selection.alpha=75 selection.back=#93A1A1 # Brace highlight style.au3.34=fore:#859900,back:#002B36 # Brace incomplete highlight style.au3.35=fore:#586E75,italics,back:#002B36 #White space style.au3.0=fore:#839496,back:#002B36 #Comment line style.au3.1=fore:#586E75,italics,back:#002B36 #Comment block style.au3.2=fore:#586E75,italics,back:#002B36 #Number style.au3.3=fore:#2AA198,back:#002B36 #Function style.au3.4=fore:#268BD2,back:#002B36 #Keyword style.au3.5=fore:#859900,back:#002B36 #Macro style.au3.6=fore:#93A1A1,bold,back:#002B36 #String style.au3.7=fore:#DC322F,back:#002B36 #Operator style.au3.8=fore:#839496,back:#002B36 #Variable style.au3.9=fore:#839496,back:#002B36 #Sent keys style.au3.10=fore:#D33682,back:#002B36 #Pre-Processor style.au3.11=fore:#B58900,back:#002B36 #Special style.au3.12=fore:#6C71C4,italics,back:#002B36 #Abbrev-Expand style.au3.13=fore:#DC322F,back:#002B36 #Com Objects style.au3.14=fore:#CB4B16,italics,back:#002B36 #Standard UDF's style.au3.15=fore:#0080FF,back:#002B36 # Margins # Fold Margin fold.margin.colour=#073642 fold.margin.highlight.colour=#073642 # Fold Line fold.highlight.colour=#DC322F # Line Number Margin style.au3.33=$(font.monospaced),fore:#586E75,back:#073642 #-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#
    1 point
  5. As you are installing through an MSI, why are you waiting for anything? You could do the following to install silently, and your script will pause until the installation is complete. ShellExecuteWait("msiexec.exe", '/i "secureclientinstaller.msi" /qn')
    1 point
  6. viceciado

    Progress Bar?

    I'm trying to create a launcher of Need for Speed ​​Underground 2, but I would like to add to my Launcher a progress bar showing that the files are being uploaded, and if possible a few more decorations, I could make a well: -zapped- I would like to put a progress bar between the button "Play without Hack" and "Exit" button. I thank
    1 point
×
×
  • Create New...