Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/24/2014 in all areas

  1. TypeIt

    Function Binding

    Let's assume that there is a function that expects another function as an argument. Func GetSortedListOfVillains (ByRef $hero, Const ByRef $sortingAlgorithmOfEvil) ; That will take a while, so fight with swords while riding on chairs (xkcd.com/303/). Local $villains = [$evilOverlord] ; should be global _ArrayConcatenate ($villains, VisitGhibliHills ($hero)) _ArrayConcatenate ($villains, VisitForestOfInconvenience ($hero)) _ArrayConcatenate ($villains, VisitHillsOfModerateEvil ($hero)) _ArrayConcatenate ($villains, VisitMountDoom ($hero)) $sortingAlgorithmOfEvil ($villains) Return $villains EndFuncOne way to use that: Global $Sort_Arguments ; ... $Sort_Arguments = ["evilsort", $SORT_IGNORECASE] ; Let's assume that you're using a compiler which translates this into valid AutoIt. GetSortedListOfVillains ($theHero, Sort) ; ... Func Sort (ByRef $array) If Not IsArray ($Sort_Arguments) Then Return SetError (...) ; I changed this function yesterday. Use the specified sorting algorithm and silently ignore any other arguments. ; Bonus points for silently changing the meaning of an argument. EndFuncAnother way: GetSortedListOfVillains ($theHero, SpecialEvilSortUsingAUniqueVillainIdList) ; ... Func SpecialEvilSortUsingAUniqueVillainListId (ByRef $array) ; this is the id of the list v Return Sort ("evilsort", 16372, $array) ; That's a magical number, but I can't pass it as an argument. ; And I need to create a separate function for every used combination of id and sorting algorithm. EndFuncThe desired way with the hypothetical function "BindFunction": GetSortedListOfVillains ($theHero, BindFunction (Sort, "evilsort")) ; ... Func Sort (Const ByRef $sortingAlgorithm, ByRef $array) ; sort it ; Time complexity of EvilSort: O((n^2)!) EndFunc(The example code should highlight specific aspects of these approaches. That's the reason for the different signatures of the sort function.) Is something like that possible? Do you think that it would be useful?
    1 point
  2. Jon

    AutoIt v3.3.13.8 Beta

    File Name: AutoIt v3.3.13.8 Beta File Submitter: Jon File Submitted: 22 Jul 2014 File Category: Beta 3.3.13.8 (22nd July, 2014) (Beta) AutoIt: - Fixed: Regression in With .Method(...). - Added: MapRemove() Click here to download this file
    1 point
  3. Jos

    AutoIt v3.3.13.8 Beta

    Maybe a little harsh response? It is an observation brought forward and think it is good that these kind of things are voiced, so it at least can be considered/checked to see if this is a logical consequence of the changes or maybe an issue. Jos
    1 point
  4. Glad we got that mystery solved. Check out the example icons what formats are expected. Jos
    1 point
  5. dkwokgs, When you post code please use Code tags - see here how to do it. Then you get a scrolling box (and syntax colouring for AutoIt code) as you can see above now I have added the tags. M23
    1 point
  6. Look at _CmdLineRaw() in my signature. This is for parsing a commandline string which is what I believe that UDF did.
    1 point
  7. As Jos said it is unlikely to make much difference changing the temp directory but while it is easy to do so you may as well try it: If @COMPILED Then MsgBox(32, 'yo', @AutoItExe) Else EnvSet('USERPROFILE',@SCRIPTDIR) $Aut2Exe = StringMid(@AutoItExe,'\', 0,-1)) &'Aut2Exe\Aut2Exe.exe' RunWait( $Aut2Exe &' /in "'& @SCRIPTFULLPATH &'"') Endif As for tracing the process that is accessing / blocking Aut2Exe's manipulation of the standalone (if any), you could give Sysinternals Filemon.exe a try and execute it before you start the build. Sorry if there are any errors in what I've posted, done on a mobile. Vlad
    1 point
  8. I am not sure why another Temp directory would do anything for you when this isn't working. The issue is around AUT2EXE updating the target file so is isolated to that process. One other remark: the /bin "AutoItSC.bin parameter is not used anymore as the BIN file is now part of AUT2EXE. Try to see what happens when you are not using the Icon from the H: drive at all. Jos
    1 point
  9. Jon

    AutoIt v3.3.13.7 Beta

    File Name: AutoIt v3.3.13.7 Beta File Submitter: Jon File Submitted: 22 Jul 2014 File Category: Beta 3.3.13.7 (22nd July, 2014) (Beta) AutoIt - Changed: Internal rewrite of all array handling. - Changed: Internal rewrite of map object. - Fixed: Map elements being incorrectly auto-created during function calls to IsMap(). - Fixed: Regression with default COM properties. UDFs: - Changed: Reduced duplicate code for finding the maximum and minimum value in an array. - Changed: _ArrayAdd now uses constants to change addition behaviour and datatype forcing - Fixed #2803: _ArrayMinIndex() and _ArrayMaxIndex() failing with 1-dimensional arrays that had 1 element only. Others: - Fixed: Removal of related functions. Click here to download this file
    1 point
  10. Jon

    AutoIt v3.3.13.6 Beta

    File Name: AutoIt v3.3.13.6 Beta File Submitter: Jon File Submitted: 18 Jul 2014 File Category: Beta 3.3.13.6 (18th, 2014) (Beta) AutoIt: - Changed: Tables now called Maps. IsTable() now IsMap() - Changed: All Is... functions and UBound() now using internal ByRef optimization. - Changed: Numerous internal rewrites for Dim, Local, Global, Static. Function param passing. Testing needed! - Added: Test versions for MapAppend(), MapExists(), MapKeys() - dot notation versions still available for now. - Fixed: Regression with Dim $var = [1,2] syntax. UDFs: - Fixed: Undeclared variable in File.au3 due to internal changes. Click here to download this file
    1 point
  11. Wow, really? Y'know, I get a little irritated by the fact some people let "MVP" or moderator status go to their heads and then somehow lose touch with reality. The fact is, the world isn't THAT affected or concerned with you or your ego. (the same as the rest of us)
    1 point
  12. Jon

    AutoIt v3.3.13.5 Beta

    File Name: AutoIt v3.3.13.5 Beta File Submitter: Jon File Submitted: 17 Jul 2014 File Category: Beta 3.3.13.5 (17th July, 2014) (Beta) AutoIt: - Added: (Internal) Built-in functions can now be made that work in a ByRef way. Lots of new possibilities! - Fixed: Regression with using subscript access on a non-array variable hard crashing. - Fixed: Accessing a table within an array, or vice versa caused a hard crash. - Fixed: Static keyword with tables. - Fixed: Assigning objects to table elements. UDFs: - Fixed #2782: Documentation of various constants. Click here to download this file
    1 point
  13. Jon

    AutoIt v3.3.13.4 Beta

    File Name: AutoIt v3.3.13.4 Beta File Submitter: Jon File Submitted: 15 Jul 2014 File Category: Beta AutoIt: - Fixed: Regression with array initialisation in last beta. Click here to download this file
    1 point
  14. UEZ

    DPI Resolution problem

    You can set the control size depending on the DPI. I use this GDI+ function to get the DPI size: Func _GDIPlus_GraphicsGetDPIRatio($iDPIDef = 96) Local $hGfx = _GDIPlus_GraphicsCreateFromHWND(0) If @error Then Return SetError(1, @extended, 0) Local $aResult = DllCall($ghGDIPDll, "int", "GdipGetDpiX", "handle", $hGfx, "float*", 0) If @error Then Return SetError(2, @extended, 0) Local $iDPI = $aResult[2] _GDIPlus_GraphicsDispose($hGfx) Local $aResults[2] = [$iDPIDef / $iDPI, $iDPI / $iDPIDef] Return $aResults EndFunc ;==>_GDIPlus_GraphicsGetDPIRatio According the information you can set the size of your control or the font size. Br, UEZ
    1 point
  15. You'll find that the code below does what you're after. Instead of relying on the fact that your machine/user probably has the expected locale setting (which determines which ANSI codepage to use by default), I forced ANSI 1251 as you can see. Change that according to your needs. $o = FileOpen(@ScriptDir& "\out.txt", 2) ; ANSI, Write and replace $s = "русский язык" ; read from Excel normally... FileWriteline ($o, _UTF16toANSI1251( $s )) FileClose($o) Func _UTF16toANSI1251($sString) Local $aResult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", 1251, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) Local $tText = DllStructCreate("char[" & $aResult[0] & "]") $aResult = DllCall("Kernel32.dll", "int", "WideCharToMultiByte", "uint", 1251, "dword", 0, "wstr", $sString, "int", -1, _ "ptr", DllStructGetPtr($tText), "int", $aResult[0], "ptr", 0, "ptr", 0) Return(DllStructGetData($tText, 1)) EndFunc
    1 point
×
×
  • Create New...