Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/03/2013 in all areas

  1. Hello, I did miss it as I looked at the pinned topics and saw no forum rules in them, I realize now that it was ABOVE the forum body... For this I must present my apologies.
    2 points
  2. ProgAndy

    AutoItObject UDF

    The AutoItObject team is proud to announce that the first version of our AutoItObject UDF is complete and ready to use. The project page is located at [currently missing] Please, report bugs and any other issues at our [currently missing], and not here. An overview of all the functions can be found in the online documentation [currently missing] or in the offline .chm documentation file which is included with the [currently missing]. If Origo has problems providing the download, the current version will be mirrored here The UDF requires the current AutoIt version v3.3.4.0! AutoItObject 1.2.8.2.exe AutoItObject 1.2.8.2.zip Please, leave your comments and experiences here. Regards, - trancexx - ProgAndy - monoceres - Kip Our work is published under the Artistic License 2.0 A copy of the FAQ to answer your most urgent questions right away: (can also be found at the online documentation: Some helper-functions: When using the Wrapper, this are some simple methods to get a return value from the resulting array. ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOResult ; Description ...: Returns the return value of the Call to a WraperObject function ; Syntax.........: _AIOResult(Const $aResult [, $vError=0] ) ; Parameters ....: $aResult - the resulting array ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Returnvalue ($aResult[0]) ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOResult(Const $aResult, $vError=0) ; Author: Prog@ndy If IsArray($aResult) Then Return $aResult[0] Return SetError(1,0,$vError) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _AIOParam ; Description ...: Returns the parameter value of the Call to a WraperObject function ; Syntax.........: _AIOParam(Const $aResult, $iParam, $vError=0) ; Parameters ....: $aResult - the resulting array ; $iParam - The parameterindex to return (0: result, 1: first parameter, 2: 2nd parameter, ...) ; $vError - [optional] value to be returned if result is no array (default: 0) ; Return values .: Success - Parameter value ; Failure - $vError, @error set to 1 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _AIOParam(Const $aResult, $iParam, $vError=0) ; Author: Prog@ndy If UBound($aResult)-1 < $iParam Then Return SetError(1,0,$vError) Return SetExtended($aResult[0], $aResult[$iParam]) EndFunc
    1 point
  3. wakillon

    Water Effects

    Browsing a Chinese AutoIt forum, i fall on a little pearl that i want to share with you ! I have already seen water effects example with autoit, but this one is very easy to create using waterctrl.dll Only BMP are supported. Position of Blob water can be set by coordinates and mouse movements (and clicks) when over bmp create traces on water. All files are embeded in script with BinaryToAu3Kompressor. WaterEffect.au3 Hope you like it !
    1 point
  4. AAMP- Advanced AutoIt Media Player This is the all new version of AAMP... Give it a go. Current Version: 2.0.0.4 Last Updated: 15 July 2009 Source: Yes (Open source) (Please view licensing details at the end of this post) Download Link This version of AAMP (should be) so much better than the old one! All New Features I have re-written the library to use a SQLite Database.Added new featuresWebControl InterfaceAllows you to control AAMP from any computer, anywhere (provided the correct ports are fowarded.)Password protected for security and peace of mind (so that no one will change your favourite song!)Skinnable interfaceLets you change certain elements of the design, making your media player suite your style.IconsTextBackground[*]Lanugauge filesAllows for localization of text.Means users can fix bugs, and add new features (certain conditions apply for this)Allows others to learn. I am all for other members to learn how certain things are done.Massive To-Do List Customizable layouts.Don't like the controls in the top left? Why not move them to the bottom right instead! Move certain parts of the interface to suit your liking.This possibly might include a new layout. Currently I'm not very happy with it. Suggestions are extremely welcome!Audio OptionsAllows the use of EAX Audio Effects and moreVisualizationsMake your music into art with all new visualizations.Allows the use of Sonique, Winamp, Windows Media Player, and BassBox visual plugins.Thanks must go to Achillies- _GetMusicDir()MrBond007 -His script "Chip-It" uses BASSMOD.dll to play "ChipTunes"WeaponX- File recursive search functionProgAndy/eukalyptus for their assitance with BASS.dll library.Go Squared Ltd - The creators of the icons used in AAMP.Condtions for Open Source: AAMP is released under GNU General Public License as published by the Free Software Foundation. AAMP is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. AAMP is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. Please note that BASS.DLL is released under a different license, which availiable from their website. Thats it for now folks! Cheers, Brett
    1 point
  5. S3d.au3 This UDF enables you to draw simple 3D graphics. Features: Simple and easy to useDoesn't require external libraries. You don't need OpenGL or DirectX. Available Functions: _S3d_SelectGraphic($hGraphic, $iWidth, $iHeight, $iSmooth = 2) _S3d_SelectPen($hPen) _S3d_SelectBrush($hBrush) _S3d_SelectFont($hFont) _S3d_SelectFormat($hFormat) _S3d_SetClipCount($iCount) _S3d_Dist($nPos1X = 0, $nPos1Y = 0, $nPos1Z = 0, $nPos2X = 0, $nPos2Y = 0, $nPos2Z = 0) _S3d_DistFromCamera($nPosX = 0, $nPosY = 0, $nPosZ = 0) _S3d_SetCamera($nCameraX, $nCameraY, $nCameraZ, $nTargetX, $nTargetY, $nTargetZ, $nVAngle = 0, $nFAngle = 0.8, $nFScale = 1000) _S3d_SetCameraEx($nCameraX, $nCameraY, $nCameraZ, $nXYAngle = 0, $nXZAngle = 0, $nVAngle = 0, $nFAngle = 0.8, $nFScale = 1000) _S3d_SetLocalMatrix($n00 = 1, $n01 = 0, $n02 = 0, $n03 = 0, $n10 = 0, $n11 = 1, $n12 = 0, $n13 = 0, $n20 = 0, $n21 = 0, $n22 = 1, $n23 = 0, $n30 = 0, $n31 = 0, $n32 = 0, $n33 = 1) _S3d_MultiplyLocalMatrix($n00 = 1, $n01 = 0, $n02 = 0, $n03 = 0, $n10 = 0, $n11 = 1, $n12 = 0, $n13 = 0, $n20 = 0, $n21 = 0, $n22 = 1, $n23 = 0, $n30 = 0, $n31 = 0, $n32 = 0, $n33 = 1, $fRefresh = True) _S3d_LocalTranslate($nX, $nY, $nZ, $fRefresh = True) _S3d_LocalScale($nX, $nY, $nZ, $fRefresh = True) _S3d_LocalRotateX($nAngle, $fDeg = False, $fRefresh = True) _S3d_LocalRotateY($nAngle, $fDeg = False, $fRefresh = True) _S3d_LocalRotateZ($nAngle, $fDeg = False, $fRefresh = True) _S3d_GetLocalMatrix() _S3d_SetLocalMatrixEx(ByRef $aMatrix) _S3d_GetPos($nX, $nY, $nZ) _S3d_InitCurrentPos() _S3d_MoveTo($nX, $nY, $nZ = Default) _S3d_Clear($nColor = 0xFF000000) _S3d_Line($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2) _S3d_LineTo($nX, $nY, $nZ) _S3d_Box($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2) _S3d_Arrow($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2, $nLen = 30, $nAngle = 0.6) _S3d_Circle($nX, $nY, $nZ, $nRad, $fFill = False) _S3d_Polygon($aPoints, $fFill = False) _S3d_RegPolygon($nX, $nY, $nZ, $nRad, $iNum, $fFill = True) _S3d_Star($nX, $nY, $nZ, $nRad1, $nRad2, $iNum, $fFill = True) _S3d_Square($nX1, $nY1, $nZ1, $nX2, $nY2, $nZ2, $nX3, $nY3, $nZ3, $nX4, $nY4, $nZ4, $fFill = True) _S3d_MoveTo2($nXL, $nYL, $nZL, $nXR, $nYR, $nZR) _S3d_RibbonTo($nXL, $nYL, $nZL, $nXR, $nYR, $nZR) _S3d_String($sString, $nX, $nY, $nZ) New version!S3d.zip v1.3.1 (09/JUN/2014) * Archives S3d.zip v1.3.0 (05/SEP/2013) S3d.zip v1.2.3 (16/AUG/2013) Enjoy!
    1 point
  6. You are welcome. Currently I'm quite busy with my new job and this will probably last some time. Br, UEZ
    1 point
  7. Try it at . Br, UEZ
    1 point
  8. I did and one more time thanks for you patiences and keep trying for help. I know it was hard because ... I found no one else post similiar or got the right answer for this matter
    1 point
  9. ahh, finally.. I almost was going to kill myself Please always mark the thread as answered to help getting the question easily by others.
    1 point
  10. Mat

    Games made in Autoit.

    Tetris.au3: https://gist.github.com/MattDiesel/034ec296d46575bf2f9b
    1 point
  11. Single or double it still works, either way is right and neither is better or worse for new users, as long as it's workable code.
    1 point
  12. I already told you how to do that, take your batch commands, stick them into a run function and you're done. #RequireAdmin Run("Assoc .db=MyAppendage", "", @SW_HIDE) Run("Ftype MyAppendage="%%1"", "", @SW_HIDE) Or something similar to that. Personally I'd remove the @SW_HIDE so you can see what error you might get, if any, until you know it's working.
    1 point
  13. strongy, You can always overlap controls, but you need to make sure that only one is enabled at any one time. if not, then AutoIt does not know which of the controls to action and so does nothing. If you ever find that controls are not working, the first thing to check is that there is not an overlapping label. M23
    1 point
  14. Mat

    _WinSetClientPos

    Following on from #2368. This sets moves the window using the client, rather than the non-client, area. This will make a difference when using some styles. The function has workarounds so it will work with WS_OVERLAPPED, WS_HSCROLL and WS_VSCROLL. I've tested it with quite a few styles, and in all cases WinGetClientSize returned the same as the input parameters. $l and $t (left and top) can be set to default to center the window. -1 will move it so that the client is actually at -1, which is probably not as intended. #include <WinAPISys.au3> #include <WindowsConstants.au3> #include <Constants.au3> Func _WinSetClientPos($sTitle, $sText, $w, $h, $l = Default, $t = Default) Local Const $iDefStyle = BitOR($WS_MINIMIZEBOX, $WS_CAPTION, $WS_POPUP, $WS_SYSMENU) Local Const $iDefExStyle = $WS_EX_WINDOWEDGE Local $hWnd = WinGetHandle($sTitle, $sText) If @error Then Return SetError(1, 0, 0) Local $x = $l, $y = $t If IsKeyword($l) = $KEYWORD_DEFAULT Then $x = 100 If IsKeyword($t) = $KEYWORD_DEFAULT Then $y = 100 Local $iStyle = _WinAPI_GetWindowLong($hWnd, $GWL_STYLE) Local $iExStyle = _WinAPI_GetWindowLong($hWnd, $GWL_EXSTYLE) If $iStyle = -1 Then $iStyle = $iDefStyle If $iExStyle = -1 Then $iExStyle = $iDefExStyle Local $rect = DllStructCreate($tagRECT) DllStructSetData($rect, "left", $x) DllStructSetData($rect, "right", $x + $w) DllStructSetData($rect, "top", $y) DllStructSetData($rect, "bottom", $y + $h) If Not BitAND($iStyle, BitOR(BitAND($WS_CAPTION, BitNOT($WS_BORDER)), $WS_POPUP)) Then _WinAPI_AdjustWindowRectEx($rect, BitOR($iStyle, $WS_CAPTION), $iExStyle, False) Else _WinAPI_AdjustWindowRectEx($rect, $iStyle, $iExStyle, False) EndIf $w = DllStructGetData($rect, "right") - DllStructGetData($rect, "left") $h = DllStructGetData($rect, "bottom") - DllStructGetData($rect, "top") If BitAND($iStyle, $WS_VSCROLL) Then $w += _WinAPI_GetSystemMetrics($SM_CXVSCROLL) EndIf If BitAND($iStyle, $WS_HSCROLL) Then $h += _WinAPI_GetSystemMetrics($SM_CYHSCROLL) EndIf If IsKeyword($l) = $KEYWORD_DEFAULT Then $x = (@DesktopWidth - $w) / 2 Else $x = DllStructGetData($rect, "left") EndIf If IsKeyword($t) = $KEYWORD_DEFAULT Then $y = (@DesktopHeight - $h) / 2 Else $y = DllStructGetData($rect, "top") EndIf Return WinMove($hWnd, "", $x, $y, $w, $h) Endfunc ;==>_WinSetClientPos An example of using this for a GUICreate wrapper: Func _GUICreate($sTitle, $w, $h, $x = -1, $y = -1, $iStyle = -1, $iExStyle = -1, $hParent = 0) Local $hRet = GUICreate($sTitle, $w, $h, $x, $y, $iStyle, $iExStyle, $hParent) If $x = -1 Then $x = Default If $y = -1 Then $y = Default _WinSetClientPos($hRet, "", $w, $h, $x, $y) Return $hRet EndFunc ;==>_GUICreate This is a much better way to make GUIs, especially if you are like me, and rely on maths rather than koda to layout your controls. Matt Edit: Requires beta for new WinAPI functions.
    1 point
  15. legend, Please do not delete your posts like that - it does not help anyone searching for answers to the same problem in the future. M23
    1 point
  16. water

    Doubt UDF Outlook

    Sure. Please have a look at my OutlookEX UDF. Function _OL_ItemFind could be a start.
    1 point
  17. bazinga, I would do something like this: #include <GUIConstantsEx.au3> #include <ComboConstants.au3> #include <Array.au3> #include <Misc.au3> Global $aKeys[3][2] = [ ["X", 58], ["C", 43], ["V", 56] ] $hDLL = DllOpen("user32.dll") ; You are calling _IsPressed in a loop - so use the DLL handle $iKeyCode = 0 ; You need to declare this $hGUI = GUICreate("Test", 500, 500) ; Do not set a default value in the combo - then you react to the first selection $cCombo = GUICtrlCreateCombo("", 130, 100, 50, 20, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) For $i = 0 To Ubound($aKeys) - 1 GUICtrlSetData($cCombo, $aKeys[$i][0]) Next GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE DllClose($hDLL) Exit Case $cCombo ; Combo selection changed - get index of new selection $iIndex = _ArraySearch($aKeys, GUICtrlRead($cCombo)) ; Set keycode to the correct vlaue $iKeyCode = $aKeys[$iIndex][1] EndSwitch If _IsPressed($iKeyCode, $hDLL) Then Do Send ("0") ; No need for {} Until Not _IsPressed($iKeyCode, $hDLL) EndIf WEnd All clear? M23
    1 point
  18. FireFox

    Text Color

    Something like this: #include <WinAPI.au3> Global Const $SM_CYCAPTION = 4, $SM_CXDLGFRAME = 7 Local Const $iCaptionHeight = _WinAPI_GetSystemMetrics($SM_CYCAPTION) Local Const $iBorderSize = _WinAPI_GetSystemMetrics($SM_CXDLGFRAME) ; your code here ConsoleWrite("Color: " & Hex(ControlGetColor("<title>", "Static1"), 6) & @CrLf) Func ControlGetColor($hWnd, $vControlID, $iBkColor = 0xF0F0F0) Local $aCtrlPos = ControlGetPos($hWnd, "", $vControlID) Local $aWgp = WinGetPos($hWnd) For $iX = $aWgp[0] + $aCtrlPos[0] To $aWgp[0] + $aCtrlPos[0] + $aCtrlPos[2] For $iY = $aWgp[1] + $aCtrlPos[1] To $aWgp[1] + $aCtrlPos[1] + $aCtrlPos[3] $iColor = PixelGetColor($iX + $iBorderSize, $iY + $iBorderSize + $iCaptionHeight) If $iColor <> $iBkColor Then Return $iColor Next Next Return -1 EndFunc But it's not accurate at all, if you know the possible colors then it would be better to put them in an array and if a color from this array is found then return the color. Br, FireFox.
    1 point
  19. Andreik

    IIS Get sites Object

    Put #RequireAdmin at start of your script. For some providers you need adiminstrator rights.
    1 point
  20. TheSaint

    Is it possible?

    Perhaps so , but others when they get to see latest posts, might want to put me in the crosshairs.
    1 point
  21. TheSaint

    Is it possible?

    I've always wanted to be that organized, but Life just gets in the way. It's like most things I guess ... when you don't know enough and perhaps have the opportunity to start things off in the best manner, you don't often even conceive the benefit. Later on, it's a lot more hard work. And then, things happen too. I was better organized with my programming in years gone by, and had my main Desktop PC (now dead) set up for my programming very well. When it died, and I transferred my work environment to the Laptop, I had enough on my plate, that spending the time to remember and replicate what I had on the PC, just proved too big for my drive ... and time. I'd had SciTE setup perfectly and my Toolbar For Any program, plus Snippet access and several other things. I've still not got back to that, and to be fair to me, the Laptop was supposed to be very short term and temporary, which it hasn't proved to be. Oops, I was bout to carry on there, with a word wall no doubt, but just remembered where I was. Perhaps Melba23 or other MOD, might want to split this discussion about Declarations & Scope off onto a Chat topic? With a reference link at both ends.
    1 point
  22. orbs

    Decrypt data

    you must use BinaryToString() on the return value of _Crypt_DecryptData() - see the remarks in the help file.
    1 point
  23. czardas

    Is it possible?

    Well thanks the feeling is mutual, and the answer is no my functions don't all work out of the box. I generally try to do that. Most of the stuff >here I'm fairly satisfied with.
    1 point
  24. Hi! This is a fully functional video player that is powered by DirectShow to provide the best speed, stability, file support and features. The DirectShow renderer is VMR9, which is utilizing Direct3D9, making playback hardware powered. Some of the features are: Most video format available (through installed filters)Minimal GUI, designed not to interuptSaving favourite videosTaking snapshotsAll in one menu (context menu)The todo list is pretty much this: Settings dialogMore hotkeysOption to change file associations.What do you think?Oh, this is also a cooperative project including me and AdmiralAlkex A screenshot of the player in use: Download below, with source code (au3 part) and compiled exe. AAA_Alpha.zip Ps. There is a well hidden easter egg, find it and get cookie! Ds. Don't forget to check out the sister project. AAA Thumbnailer
    1 point
  25. _ArrayConcatenate only does one ReDim, and then just loops through the source array. It's very simple in operation, and I can't think of an easier way to do this. Unless you're dealing with 2D arrays which it doesn't work with.
    1 point
  26. ;#include <array.au3> -- you dont use _Array funcs so you dont need this include Opt('MustDeclareVars', 1) HotKeySet("{ESCAPE}", "F_quit") Global $elmnt[10] = [ _ "One", "Two", "Three", "Four", "Five", _ "Six", "Seven", "Eight", "Nine", "Ten"] ; dont declare global variables in a func - it's bad coding practice and sometimes may not work as expected ;~ Global $bQuit = False F_loop() Func F_loop() Local $count = -1 Do ;~ if $bQuit Then ExitLoop -- just another variant of your quit func $count = $count + 1 F_Show($count); pass count to function F_Show2($count); pass count to function Until $count = UBound($elmnt) - 1 ; with this function you don't need to declare an extra variable MsgBox(0, "", "Done!") ; if you use exitloop, this will be the first executed line EndFunc ;==>F_loop Func F_Show($count) MsgBox(0, "Message Box", $elmnt[$count], 1) EndFunc ;==>F_Show Func F_Show2($count) MsgBox(0, "Are you sure?", "OKAY", 1) EndFunc ;==>F_Show2 Func F_quit() ;~ $bQuit = True Exit EndFunc ;==>F_quit I've rewritten your script and added a few comments which will be usefull to you.
    1 point
  27. Func F_loop() Local $count = -1 Do $count = $count+1 F_Show($count); pass count to function Until $count = $ucount MsgBox(0, "", "Done!") EndFunc Func F_Show($count) MsgBox(0, "Message Box", $elmnt[$count]) EndFunc
    1 point
  28. MsgBox has a WAIT parameter, which you can use to auto close it after the seconds you've specified.
    1 point
  29. MachinistProgrammer

    STDOUT ?

    I forgot the run param to let the script inherret the stdout and stderr stream and i used your data loop #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Version=Beta #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Change2CUI=y #AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_AU3Check=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#Netux_scriptable_webserver.au3#================================== ;File Name.......:Netux_scriptable_webserver.au3 ;Creator.........:sean.campbell7 ;Created with....:Created with ISN AutoIt Studio ;Version.........:0.91 BETA ;============================================= #include <Misc.au3> ; Only used for _Iif #include <file.au3> #include <Array.au3> Local $Dlog = @ScriptDir & "\Logs\NetuX_log_" & @MDAY & "_" & @MON & "_" & @YEAR & ".log" Local $autoit = @AutoItExe OnAutoItExitRegister("_exit") ; // OPTIONS HERE // Local $intcfg = @ScriptDir & "\CFG\init.ini" Local $sRootDir = @ScriptDir & "\" & IniRead($intcfg, "Main", "MD", "Webroot") Local $sIP = @IPAddress1 if IniRead($intcfg, "Main", "Uselocal", "false") = "true" Then $sIP = "127.0.0.1" EndIf Local $iPort = 80 ; the listening port Local $sServerAddress = "http://" & $sIP & "/" Local $sServerName = "NetuX/1.3 (" & @OSVersion & ") AutoIt " & @AutoItVersion ; // END OF OPTIONS // Local $aSocket[1] ; Creates an array to store all the possible users Local $sBuffer[1] ; All these users have buffers when sending/receiving, so we need a place to store those TCPStartup() ; AutoIt needs to initialize the TCP functions $iMainSocket = TCPListen($sIP, $iPort) ;create main listening socket If @error Then ; if you fail creating a socket, exit the application MsgBox(266256, "NetuX 1.3", "Error : NetuX cannot establish a listening port check to see of any other" & @CRLF & "server software is running", 0) _log("Error : Unknown Host Exeption, Exiting") Exit ; if your server is part of a GUI that has nothing to do with the server, you'll need to remove the Exit keyword and notify the user that the HTTP server will not work. EndIf ConsoleWrite("Server established on : " & $sServerAddress & @CRLF) ; If you're in SciTE, _log("established server : " & $sServerAddress) While 1 $iNewSocket = TCPAccept($iMainSocket) ; Tries to accept incoming connections If $iNewSocket >= 0 Then ; Verifies that there actually is an incoming connection Local $user = UBound($aSocket) ; some code to allow infinate users ReDim $aSocket[$user + 1] ReDim $sBuffer[$user + 1] $aSocket[$user] = $iNewSocket ConsoleWrite("New Client : " & TCPSocketToIP($iNewSocket) & @CRLF) _log("Client connected on : " & TCPSocketToIP($iNewSocket)) EndIf For $x = 0 to UBound($aSocket) - 1 ; A big loop to receive data from everyone connected $sNewData = TCPRecv($aSocket[$x], 1024) ; Receives a whole lot of data if possible If $sNewData Then ; data received $sBuffer[$x] &= $sNewData ;store it in the buffer If StringInStr(StringStripCR($sBuffer[$x]), @LF & @LF) Then ; if the request has ended .. $sFirstLine = StringLeft($sBuffer[$x], StringInStr($sBuffer[$x], @LF)) ; helps to get the type of the request $sRequestType = StringLeft($sFirstLine, StringInStr($sFirstLine, " ") - 1) ; gets the type of the request If $sRequestType = "GET" Then ; user wants to download a file or whatever .. $sRequest = StringTrimRight(StringTrimLeft($sFirstLine, 4), 11) ; let's see what file he actually wants If StringInStr(StringReplace($sRequest, "\", "/"), "/.") Then ; Disallow any attempts to go back a folder _HTTP_Send400($aSocket[$x]) ; sends back an error ConsoleWrite("Client requested bad address" & @CRLF) _log("Error : code 400 requested bad address") Else If $sRequest = "/" Then ; user has requested the root if FileExists($sRootDir & "\index.htm") Then $sRequest = "/index.htm" ElseIf FileExists($sRootDir & "\index.htm") Then $sRequest = "/index.html" ElseIf FileExists($sRootDir & "\index.au3") Then $sRequest = "/index.au3" EndIf EndIf $sRequest = StringReplace($sRequest, "/", "\") ; convert HTTP slashes to windows slashes, not really required because windows accepts both If FileExists($sRootDir & "\" & $sRequest) Then ; makes sure the file that the user wants exists $sFileType = StringRight($sRequest, 4) ; determines the file type, so that we may choose what mine type to use Switch $sFileType Case "html", ".htm" ; in case of normal HTML files _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "text/html") Case ".css" ; in case of style sheets _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "text/css") Case ".jpg", "jpeg" ; for common images _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "image/jpeg") Case ".png" ; another common image format _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "image/png") Case ".au3" _autodetectscript($sRequest, $aSocket[$x]) Case Else ; this is for .exe, .zip, or anything else that is not supported is downloaded to the client using a application/octet-stream _HTTP_SendFile($aSocket[$x], $sRootDir & $sRequest, "application/octet-stream") EndSwitch Else _autodetectscript($sRequest, $aSocket[$x]) EndIf EndIf ElseIf $sRequestType = "POST" Then ; user has come to us with data, we need to parse that data and based on that do something special $aPOST = _HTTP_GetPost($sBuffer[$x]) ; parses the post data $sComment = _HTTP_POST("wintext", $aPOST) ; Like PHPs _POST, but it requires the second parameter to be the return value from _Get_Post _HTTP_ConvertString($sComment) ; Needs to convert the POST HTTP string into a normal string ConsoleWrite($sComment) $data = FileRead($sRootDir & "\template.html") $data = StringReplace($data, "<?au3 Replace me ?>", $sComment) $h = FileOpen($sRootDir & "\index.html", 2) FileWrite($h, $data) FileClose($h) $h = FileOpen($sRootDir & "\clean.html", 2) FileWrite($h, $sComment) FileClose($h) _HTTP_SendFile($aSocket[$x], $sRootDir & "\index.html", "text/html") ; Sends back the new file we just created EndIf $sBuffer[$x] = "" ; clears the buffer because we just used to buffer and did some actions based on them $aSocket[$x] = -1 ; the socket is automatically closed so we reset the socket so that we may accept new clients EndIf EndIf Next Sleep(10) WEnd Func _HTTP_ConvertString(ByRef $sInput) ; converts any characters like %20 into space 8) $sInput = StringReplace($sInput, '+', ' ') StringReplace($sInput, '%', '') For $t = 0 To @extended $Find_Char = StringLeft(StringTrimLeft($sInput, StringInStr($sInput, '%')), 2) $sInput = StringReplace($sInput, '%' & $Find_Char, Chr(Dec($Find_Char))) Next EndFunc Func _HTTP_SendHTML($hSocket, $sHTML, $sReply = "200 OK") ; sends HTML data on X socket _HTTP_SendData($hSocket, Binary($sHTML), "text/html", $sReply) EndFunc Func _HTTP_SendFile($hSocket, $sFileLoc, $sMimeType, $sReply = "200 OK") ; Sends a file back to the client on X socket, with X mime-type Local $hFile, $sImgBuffer, $sPacket, $a ConsoleWrite("Sending " & $sFileLoc & @CRLF) $hFile = FileOpen($sFileLoc, 16) $bFileData = FileRead($hFile) FileClose($hFile) _HTTP_SendData($hSocket, $bFileData, $sMimeType, $sReply) EndFunc Func _HTTP_SendData($hSocket, $bData, $sMimeType, $sReply = "200 OK") $sPacket = Binary("HTTP/1.1 " & $sReply & @CRLF & _ "Server: " & $sServerName & @CRLF & _ "Connection: close" & @CRLF & _ "Content-Lenght: " & BinaryLen($bData) & @CRLF & _ "Content-Type: " & $sMimeType & @CRLF & _ @CRLF) TCPSend($hSocket, $sPacket) ; Send start of packet While BinaryLen($bData) ; Send data in chunks (most code by Larry) $a = TCPSend($hSocket, $bData) ; TCPSend returns the number of bytes sent $bData = BinaryMid($bData, $a + 1, BinaryLen($bData) - $a) WEnd $sPacket = Binary(@CRLF & @CRLF) ; Finish the packet TCPSend($hSocket, $sPacket) TCPCloseSocket($hSocket) EndFunc Func _HTTP_Send404($hSocket) ; Sends back a basic 404 error Local $s404Loc = $sRootDir & "\404.html" If FileExists($s404Loc) Then _HTTP_SendFile($hSocket, $s404Loc, "text/html") Else _HTTP_SendHTML($hSocket, "<h1>404 Error:</h1><br/>The file you requested could not be found.<br/><br/><i>Netux SND HTTP Server version 1.3</i>", "404 not found") EndIf EndFunc Func _HTTP_Send400($hSocket) ; Sends back a basic 400 error Local $s400Loc = $sRootDir & "\400.html" If FileExists($s400Loc) Then _HTTP_SendFile($hSocket, $s400Loc, "text/html") Else _HTTP_SendHTML($hSocket, "<h1>400 Error:</h1><br/>bad or incorrect syntax in address.<br/><br/><i>Netux SND HTTP Server version 1.3</i>", "400 bad") EndIf EndFunc Func _HTTP_GetPost($s_Buffer) ; parses incoming POST data Local $sTempPost, $sLen, $sPostData, $sTemp ; Get the lenght of the data in the POST $sTempPost = StringTrimLeft($s_Buffer, StringInStr($s_Buffer, "Content-Length:")) $sLen = StringTrimLeft($sTempPost, StringInStr($sTempPost, ": ")) ; Create the base struck $sPostData = StringSplit(StringRight($s_Buffer, $sLen), "&") Local $sReturn[$sPostData[0] + 1][2] For $t = 1 To $sPostData[0] $sTemp = StringSplit($sPostData[$t], "=") If $sTemp[0] >= 2 Then $sReturn[$t][0] = $sTemp[1] $sReturn[$t][1] = $sTemp[2] EndIf Next Return $sReturn EndFunc Func _HTTP_Post($sName, $sArray) ; Returns a POST variable like a associative array. For $i = 1 to UBound($sArray) - 1 If $sArray[$i][0] = $sName Then Return $sArray[$i][1] EndIf Next Return "" EndFunc Func _log($text) ; its just for logging if IniRead($intcfg, "Main", "log", "true") = "true" Then local $ilog = FileOpen($Dlog, 1) FileWrite($ilog, @HOUR & ":" & @MIN & ":" & @SEC & ":" & $text & @CRLF) EndIf EndFunc Func TCPSocketToIP($SHOCKET) ;from the helpfile Local $sockaddr, $aRet $sockaddr = DllStructCreate("short;ushort;uint;char[8]") $aRet = DllCall("Ws2_32.dll", "int", "getpeername", "int", $SHOCKET, _ "ptr", DllStructGetPtr($sockaddr), "int*", DllStructGetSize($sockaddr)) If Not @error And $aRet[0] = 0 Then $aRet = DllCall("Ws2_32.dll", "str", "inet_ntoa", "int", DllStructGetData($sockaddr, 3)) If Not @error Then $aRet = $aRet[0] Else $aRet = 0 EndIf $sockaddr = 0 Return $aRet EndFunc ;==>SocketToIP Func _autodetectscript($request, $hSocket) $snp = StringSplit($request, "?") If FileExists($sRootDir & $snp[1]) Then $ipid = Run($autoit & ' "' & $sRootDir & $snp[1] & '"', '', '', 0x8) Local $data while ProcessExists($ipid) Sleep(100) wend $data = StdoutRead($ipid) Sleep(100) ;dont know why it needs to sleep it just dose _HTTP_SendHtml($hSocket, $data) Else _HTTP_Send404($hSocket) EndIf EndFunc Func _exit() _log("Server Closed") EndFunc
    1 point
  30. Hi, Welcome to the autoit forum Without inspecting your code - have you tried with the WinHTTP UDF? Br, FireFox.
    1 point
  31. UEZ

    Custom Slider Help

    Indeed I mixed up the topics. Nice examples rover! I searched for Yashied's code but didn't find it and decided to hack something with built-in graphic creator using GDI+. ;coded by UEZ build 2013-09-03 beta #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0 #AutoIt3Wrapper_UseUpx=y #AutoIt3Wrapper_UPX_Parameters=--best --lzma #include <SliderConstants.au3> ;~ #include <WindowsConstants.au3>;~~~ #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GDIPlus.au3> Opt("GUIOnEventMode", 1) Opt("MouseCoordMode", 0) Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 _GDIPlus_Startup() Global $hGUI = GUICreate("New Slider beta by UEZ 2012-2013", 580, 280) Global $iW = 300, $iH = 16 Global $aSlider1 = GUICtrlCreateHSlider(100, 50, $iW, $iH, 0xFF4080F0) Global $idLabel = GUICtrlCreateLabel("Volume", 10, 46, 70, 30) GUICtrlSetFont(-1, 16) Global $idInput1 = GUICtrlCreateInput($aSlider1[7], 420, 46, 42, 24, BitOR($ES_CENTER, $ES_READONLY)) GUICtrlSetFont(-1, 12) Global $iSliderPos = 50 Global $aSlider2 = GUICtrlCreateHSlider(120, 100, $iW + 30, 30, 0xFF205020, @ScriptDir & "\button_smiley.png", "", $iSliderPos) Global $idInput2 = GUICtrlCreateInput($aSlider2[7], 10, 100, 42, 24) GUICtrlSetFont(-1, 12) Global $iSlider = GUICtrlCreateSlider(6, 150, $iW + 156, 45, BitOR($GUI_SS_DEFAULT_SLIDER, $TBS_NOTHUMB, $TBS_NOTHUMB)) GUICtrlSetLimit(-1, 200, 0) GUICtrlSetState(-1, $GUI_DISABLE) Global $idButton = GUICtrlCreateButton("OK", 56, 99, 40, 26) Global $aSlider3 = GUICtrlCreateHSlider(20, 180, $iW + 130, 50, 0, @ScriptDir & "\star.png", @ScriptDir & "\Texture.jpg", $iSliderPos) Global $aSlider4 = GUICtrlCreateVSlider(520, 20, 24, 240, 0xFF505050) ;~ Global $aSlider4 = GUICtrlCreateVSlider(520, 20, 24, 240, 0, "", @ScriptDir & "\TextureRotated.jpg") GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUICtrlSetOnEvent($aSlider1[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider2[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider3[0], "CheckSliderMove") GUICtrlSetOnEvent($aSlider4[0], "CheckSliderMove") GUICtrlSetOnEvent($idButton, "UpdateSlider") Do Until Not Sleep(3000) Func UpdateSlider() SetSliderPosHMan($aSlider2, GUICtrlRead($idInput2)) EndFunc ;==>UpdateSlider Func _Exit() _GDIPlus_Shutdown() Exit EndFunc ;==>_Exit Func CheckSliderMove() Local $aRes = GUIGetCursorInfo($hGUI), $aPosW, $aPosH Switch $aRes[4] Case $aSlider1[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider1, $aRes[0]) GUICtrlSetData($idInput1, $aSlider1[7]) $aPosW = WinGetPos($hGUI) ToolTip("Value: " & $aSlider1[7], $aPosW[0] + $aRes[0], $aPosW[1] + $aRes[1] + 50) WEnd ToolTip("") Case $aSlider2[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider2, $aRes[0]) GUICtrlSetData($idInput2, $aSlider2[7]) WEnd Case $aSlider3[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosH($aSlider3, $aRes[0]) $aPosW = WinGetPos($hGUI) ToolTip("Value: " & $aSlider3[7], $aPosW[0] + $aRes[0], $aPosW[1] + $aRes[1] + 50) WEnd ToolTip("") Case $aSlider4[0] While $aRes[2] * Sleep(20) $aRes = GUIGetCursorInfo($hGUI) SetSliderPosV($aSlider4, $aRes[1]) $aPosH = WinGetPos($hGUI) ToolTip("Value: " & $aSlider4[7], $aPosH[0] + $aRes[0], $aPosH[1] + $aRes[1] + 50) WEnd ToolTip("") EndSwitch EndFunc ;==>CheckSliderMove Func SetSliderPosHMan(ByRef $aSlider, $iPos) Local $aPos, $aPosW $iNewPos = 1 + Int($aSlider[1] + $iPos * $aSlider[5] + $aSlider[3]) GUICtrlSetPos($aSlider[0], Max($aSlider[1], Min($iNewPos - $aSlider[3], $aSlider[4])), $aSlider[2]) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosW = WinGetPos($hGUI) $aSlider[7] = $iPos ;Int(($aPos[0] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosHMan Func SetSliderPosH(ByRef $aSlider, $iPos) Local $aPos, $aPosW GUICtrlSetPos($aSlider[0], Max($aSlider[1], Min($iPos - $aSlider[3], $aSlider[4])), $aSlider[2]) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosW = WinGetPos($hGUI) $aSlider[7] = Int(($aPos[0] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosH Func SetSliderPosV(ByRef $aSlider, $iPos) Local $aPos, $aPosH GUICtrlSetPos($aSlider[0], $aSlider[2], Max($aSlider[1], Min($iPos - $aSlider[3], $aSlider[4]))) $aPos = ControlGetPos($hGUI, "", $aSlider[0]) $aPosH = WinGetPos($hGUI) $aSlider[7] = Int(($aPos[1] + $aSlider[3] - $aSlider[6]) / $aSlider[5]) EndFunc ;==>SetSliderPosV Func GUICtrlCreateHSlider($iX, $iY, $iW, $iH, $iColor, $sFileThumb = "", $sFileBg = "", $iValThumb = 0, $iColorThumb = 0xD0A00000, $iColorThumb_Center = 0xFFFFA0A0, $iValMin = 0, $iValMax = 100, $fSize = 0.025, $fScale = 1.5) Local $hHBitmap_Thumb, $hHBitmap_Bg Local $idPic_Bg = GUICtrlCreatePic("", $iX, $iY, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) If $sFileBg <> "" And FileExists($sFileBg) Then $hHBitmap_Bg = _GDIPlus_CreateHBitmapFromFile($sFileBg, $iW, $iH) Else $hHBitmap_Bg = _GDIPlus_CreateRoundRectImage($iW, $iH, $iColor, $fSize) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Bg, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Bg)) _WinAPI_DeleteObject($hHBitmap_Bg) Local $iH_Thumb = $iH * $fScale Local $fRatio = $iW / Abs($iValMax - $iValMin) Local $idPic_Thumb = GUICtrlCreatePic("", $iX - $iH_Thumb / 2 + $iValThumb * $fRatio, $iY - ($iH_Thumb - $iH) / 2, $iH_Thumb, $iH_Thumb) If $sFileThumb <> "" And FileExists($sFileThumb) Then $hHBitmap_Thumb = _GDIPlus_CreateHBitmapFromFile($sFileThumb, $iH_Thumb, $iH_Thumb) Else $hHBitmap_Thumb = _GDIPlus_CreateEllipseThumb($iH_Thumb, $iColorThumb, $iColorThumb_Center) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Thumb, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Thumb)) _WinAPI_DeleteObject($hHBitmap_Thumb) Local $aSlider[8] = [ $idPic_Thumb, _ ;0 control id $iX - $iH_Thumb / 2, _ ;1 min x position thumb $iY - ($iH_Thumb - $iH) / 2, _ ;2 center position thumb height $iH_Thumb / 2, _ ;3 center thumb height $iX + $iW - $iH_Thumb / 2, _ ;4 end x position $fRatio, _ ;5 ratio $iX, _ ;6 start x position $iValThumb] ;7 thumb size ratio Return $aSlider EndFunc ;==>GUICtrlCreateHSlider Func GUICtrlCreateVSlider($iX, $iY, $iW, $iH, $iColor, $sFileThumb = "", $sFileBg = "", $iValThumb = 0, $iColorThumb = 0xD0005000, $iColorThumb_Center = 0xFF80E080, $iValMin = 0, $iValMax = 100, $fSize = 0.025, $fScale = 1.5) Local $hHBitmap_Thumb, $hHBitmap_Bg Local $idPic_Bg = GUICtrlCreatePic("", $iX, $iY, $iW, $iH) GUICtrlSetState(-1, $GUI_DISABLE) If $sFileBg <> "" And FileExists($sFileBg) Then $hHBitmap_Bg = _GDIPlus_CreateHBitmapFromFile($sFileBg, $iW, $iH) Else $hHBitmap_Bg = _GDIPlus_CreateRoundRectImage($iH, $iW, $iColor, $fSize, True, True) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Bg, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Bg)) _WinAPI_DeleteObject($hHBitmap_Bg) Local $iW_Thumb = $iW * $fScale Local $fRatio = $iH / Abs($iValMax - $iValMin) Local $idPic_Thumb = GUICtrlCreatePic("", $iX + ($iW - $iW_Thumb) / 2 + $iValThumb * $fRatio, $iY - ($iW_Thumb - $iH) / 2, $iW_Thumb, $iW_Thumb) If $sFileThumb <> "" And FileExists($sFileThumb) Then $hHBitmap_Thumb = _GDIPlus_CreateHBitmapFromFile($sFileThumb, $iW_Thumb, $iW_Thumb) Else $hHBitmap_Thumb = _GDIPlus_CreateEllipseThumb($iW_Thumb, $iColorThumb, $iColorThumb_Center) EndIf _WinAPI_DeleteObject(GUICtrlSendMsg($idPic_Thumb, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap_Thumb)) _WinAPI_DeleteObject($hHBitmap_Thumb) Local $aSlider[8] = [ $idPic_Thumb, _ ;0 control id $iY - $iW_Thumb / 2, _ ;1 min y position thumb $iX - ($iW_Thumb - $iW) / 2, _ ;2 center position thumb width $iW_Thumb / 2, _ ;3 center thumb height $iY + $iH - $iW_Thumb / 2, _ ;4 end Y position $fRatio, _ ;5 ratio $iY, _ ;6 start Y position $iValThumb] ;7 thumb size ratio Return $aSlider EndFunc ;==>GUICtrlCreateVSlider Func _GDIPlus_CreateRoundRectImage($iW, $iH, $iColor = 0xFF4080F0, $fSize = 0.025, $hHBitmap = True, $iRotate = 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath_Bg = $aResult[2] $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath_Fg = $aResult[2] $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) Local $iColor_Bg = 0xFF000000 + 0x10000 * Max(BitShift(BitAND($iColor, 0x00FF0000) / 3, 16), 0x10) + 0x100 * Max(BitShift(BitAND($iColor, 0x0000FF00) / 3, 8), 0x10) + Max(BitAND($iColor, 0x000000FF / 3), 0x10) Local $hBrush = _GDIPlus_BrushCreateSolid($iColor_Bg) Local $dW = Int($iW * $fSize) DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Bg, "float", 0, "float", 0, "float", $dW, "float", $iH, "float", 90, "float", 180) ;left arc DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Bg, "float", $iW - $dW - 1, "float", 0, "float", $dW, "float", $iH, "float", -90, "float", 180) ;right arc DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath_Bg) DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush, "handle", $hPath_Bg) $iH *= 0.89 Local $iColor2 = 0xFF000000 + 0x10000 * Min(BitShift(BitAND($iColor, 0x00FF0000), 16) * 3, 0xFF) + 0x100 * Min(BitShift(BitAND($iColor, 0x0000FF00), 8) * 3, 0xFF) + Min(BitAND($iColor, 0x000000FF) * 3, 0xFF) Local $tRectF = _GDIPlus_RectFCreate(0, 0, $iW, $iH) $aResult = DllCall($ghGDIPDll, "int", "GdipCreateLineBrushFromRect", "ptr", DllStructGetPtr($tRectF), "int", $iColor2, "int", $iColor, "int", 1, "int", 0, "int*", 0) Local $hBrush_Gradient = $aResult[6] DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Fg, "float", 1, "float", 0, "float", $dW * 0.8, "float", $iH, "float", 90, "float", 180) DllCall($ghGDIPDll, "int", "GdipAddPathArc", "handle", $hPath_Fg, "float", $iW - $dW - $dW / 5, "float", 0, "float", $dW * 0.8, "float", $iH, "float", -90, "float", 180) DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath_Fg) $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush_Gradient, "handle", $hPath_Fg) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath_Bg) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath_Fg) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrush) _GDIPlus_BrushDispose($hBrush_Gradient) Switch $iRotate Case 1 DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 1) Case 2 DllCall($ghGDIPDll, "uint", "GdipImageRotateFlip", "handle", $hBitmap, "int", 3) EndSwitch If $hHBitmap Then Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateRoundRectImage Func _GDIPlus_CreateEllipseThumb($iSize, $iColor = 0xD0A00000, $iColor_Center = 0xFFFFA0A0, $hHBitmap = True, $sFile = "") Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", 0, "int*", 0) Local $hPath = $aResult[2] DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", 0, "float", 0, "float", $iSize, "float", $iSize) $aResult = DllCall($ghGDIPDll, "int", "GdipCreatePathGradientFromPath", "handle", $hPath, "int*", 0) Local $hBrush_Gradient = $aResult[2] Local $fCenter = $iSize / 2 Local $tPointF = DllStructCreate("float;float") DllStructSetData($tPointF, 1, $fCenter * 0.6) DllStructSetData($tPointF, 2, $fCenter * 0.4) $aResult = DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterPoint", "handle", $hBrush_Gradient, "ptr", DllStructGetPtr($tPointF)) $tARGB = DllStructCreate("int") DllStructSetData($tARGB, 1, $iColor, 1) DllCall($ghGDIPDll, "int", "GdipSetPathGradientSurroundColorsWithCount", "handle", $hBrush_Gradient, "int", DllStructGetPtr($tARGB), "int*", 1) DllCall($ghGDIPDll, "int", "GdipSetLineGammaCorrection", "handle", $hBrush_Gradient, "int", True) DllCall($ghGDIPDll, "int", "GdipSetPathGradientCenterColor", "handle", $hBrush_Gradient, "int", $iColor_Center) $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iSize, "int", $iSize, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) _GDIPlus_GraphicsSetSmoothingMode($hCtxt, 2) DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hCtxt, "handle", $hBrush_Gradient, "handle", $hPath) DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath) DllCall($ghGDIPDll, "int", "GdipDeletePath", "handle", $hPath) Local $hPen = _GDIPlus_PenCreate(0xD0080808) _GDIPlus_GraphicsDrawEllipse($hCtxt, 0, 0, $iSize - 1, $iSize - 1, $hPen) _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hCtxt) _GDIPlus_BrushDispose($hBrush_Gradient) If $hHBitmap Then Local $hHBmp = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndIf Return $hBitmap EndFunc ;==>_GDIPlus_CreateEllipseThumb Func _GDIPlus_CreateHBitmapFromFile($sFile, $iW, $iH) Local $hBmp = _GDIPlus_BitmapCreateFromFile($sFile) Local $aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "int", "GdipSetInterpolationMode", "handle", $hCtxt, "int", 7) _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBmp, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_GraphicsDispose($hCtxt) Local $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndFunc ;==>_GDIPlus_CreateHBitmapFromFile Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported) Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0 $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($aRet[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;') DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'bV5Width', $aRet[2]) DllStructSetData($tBIHDR, 'bV5Height', $aRet[3]) DllStructSetData($tBIHDR, 'bV5Planes', 1) DllStructSetData($tBIHDR, 'bV5BitCount', 32) DllStructSetData($tBIHDR, 'bV5Compression', 3) ; $BI_BITFIELDS = 3 DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride')) DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000) DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2 DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) Return $hResult EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap Func Min($a, $b) If $a < $b Then Return $a Return $b EndFunc ;==>Min Func Max($a, $b) If $a > $b Then Return $a Return $b EndFunc ;==>Max It is beta and probably buggy! All needed files in the attachment -> New Slider.7z (73 download previously) Br, UEZ
    1 point
  32. I find this question almost insulting, but I can't quite put my finger on why. You come to the main Autoit forum and ask it's users to tell you why you should do something, like you want us to convince you or something. I would take less offense if you asked "What's some of the benefits of the Autoit code?" or "What is Autoit optimized for?" or "What do you use Autoit to do vs other languages?" Each of those questions permits a discussion and could turn into an interesting topic. When I read this threads title I had to do a double take... After reading your OP I see you have valid questions, but it just totally comes off wrong for me. I personally use Autoit because it has a lot of functions that do a lot of things very easily. I found Autoit while looking for a way to automate mouse clicks, and this language has very simple and user friendly MouseClick function. More digging and I found tons of very straightforward functions of equal merit.
    1 point
×
×
  • Create New...