Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/05/2014 in all areas

  1. Since I made my specific channel for tutorials, I have now chosen to make the original videos on techwg channel unlisted, upload them on my new channel TutsTeach (channel is 1 year old and active), made a new playlist on the new channel and removed the videos on techwg from the playlist on techwg and put the new videos on TutsTeach on there. So nobody will be without, if people bookmarked the individual videos from techwg or the original playlist, the links will still work. I have also updated the AutoIt wiki page with the new playlist URL on the correct TutsTeach channel. I have created a new video on hotkeys and two videos on automating programs. The first of the two automation videos covers step by step automation of an installer using MouseClick and the second video just covers additional methods of interacting with controls on windows to make sure people have different methods which will fit the particular situation they are scripting around. The official playlist link is
    2 points
  2. This uses the, recently added, ability of AutoIt's to read specific elements of an array, directly from the function return... Ex; $StartMenu_Height = WinGetPos("[CLASS:Shell_TrayWnd]")[3] #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Main() Func Main() ; Create a GUI with various controls. Local $hGUI = GUICreate("PANIC", 110, 55,@DesktopWidth-110,@DesktopHeight-WinGetPos("[CLASS:Shell_TrayWnd]")[3]-55,$WS_POPUP) GUISetBkColor(0xFF0000) $hPANIC_Label = GUICtrlCreateLabel("PANIC", 11, -2, 90, 38) GUICtrlSetFont($hPANIC_Label, 28, 800, 0, "Roman") $hEnabled_Label = GUICtrlCreateLabel("enabled", 18, 32, 74, 22) GUICtrlSetFont($hEnabled_Label, 12, 400, 0, "Courier New") ; Set GUI to AlwaysOnTop WinSetOnTop($hGUI, "", 1) ; Display the GUI. GUISetState(@SW_SHOW, $hGUI) ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($hGUI) EndFunc ;==>Example I'm not sure what that feature is called, exactly, but it very handy. ^.^
    2 points
  3. CodeCrypter enables you to encrypt scripts without placing the key inside the script. This is because this key is extracted from the user environment at runtime by, for example: password user query any macro (e.g., @username) any AutoIt function call any UDF call some permanent environment variable on a specific machine (and not created by your script) a server response a device response anything else you can think of, as long as it's not stored in the script any combination of the above You need several scripts to get this to work, and they are scattered over several threads, so here's a single bundle that contains them all (including a patched version of Ward's AES.au3; with many thanks to Ward for allowing me to include this script here): Latest version: 3.4 (3 Dec 2021): please follow this link. Note: if you experience issues under Win8/8.1 (as some users have reported), please upgrade to Win10 (or use Win7) if you can; as far as I can tell, the scripts in the bundle all work under Win7 & Win10 (and XP). Moreover, I have no access to a Win8 box, so these issues will not be fixed, at least not by yours truly. How the bits and pieces fit together: CodeCrypter is a front-end for the MCF UDF library (you need version 1.3 or later). Its thread is here: '?do=embed' frameborder='0' data-embedContent>> The MCF package (also contained in the CodeScannerCrypter bundle) contains MCF.au3 (the library itself) plus a little include file called MCFinclude.au3. The latter you have to include in any script you wish to encrypt. Any code preceding it will not be encrypted, any code following it will be encrypted. You define the dynamic key inside MCFinclude.au3, in the UDF: _MCFCC_Init(). From the same post you can download an MCF Tutorial which I heartily recommend, because encrypting a script requires a number of steps in the right order, namely: In MCFinclude.au3, define and/or choose your dynamic key(s) (skip this step = use default setting) include MCFinclude.au3 in your target script Run CodeScanner (version 2.3+) on your target script, with setting WriteMetaCode=True (see '?do=embed' frameborder='0' data-embedContent>>), then close CodeScanner. Start CodeCrypter press the Source button to load your target file enable Write MCF0 (tick the first option in Main Settings) Enable "Encrypt" (last option in the Main Settings) Go to the Tab Encrypt and set up the encryption the way you want (skip this = use default settings) Return to Main Tab and press "Run" if all goes well, a new script called MCF0test.au3 is created in the same directory as your target. It has no includes and no redundant parts. Please check that it works as normal. (see Remarks if not) It all sounds far more complicated than it is, really. Not convinced? Check out: a simple HowTo Guide: HowToCodeCrypt.pdf an updated and extended Q & A pdf (FAQ, also included in the bundle) to help you get started:CodeCrypterFAQ.pdf For additional explanations/examples in response to specific questions by forum members (how it works, what it can/cannot do), see elsewhere in this thread, notably: Simple analogy of how it works: post #53, second part General Explanation and HowTo: post #9, 51, 75, 185/187, 196, 207, 270, 280 (this gets a bit repetitive) BackTranslation: post #179 Obfuscation: post #36 (general), 49 (selective obfuscation) Specific features and fixes: post #3 (security), 84 (redefining the expected runtime response), 169 (Curl Enum fix), 185/187 (using license keys), 194 (replacing Ward's AES UDF with different encryption/decryption calls), 251 (AV detection issue), 262 (extract key contents to USB on different target machine prior to encryption) Limitations: post #26 (@error/@extended), 149 (FileInstall), 191 (AES.au3 on x64) Not recommended: post #46/249 (static encryption), 102 (programme logic error), 237 (parsing password via cmdline) Technical notes: BackTranslation is a test to check that the MetaCode translation worked. Skip it at your peril. It also turns your multi-include composite script into a single portable file without redundant parts (you can opt to leave the redundant parts in, if you want). CodeCrypter can also obfuscate (vars and UDF names) and replace strings, variable names and UDF names with anything else you provide, for example, for language translation). After CodeScanner separates your target's structure from its contents, CodeCrypter (actually MCF, under the hood) can change any part, and then generate a new script from whichever pieces you define. See the MCF Tutorial for more explanation and examples. Encryption currently relies on Ward's excellent AES UDF and TheXman's sophisticated CryptoNG bundle. You can replace these with any other algorithm you like (but this is not trivial to do: edit MCFinclude.au3 UDF _MCFCC(), and MCF.au3 UDF _EncryptEntry(), see post #194 in this thread). AES by Ward, and CryptoNG by TheXman are also included in the bundle (with many thanks to Ward and TheXman for graciously allowing me to republish their outstanding work). Going to lie down now... RT
    1 point
  4. DreamVB

    DM ClassicRadio

    hi this is a small Internet radio player I been working on for the past week. it's still not completely finished yet but it is functional it comes with some added channels, you can Play, Stop, Pause Change volume, option to open URLS from the Internet and mute the sound. Note to make this work you need the WMPlayer.ocx. also the stations at the moment need to be edited in notepad, As i have to still yet think of an idea to allow you to add your own. Anyway hope you like it MyRadioPlayer.zip
    1 point
  5. Funny thing happened John, I appear to have become an Everton fan.
    1 point
  6. Awesome, I was able to use this for exactly what I needed. Thanks a million, czardas!
    1 point
  7. In SRE, asterisk has a different meaning, so you can see there are various interpretations - not only used for wildcards. I often forget someone might want case insensitive matches, so here's another version. ; Local $sString = "tHIs IS A senTEnce aBOut A CAt TOy." Local $sQuery = "This is a sentence about a * toy." Local $sPattern = StringRegExpReplace($sQuery, "[\W]", "\\$0") ; Ignore special character meanings $sPattern = "(?i)(" & StringReplace($sPattern, "\*", ".*") & ")" ; Dot in the pattern signifies any characters may appear. If StringRegExp($sString, $sPattern) Then MsgBox(0, "", "Match Found") EndIf ; It's not much different from my previous example.
    1 point
  8. Regular expressions: $string = "blahblahhttps://www.google.com/search?q=boston+art+museums more stuff" $a = StringRegExp($string,"(https[^\s]+)",3) ConsoleWrite($a[0] & @CRLF) $a = StringRegExp($string,"(?U)(https.*)\s",3) ConsoleWrite($a[0] & @CRLF) Your second example needs no wild card...use: StringInStr
    1 point
  9. In some AutoIt functions, asterisk represents any acceptable sequence of characters, but this is certainly not universal. If you want to use asterisk in other circumstances, then you have to create the code to interpret the characters as you prefer. Here's an example, but it's slightly complicated because of the regular expressions: ; Local $sString = "whatever - Internet Explorer" Local $sQuery = "* - Internet Explorer" Local $sPattern = StringRegExpReplace($sQuery, "[\W]", "\\$0") ; Ignore special character meanings $sPattern = "(" & StringReplace($sPattern, "\*", ".*") & ")" ; Dot in the pattern signifies any characters may appear. If StringRegExp($sString, $sPattern) Then MsgBox(0, "", "Match Found") EndIf
    1 point
  10. _EncryptedPIDLEncode2 Since CryptBinaryToString is already implemented by trancexx in this post, we can concentrate about the PIDLs. This is the procedure: Func _EncryptedPIDLEncode2( $sPath ) ; Get PIDL pointer from path Local $pPidl = _WinAPI_ShellILCreateFromPath( $sPath ) ; Get size of PIDL structure as the pointer is pointing to Local $iSize = ILGetSize( $pPidl ) ; Create a byte structure from memory location defined by PIDL pointer Local $tPidl = DllStructCreate( "byte[" & $iSize & "]", $pPidl ) ; Get binary string from byte structure Local $sBinStr = DllStructGetData( $tPidl, 1 ) ; Create Base64 encoded string Local $sEncoded = _Base64Encode( $sBinStr ) Return $sEncoded EndFunc techiebabel, In your PIDL size calculations you are calculating the size of the pointer. Not the size of the PIDL structure as the pointer is pointing to. Full code including functions and test: #include <WinAPIShellEx.au3> $sTestPath = "C:\WINDOWS\Temp\StdPictures" ; Must be an existing folder ConsoleWrite( @CRLF & "Test path: $sTestPath = " & $sTestPath & @CRLF & @CRLF ) $sEncodedPidl = _EncryptedPIDLEncode2( $sTestPath ) ConsoleWrite( "Base64 encoded PIDL: $sEncodedPidl = " & $sEncodedPidl & @CRLF ) $sDecodedPath = _EncryptedPIDLDecode( $sEncodedPidl ) ConsoleWrite( "Base64 decoded path: $sDecodedPath = " & $sDecodedPath & @CRLF & @CRLF ) Func _EncryptedPIDLEncode2( $sPath ) ; Get PIDL pointer from path Local $pPidl = _WinAPI_ShellILCreateFromPath( $sPath ) ; Get size of PIDL structure as the pointer is pointing to Local $iSize = ILGetSize( $pPidl ) ; Create a byte structure from memory location defined by PIDL pointer Local $tPidl = DllStructCreate( "byte[" & $iSize & "]", $pPidl ) ; Get binary string from byte structure Local $sBinStr = DllStructGetData( $tPidl, 1 ) ; Create Base64 encoded string Local $sEncoded = _Base64Encode( $sBinStr ) Return $sEncoded EndFunc Func ILGetSize( $pidl ) Local $aRet = DllCall( "shell32.dll", "uint", "ILGetSize", "ptr", $pidl ) If @error Then Return SetError(1, 0, 0) Return $aRet[0] EndFunc ;By trancexx: http://www.autoitscript.com/forum/index.php?showtopic=81332 Func _Base64Encode($input) $input = Binary($input) Local $struct = DllStructCreate("byte[" & BinaryLen($input) & "]") DllStructSetData($struct, 1, $input) Local $strc = DllStructCreate("int") Local $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", 0, _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(1, 0, "") ; error calculating the length of the buffer needed EndIf Local $a = DllStructCreate("char[" & DllStructGetData($strc, 1) & "]") $a_Call = DllCall("Crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($struct), _ "int", DllStructGetSize($struct), _ "int", 1, _ "ptr", DllStructGetPtr($a), _ "ptr", DllStructGetPtr($strc)) If @error Or Not $a_Call[0] Then Return SetError(2, 0, ""); error encoding EndIf Return DllStructGetData($a, 1) EndFunc ;==>_Base64Encode Func _EncryptedPIDLDecode($sEncryptedPIDL) Local Const $CRYPT_STRING_BASE64 = 0x00000001 ; Determine length of EncryptedPIDL Local $iLength = StringLen($sEncryptedPIDL) ; Create structure to hold the attributes returned and used during decoding Local $tDecodeAttribs = DllStructCreate("int Size; int Skipped;int Flags") If @error Then Return SetError(1,0,'') ; Get pointers to the attributes returned and used during decoding Local $pDecodeSize = DllStructGetPtr($tDecodeAttribs, 'Size') Local $pDecodeSkipped = DllStructGetPtr($tDecodeAttribs, 'Skipped') Local $pDecodeFlags = DllStructGetPtr($tDecodeAttribs, 'Flags') ; Get the values needed for decoding DllCall('Crypt32.dll','int','CryptStringToBinary', _ 'str',$sEncryptedPIDL, _ 'int',$iLength, _ 'int',$CRYPT_STRING_BASE64, _ 'ptr',0, _ 'ptr',$pDecodeSize, _ 'ptr',$pDecodeSkipped, _ 'ptr',$pDecodeFlags) If @error Then Return SetError(2,0,'') ; Create structure to hold the PIDL and path Local $tDecodeResults = DllStructCreate("char PIDL[" & DllStructGetData($tDecodeAttribs, 'Size') + 1 & "]; char Path[261]") If @error Then Return SetError(3,0,'') ; Get pointers to the PIDL and path Local $pDecodePIDL = DllStructGetPtr($tDecodeResults, 'PIDL') Local $pDecodePath = DllStructGetPtr($tDecodeResults, 'Path') ; Get the PIDL DllCall('Crypt32.dll','int','CryptStringToBinary', _ 'str',$sEncryptedPIDL, _ 'int',$iLength, _ 'int',$CRYPT_STRING_BASE64, _ 'ptr',$pDecodePIDL, _ 'ptr',$pDecodeSize, _ 'ptr',$pDecodeSkipped, _ 'ptr',$pDecodeFlags) If @error Then Return SetError(4,0,'') ; Get the Path DllCall('Shell32.dll','int','SHGetPathFromIDList', _ 'ptr',$pDecodePIDL, _ 'ptr',$pDecodePath) If @error Then Return SetError(5,0,'') ; Return the Path Return DllStructGetData($tDecodeResults, 'Path') EndFunc Output in Scite console: Test path: $sTestPath = C:\WINDOWS\Temp\StdPictures Base64 encoded PIDL: $sEncodedPidl = FAAfUOBP0CDqOmkQotgIACswMJ0ZAC9DOlwAAAAAAAAAAAAAAAAAAAAAAAAAPAAx AAAAAAA6Rbw2EABXSU5ET1dTACYAAwAEAO++JTjxY0RFjCkUAAAAVwBJAE4ARABP AFcAUwAAABYANAAxAAAAAABERRowEABUZW1wAAAgAAMABADvviU48WNERRowFAAA AFQAZQBtAHAAAAAUAEYAMQAAAAAAQ0WSqhAAU1REUElDfjEAAC4AAwAEAO++Q0WS qkRFKCMUAAAAUwB0AGQAUABpAGMAdAB1AHIAZQBzAAAAGAAAAA== Base64 decoded path: $sDecodedPath = C:\WINDOWS\Temp\StdPictures
    1 point
×
×
  • Create New...