Jump to content

Leaderboard

Popular Content

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

  1. - _____ _____ _ _ - |_ _|___ ___ ___ _ _| __|___ ___|_|___| |_ - | | | -_| -_| | | |__ | _| _| | . | _| - |_| |___|___|_|_|_ |_____|___|_| |_| _|_| - By TarreTarreTarre|___|Build '1.0.0' |_| + F5 = Run script + F6 = Build 'AU3' + F7 = Build 'EXE' + F8 = Options GUI + F10 = Exit TeenyScript All example code and documentation moved to: http://teenyscript.tarre.nu/documentation Official Github repo: http://github.com/tarreislam/teenyscript F.A.Q Q: What is TeenyScript? A: TeenyScript is a Superset of AutoIt which makes it more advanced Q: How does it work? A: TeenyScript code are parsed into native AutoiT code Q: Does it depend on anything else than AutoIt? A: Just one dependency, that is AutoitObject, the best UDF ever created for AutoIt, besides that, only Native AutoIt is used Features "Anonymous" functions Endless scope nesting OOP (powered by AutoitObject) User-friendly integration Powerful macros Namespaces Lists Project support, for easy deployment Userfriendly GUI for userfriendly Tasks for the Userfriendly person And much more To come You decide, I am happy to do requests! Install and Update TeenyScript HOW TO GET STARTED Run TeenyScript.au3 Now this should see something like this in your console Code Press F8 and navigate to the misc tab to install SciTE calltips Run \ Build \ Compile How to run with Sublime Text Here is some examples of TeenyScript code ;Basic List usage $Example_A = Func() ; Create a list Local $myList = { 'Name': 'Tarre' } ; Add \ Change data on $MyList $myList{'Age'} = 25 ; Create MySecondList Local $MySecondList = { "Name" => "John", "Age" => "00" } ; Using variable instead of a string Local $KeyName = "Age" Local $KeyVal = 1337 $MySecondList{$KeyName} = $KeyVal ; You may also pass lists to lists. however this has to be done in this fashion. Local $oList = {'myList': $myList, 'mySecondList' => $MySecondList} ; Return the objects Return $oList EndFunc();call the function on the variable ; Loop through list and print their values $Example_B = Func() Local $MyList = {'A': 'Hello FROM A', 'B': 'Hello FROM B', 'C': 'Hello FROM C'} Local $aNames = ['A', 'B', 'C'] For $i = 0 To UBound($aNames) -1 MsgBox(0,0,$myList{$aNames[$i]}) Next EndFunc #MAIN MsgBox(0,"Example A 1", $Example_A.myList.Name) MsgBox(0,"Example A 2", $Example_A.myList.Age) MsgBox(0,"Example A 3", $Example_A.mySecondList.Name) MsgBox(0,"Example A 4", $Example_A.mySecondList.Age) $Example_B(); Execute examble B Here is a non class nested function calculator example (calculator.ts.au3) $calculator = Func($a, $and, $b) $division = Func($a, $b) if Not $a or Not $b Then Return "Error dividing 0" EndIf Return $a/$b EndFunc Switch $and Case '+' Return $a + $b Case '-' Return $a - $b Case '/' Return $division($a, $b) Case '*' Return $a * $b EndSwitch Return "Unkown attribute "&$and EndFunc #MAIN ConsoleWrite($calculator(25, '*', 25)&@CRLF) ConsoleWrite($calculator(25, '/', 0) & @CRLF) ConsoleWrite($calculator(1, '^', 2) & @CRLF) teeny-script.zip (OLD) TeenyScript beta2.zip (OLD) teeny-script Beta 4.zip (OLD) teeny-script Beta 5.zip (OLD) teeny-script BETA 6.zip (OLD) TeenyScript Beta 7.zip (OLD) teeny-script Beta 8.zip (OLD) TeenyScript-master 1.0.0.zip (OLD) TeenyScript-1.1.0.zip (OLD) TeenyScript-1.2.0.zip (OLD) TeenyScript-2.0.0.zip (OLRD, Release notes) TeenyScript-2.1.3.zip (Newest 2016-09-16, Release notes)
    1 point
  2. Version 1.2

    29,306 downloads

    I wrote an introductory text for new programmers to learn how to code using AutoIt. It follows along with the help file for the most part – but provides additional context and attempts to connect all the information in a cohesive way for someone without any programming experience. I find the help file to be an AMAZING resource and the text I wrote in no way reflects any opinion to the contrary. Rather, it was created from the perspective of someone who struggled early on with the most basic concepts and thought that a hand-holding guide could be useful. I was also inspired by code.org who is trying to encourage people to learn to code. I thought – what better way than to use free tools that you can download at any time with access to an amazing community? If only there was a guide to walk people through it … Full discussion about the file can be found here: https://www.autoitscript.com/forum/topic/174205-introductory-learn-to-program-text-using-au3/
    1 point
  3. MikahS

    AuPad

    Version 1.9.5

    1,238 downloads

    This is a notepad program written entirely in AutoIt. It has all the basics of notepad that you would expect. This is NOT feature complete, yet. I have included the source code for your pleasure, and feel free to give me pointers if you'd like to help out development (This is all done with AutoIt version 3.3.14.0) If you use any code from this, please leave a comment or something linking to this post, thank you. Prev dls from old forum: 783 run the install to put the AuPad.exe and AuPad.ico in the program files directory under AuPad. Also, the install puts the RESH.au3 (all thanks to @Beege) UDFs into your include folder for you. Included in the .zip: Install.exe, Install.au3, AuPad.au3, AuPad.exe, aupad.ico, uninstall.au3, Uninstall.exe, and RESH.au3 Current Features: Version History:
    1 point
  4. open the registry in HKEY_CLASSES_ROOT, under each file extension key (and the "Folder" key) there may be a sub-key titled "ShellNew". if it exists, then inside there specified the application to start. for example, look at the ".accdb" key (don't miss the dot prefix!), you'll find the entry for "Microsoft Access Database" menu entry (the first in your screenshot). learn to work with that. applying it for specific file types may differ. you can try to duplicate and accommodate the registry entry for the "OpenDocument Presentation" menu entry. you may prefer copying the missing registry entries from another machine which has them, or back them up after a re-installation of OpenOffice.
    1 point
  5. Melba23

    StringRegExp by patterns

    Deye, How about this: #include <MsgBoxConstants.au3> Global $wxpr[12] = [11, _ "word", _ "word.ext", _ "word.*", _ "*.ext", _ "*.word*", _ "*word*.*", _ "*.*word", _ "*word*.ext", _ "word*.*", _ "*word%word%word%word.*", _ "word%word%word*.*"] _Match("this word and.ext") Func _Match($sString) For $i = 1 To UBound($wxpr) - 1 ; Convert to SRE pattern (escape PCRE chars and replace "*") $sPattern = StringReplace(StringRegExpReplace($wxpr[$i], "[][$^.{}()+\-]", "\\$0"), "*", ".*?") ; Check translation ConsoleWrite($wxpr[$i] & " - " & $sPattern & @CRLF) ; Try to match If StringRegExp($sString, $sPattern) Then MsgBox($MB_SYSTEMMODAL, "Match", $i & @CRLF & @CRLF & $wxpr[$i]) EndIf Next EndFunc That seems to work for your test string. M23
    1 point
  6. Jos

    Losing Autocomplete

    My only question was whether that is working or not to establish base functionality. So if the answer is yes, then that does mean that the LUA added functionality isn't working. You SciTE Directory does contain the LUA subdirectory with files in it? Please run this script, copy its output into a text file and share that in a post or PM with me so I can see you active properties: Opt("WinSearchChildren", 1) #AutoIt3Wrapper_UseX64=n Global $WM_COPYDATA = 74 ; Get SciTE DirectorHandle $Scite_hwnd = WinGetHandle("DirectorExtension") ; Get My GUI Handle Global $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ;Register COPYDATA message. GUIRegisterMsg($WM_COPYDATA, "MY_WM_COPYDATA") ; SendSciTE_Command($My_Hwnd, $SciTE_hwnd,"askfilename:") SendSciTE_Command($My_Hwnd, $SciTE_hwnd,"enumproperties:local") SendSciTE_Command($My_Hwnd, $SciTE_hwnd,"enumproperties:user") SendSciTE_Command($My_Hwnd, $SciTE_hwnd,"enumproperties:base") ;~ SendSciTE_Command($My_Hwnd, $SciTE_hwnd,"enumproperties:embed") Sleep(500) ; ; Send command to SciTE Func SendSciTE_Command($My_Hwnd, $Scite_hwnd, $sCmd) Local $My_Dec_Hwnd = Dec(StringRight($My_Hwnd, 8)) $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd ConsoleWrite('-->' & $sCmd & @lf ) Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']') DllStructSetData($CmdStruct, 1, $sCmd) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr') DllStructSetData($COPYDATA, 1, 1) DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1) DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct)) DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _ 'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _ 'Ptr', DllStructGetPtr($COPYDATA)) EndFunc ;==>SendSciTE_Command ; Received Data from SciTE Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr',$lparam) $SciTECmdLen = DllStructGetData($COPYDATA, 2) Local $CmdStruct = DllStructCreate('Char['&$SciTECmdLen+1&']',DllStructGetData($COPYDATA, 3)) $SciTECmd = Stringleft(DllStructGetData($CmdStruct, 1),$SciTECmdLen) ConsoleWrite('<--' & $SciTECmd & @lf ) EndFunc ;==>MY_WM_COPYDATA Jos
    1 point
  7. Here enclosed an example of ASM-Code, very simple, shows the difference between the "external" functions and the advantage of "internal" AutoIt function. The reasons of the different execution speed are mentioned above. But, if supposed (no, i am really sure ^^) that the AutoIt internal function is able to use the pointer to the string, the execution time is directly dependent to the compiled (I suppose C(++)-) Code. And shown with the attached script, the simplest ASM-code is 50% faster than the "compiled" one (related to reverse the string, no memory-related stuff!). Which is not a wonder, because EVERY M$-(API)Function is overloaded by jumps and calls to other functions, errormanagement, and so on. If the socalled "Programmer" knows that and is looking for "fast(er) code", M$ provides "intrinsics"-Function which are nothing else than inlined native ASM-opcodes. So you can speedup code 200-300% if only one little piece of code is replaced.... If you have a loop which, for example, calculates trigonometric functions (sin/cos/tan) many many times, replace the C(++)-function sinf by the corresponding "Intrinsic function" and you can half/third the execution time! Not to mention what the programmer could reach with SSE/AVX.... Ultimately all this does no matter if AutoIt is your preferred language. In the most cases AutoIt is fast enough, if you really want to speed up your code, profile it, find the "inner loop" and replace the whole loop with a "compiled" function.... Script, 32bit-code asm, comparison between call of "str" and "str*" #AutoIt3Wrapper_UseX64=n ;#include "assembleit2_64.au3" ;AssembleIt assembler with debugger and much more features at autoit.de #cs _StringReverse2 use32 ;32 bit mov esi,[esp+4] ;address string adress first letter mov ecx,[esp+8] ;number of letters lea edi,[ecx+esi] ;address of last letter sub edi,1 shr ecx,1 ; = /2 only half the letters to xchg _loop: mov bl,[edi] ;save last letter to change mov bh,[esi] ;save first letter to change mov [edi],bh ;change letters mov [esi],bl ;as usual add esi,1 ;adress second letter... sub edi,1 ;adress penultimate letter... sub ecx,1 ;half the string reached? jnz _loop ;no, then loop again ret #ce #cs _StringReverse use32 ;32 bit mov esi,[esp+4] ;address string adress first letter mov esi,[esi] ;strings have pointer to a pointer.... mov ecx,[esp+8] ;number of letters lea edi,[ecx+esi] ;address of last letter sub edi,1 shr ecx,1 ; = /2 only half the letters to xchg _loop: mov bl,[edi] ;save last letter to change mov bh,[esi] ;save first letter to change mov [edi],bh ;change letters mov [esi],bl ;as usual add esi,1 ;adress second letter... sub edi,1 ;adress penultimate letter... sub ecx,1 ;half the string reached? jnz _loop ;no, then loop again ret #ce ;make a 100MB string $string = "ABCD" For $i = 1 To 44 $string = $string & Chr($i + 40) ;String erstellen )*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST Next For $i = 1 To 21 ;pump it up... $string &= $string Next $string &= "ENDE" $stringlen = StringLen($string) ConsoleWrite('$stringlen = ' & $stringlen & " Bytes" & @CRLF & @CRLF) ;### Debug Console Global $filestructptr, $asm_only ;~ $asmcode = _AssembleIt2("retbinary", "_StringReverse") ;erstellt den asmcode ;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $asmcode = ' & $asmcode & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $asmcode = "0x8B7424048B3689F08B4C24088D3C3183EF01D1E98A1F8A3E883F881E83C60183EF0183E90175EDC3" ;by AssembleIt $codestruct = DllStructCreate("byte[" & StringLen($asmcode) / 2 - 1 & "]") ;speicher für asmcode... DllStructSetData($codestruct, 1, $asmcode) ;...mit code füllen ;~ $asmcode2 = _AssembleIt2("retbinary", "_StringReverse2") ;erstellt den asmcode ;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $asmcode2 = ' & $asmcode2 & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $asmcode2 = "0x8B7424048B4C24088D3C3183EF01D1E98A1F8A3E883F881E83C60183EF0183E90175EDC3" ;by AssembleIt Global $codestruct2 = DllStructCreate("byte[" & StringLen($asmcode2) / 2 - 1 & "]") ;speicher für asmcode... DllStructSetData($codestruct2, 1, $asmcode2) ;...mit code füllen ;string into memory, we get a pointer $stringstruct = DllStructCreate("char[" & $stringlen & "]") $stringptr = DllStructGetPtr($stringstruct) DllStructSetData($stringstruct, 1, $string) ;~ $t = TimerInit() ;~ $ret = _AssembleIt2("str", "_StringReverse", "str*", $string, "uint", $stringlen) ;~ $m = TimerDiff($t) ;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : time _StringReverse= ' & $m & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console ;~ $t = TimerInit() ;~ $ret = _AssembleIt2("none", "_StringReverse2", "ptr", $stringptr, "uint", $stringlen) ;~ $m = TimerDiff($t) ;~ ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : time _StringReverse2 = ' & $m & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $t = TimerInit() $string1 = _StringReverse_ASM($string) $stringreverseasm = Int(TimerDiff($t)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stringreverseasm = ' & $stringreverseasm & "ms str* - version copies the string internal" & @CRLF & @CRLF) ;### Debug Console $t = TimerInit() $string2 = _StringReverse_ASM2($string) $stringreverseasm2 = Int(TimerDiff($t)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stringreverseasm2 = ' & $stringreverseasm2 & "ms ptr - version needs read/write of dllstruct" & @CRLF & @CRLF) ;### Debug Console $t = TimerInit() $string3 = StringReverse($string, 1) $stringreverseAutoIt = Int(TimerDiff($t)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $stringreverseAutoIt = ' & $stringreverseAutoIt & "ms native AutoIt (rulez!!!)" & @CRLF & @CRLF) ;### Debug Console ConsoleWrite(StringLeft($string1, 50) & @CRLF & StringLeft($string2, 50) & @CRLF & StringLeft($string3, 50) & @CRLF & @CRLF) Func _StringReverse_ASM($ansistring) ;str* - version $ret = DllCallAddress("str:cdecl", DllStructGetPtr($codestruct), "str*", $ansistring, "uint", StringLen($ansistring)) Return $ret[0] EndFunc ;==>_StringReverse_ASM Func _StringReverse_ASM2($ansistring) ;ptr - version $stringstruct = DllStructCreate("char[" & StringLen($ansistring) & "]") $stringptr = DllStructGetPtr($stringstruct) DllStructSetData($stringstruct, 1, $string) $r = TimerInit() $ret = DllCallAddress("int:cdecl", DllStructGetPtr($codestruct2), "ptr", $stringptr, "uint", StringLen($ansistring)) $asm_only = Int(TimerDiff($r)) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $asm_only = ' & $asm_only & "ms without memory related stuff like read/write of dllstruct" & @CRLF & @CRLF) ;### Debug Console $ret = DllStructGetData($stringstruct, 1) Return $ret EndFunc ;==>_StringReverse_ASM2 Simple example of AssembleIt(), possibility for everyone to improve the asm-code . Feel free to write a really "fast" one, SSE/SIMD is recommended, challenge anyone? 1.9clockticks per reversed char atm... #AutoIt3Wrapper_UseX64=n #include "assembleit2_64.au3" ;AssembleIt assembler with debugger and much more features at autoit.de #cs _StringReverse2 use32 ;32 bit mov esi,[esp+4] ;address string adress first letter mov ecx,[esp+8] ;number of letters lea edi,[ecx+esi] ;address of last letter sub edi,1 shr ecx,1 ; = /2 only half the letters to xchg _loop: mov bl,[edi] ;save last letter to change mov bh,[esi] ;save first letter to change mov [edi],bh ;change letters mov [esi],bl ;as usual add esi,1 ;adress second letter... sub edi,1 ;adress penultimate letter... sub ecx,1 ;half the string reached? jnz _loop ;no, then loop again ret #ce ;make a 100MB string $string = "" For $i = 1 To 21 ;pump it up... $string &= $string & ")*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ" Next $stringlen = StringLen($string);len ConsoleWrite('$stringlen = ' & $stringlen & " Bytes" & @CRLF & @CRLF) ;### Debug Console ;put string into memory, so we can get a pointer $stringstruct = DllStructCreate("char[" & $stringlen & "]") $stringptr = DllStructGetPtr($stringstruct) DllStructSetData($stringstruct, 1, $string) ;string into memory ;lets have a look, how fast the code is (assembling is only 2-3ms) $t = TimerInit() $ret = _AssembleIt2("none", "_StringReverse2", "ptr", $stringptr, "uint", $stringlen) $m = TimerDiff($t) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : time _StringReverse = ' & $m & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console $stringreverse = DllStructGetData($stringstruct, 1) ConsoleWrite("First 50 characters of " & Int($stringlen / 1e6) & "MB string and reversestring" & @CRLF & StringLeft($string, 50) & @CRLF & StringLeft($stringreverse, 50) & @CRLF & @CRLF) AssembleIt2_64.zip
    1 point
  8. np It could be like this: #include "WinHttp.au3" $sDomain = "http://myurl.com/" $sLoginPage = "/wp-login.php" $sUploadPage = "/wp-admin/media-new.php" $sLoginName = "username" $sPassword = "mypassword" ; Choose file to upload $sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)") If $sFileToUpload Then $hOpen = _WinHttpOpen() $hConnect = _WinHttpConnect($hOpen, $sDomain) ; Login first _WinHttpSimpleFormFill($hConnect, _ $sLoginPage, _ "loginform", _ 'user_login', $sLoginName, _ 'user_pass', $sPassword) ConsoleWrite('! Error for login = ' & @error & @LF) _WinHttpSimpleFormFill($hConnect, _ $sUploadPage, _ "file-form", _ 'async-upload', $sFileToUpload) ConsoleWrite('! Error for upload = ' & @error & @LF) _WinHttpCloseHandle($hConnect) _WinHttpCloseHandle($hOpen) EndIf
    1 point
×
×
  • Create New...