Leaderboard
Popular Content
Showing content with the highest reputation on 02/14/2014 in all areas
-
Predict Text UDF Working It sub classes the edit control and matches the current word through the Database & sets selection in accordance. Functions Predicts Text from an User-Defined Database. Sets the Predicted Text when Enter is pressed. * Pressing Backspace deletes the current selection. Support Editing, Overwriting, Updating, Deleting the List. Has the Feature to add New words the user types in the control, to the List. Supports Sensitive and In-Sensitive Prediction. Supports Auto-completion and Auto-Suggestion. Edit and Input controls supported >Support RichEdit Controls. Automatically limit the New Words. Supports Phrase (Post-Space) Prediction Future Updates Support Auto-suggestion. [Coming soon]Done Note That if you set a Password Char for the Edit Box the Prediction will automatically get Unregistered. * Enter is supported Only in Edit Controls. For Input Control the user can use GuiSetAccelerators [Thanks to M23].Check Example 3 ; #CURRENT# ===================================================================================================================== ;_RegisterPrediction ;_UpdatePredictList ;_UnRegisterPrediction ;_RegisterListingSpaceWords ;_RegisterListingNewWords ;_GetSelectedText ;_GetListCount ;_GetCurrentWord ;_GetCaretOffset ; SetSuggestion_Dimensions ; =============================================================================================================================== ; #INTERNAL_USE_ONLY# =========================================================================================================== ;_New_WndProc ; AddToArray ; MakeArray ;_Edit_SubClass ;_AutoExit ;_PredictText ;_GetSpaceText ;_SetSelection ;_CtrlSetStyle ;_CtrlGetStyle ;_RemoveBit ; GetLineHeight ; Suggest_Show ; Suggest_PopuplateItems ; Suggest_SetPos ; =============================================================================================================================== Screen Shots Example 1 - Multiple Edits and Basic Functionality Example 2 - Adding New Words Example 3 - Password Char & Input Controls Example 4 - Supports Post-Space Prediction Example 5 - AutoSuggestion Please Notify for any other Updates and Bugs. ChangeLog V1.0 -First Release V1.1 -Now Supports New Words added by Pressing Enter -Supports Input Controls for Enter Key [Thanks to M23] V1.2 -Now Supports Prediction after Space -New Words are now Automatically Limited V1.3 -Converted to Iterative -Now is more faster V1.4 -Rewritten the UDF with Regular expressions. -Added support for Auto-Suggestion -Bug for incorrect insertion when inbetween typing is now cleared V1.5 -Fixed the bug for which MouseMove wasn't detected. V1.6 -Fixed: Scroll Bar unaccessible. -Fixed: Suggestion doesn't hide when space is typed in non-space text suggestion. V1.7 -Changed: Searching is now done with regular expressions. Lot of speed is increased. PredictText V1.7 v1.7 PredictText(UDF).7z Previous Downloads: 890 Regards Phoenix XL1 point
-
Image Compare [lighting, motion detection]
jaberwacky reacted to nullschritt for a topic
A few days ago I wrote a script to get the relative difference between two sets of data. When this comes to images we can detect all sorts of things, more accurately. Take for example you have two images with different lighting. http://prodynamics.co/link.php?CMD=file&ID=compare1 (1600x976) http://prodynamics.co/link.php?CMD=file&ID=compare2 (1600x976) (These are both jpg images, their format is stored in the database) You will notice that the second image is considerably brighter than the first. Every pixel of the second image is at least one shade brighter than the second, this means that there was an absolute change of 100% to the image, HOWEVER, lets say we only want to know how much light was added to the image, that's one of the things this script can detect. The script would say the image has only changed by 12%, that's because the new data is only 12% different than the old data, even though 100% of it has changed. Now in order to be efficient, the script which converts the images into pixel data are set to skip by default ever 2nd row of pixels and read every other pixel in each row. This still provides pretty accurate results for changes larger than 1px(1px changes may be missed sometimes), and could still accurately display where a change occurred or track a moving object.(with modification to use processed data in said way) In the case you are comparing images which have many 1px changes, you can set the step for both y and x to 1, and the function will compare every single pixel. Be warned though, this is very slow. Large images can use a higher step, but using too high of a step may exclude certain changes from being observed. That being said, if you want to compare large images quickly, without leaving out too much data, there is an alternative, you can size the image down to 1/4th 1/6th or 1/8th it's size and compare it. Scaling down two images keeps the relative data in them the same places, so the comparison will return almost identical results (off by maybe 2% max)Note: In most cases scaling will result in more accurate results than stepping. The below example compares the above two images, and output the data to the console. ;~ #include <_PixelGetColor.au3> #include <GDIPlus.au3> #include <inet.au3> #include <array.au3> $hDll = DllOpen("gdi32.dll") _GDIPlus_Startup() Global $image1, $image2 $f1 = binary(_INetGetSource("http://prodynamics.co/link.php?CMD=file&ID=compare1")) ;image 1 $f2 = binary(_INetGetSource("http://prodynamics.co/link.php?CMD=file&ID=compare2")) ;image 2 brighter ;here we use the default step options $t1 = TimerInit() $image1 = _Capturepixels($f1) ;get image 1 pixel ConsoleWrite(TimerDiff($t1)/1000 &' Default Step'&@CRLF) $t1 = TimerInit() $image2 = _CapturePixels($f2) ;get image 2 pixels ConsoleWrite(TimerDiff($t1)/1000& ' Default Step'&@CRLF) $timer = TimerInit() $compare = _datacompare($image1[0], $image2[0]);compare them ConsoleWrite($compare[0]&'% Different(Localized) '&$compare[1]&'% Different(Global)'&@CRLF&'Took '&(TimerDiff($timer)/1000)&' seconds. Default Step'&@CRLF) ;here we double them, notice the preformance increase $t1 = TimerInit() $image1 = _Capturepixels($f1, 4, 8) ;get image 1 pixels ConsoleWrite(TimerDiff($t1)/1000 &' Double Step'&@CRLF) $t1 = TimerInit() $image2 = _CapturePixels($f2,4 , 8) ;get image 2 pixels ConsoleWrite(TimerDiff($t1)/1000& ' Double Step'&@CRLF) $timer = TimerInit() $compare = _datacompare($image1[0], $image2[0]) ConsoleWrite($compare[0]&'% Different(Localized) '&$compare[1]&'% Different(Global)'&@CRLF&'Took '&(TimerDiff($timer)/1000)&' seconds. Default Step'&@CRLF) sleep(5000) ;~ $t1 = TimerInit() ;~ $diffarray = _mapchange($image1[0], $image2[0], $image1[1], $image1[2]) ;compare two images for difference ;~ ConsoleWrite(TimerDiff($t1)/1000& ' _mapchange'&@CRLF) ;~ $t1 = TimerInit() ;~ $image = _toimage($diffarray) ;here we turn the array of colors back into an image ;~ ConsoleWrite(TimerDiff($t1)/1000& ' _toimage'&@CRLF) ;~ _GDIPlus_ImageSaveToFile($image, @scriptdir&'\test.jpg') ;write it to a file ;~ shellexecute(@scriptdir&'\test.jpg') #cs Function _datacompare($data1, $data2, [$declimal]) -$data1: A string of data, any length. -$data2: A string of data, must be the same length as $data1 -$decimal: 1=Binary 9=Base-10, 15=Base-16, 31=Base-32 Note: If you just want to compare two sets of binary data you probably want to use base-16. Unless you are sure your binary is in 1's and 0's. Returns: An array containing two floats. The first value is the localized change, and the second is the global change #ce func _datacompare($data1, $data2, $decimal=15) Local $difference $data1 = StringSplit($data1, "") $data2 = StringSplit($data2, "") $difference = 0 $found = 0 for $i=1 to $data1[0] if $data1[$i] <> $data2[$i] Then $temp = Abs(_tonum($data1[$i]) - _tonum($data2[$i])) $difference += $temp $found +=1 EndIf Next dim $ret[2] $ret[0] = ((($difference/$found))/$decimal)*100 $ret[1] = ((($difference/$data1[0]))/$decimal)*100 Return $ret EndFunc #cs Function: _mapchange($base, $new, $x, $y, [$decimal]) $base: Base data to compare from $new: Data to compare $x: Width of output data (should be returned by capturepixels) $y: Height of outout data (should be returned by capturepixels) $decimal: Decimal system, you shouldn't change this Note: Use _toimage on data returned by this function to visually see a image of the change. (The lighter the color the more change the occured) Returns an 2D array of data. Each value of the array represents one pixel of the image. Each value is a percent between 0-100 representing the change that occured in that pixel #ce func _mapchange($base, $new, $y, $x, $decimal = 10) Local $difference, $xx = 0, $yy = 0 dim $result[1][$x+1] $t1 = TimerInit() $data1 = _StringequalSplit($base, 8) $data2 = _StringequalSplit($new, 8) $difference = 0 for $i=1 to UBound($data1)-1 if $xx > $x Then $xx=0 $yy+=1 ConsoleWrite($yy&'/'&$y&' ('&($yy/$y)*100&') '&@CRLF) redim $result[$yy+1][$x+1] EndIf if $data1[$i] <> $data2[$i] Then $values1 = StringSplit($data1[$i], "") $values2 = stringSplit($data2[$i], "") $diff = "" for $ix=1 to $values1[0] $diff += round((Abs(_tonum($values1[$ix]) - _tonum($values2[$ix]))/$decimal)*100) Next $diff = Round($diff/$values1[0]) $result[$yy][$xx] = $diff Else $result[$yy][$xx] = 0 EndIf $xx += 1 Next return $result EndFunc #cs Function _tonum($info) -$info: A single digit or carachter. Returns: A 0-based value. #ce func _tonum($info) if $info+0 > 0 Then Return $info $info = StringLower($info) $return = asc($info)-87 switch $return Case -39 Return 0 Case Else Return $return EndSwitch EndFunc #cs Function _CapturePixels($data, [[$stepy], $stepx]) -$data: Binary Data -$stepy: How often to skip a row of pixelxs. 1 = Never -$stepx: How often to skip a single pixel. 1 = Nevere Note: Use higher steps for larger images and lower steps for smaller images. #ce Func _CapturePixels($data, $stepy = 2, $stepx = 2) $ret = "" $HBITMAP2 = _GDIPlus_BitmapCreateFromMemory($data) $y=_GDIPlus_ImageGetWidth($HBITMAP2) $x=_GDIPlus_ImageGetHeight($HBITMAP2) For $iY = 0 To $x step $stepy For $iX = 0 To $y step $stepx $rety = StringRight(hex(_GDIPlus_BitmapGetPixel($hBitmap2, $ix, $iy)),8) ;get current pixel color $ret &= $rety ;~ ConsoleWrite($iy&'/'&$x&' '&$rety&@CRLF) Next Next ;For $x = 0 To _GDIPlus_ImageGetWidth($HBITMAP2) ; For $y = 0 To _GDIPlus_ImageGetHeight($HBITMAP2) ; $ret &= _PixelGetColor_GetPixel($vDC, $x, $y, $hDll) ; Next ;Next _WinAPI_DeleteObject($HBITMAP2) dim $retx[3] $retx[0] = $ret $retx[1] = $x/$stepx $retx[2] = $y/$stepy Return $retx EndFunc ;==>Capturepixels Func _toimage($colors) _GDIPlus_Startup() Local $hBitmap = _GDIPlus_BitmapCreateFromScan0(UBound($colors, 2), UBound($colors, 1)) ;create an empty bitmap Local $hBmpCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) ;get the graphics context of the bitmap _GDIPlus_GraphicsSetSmoothingMode($hBmpCtxt, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsClear($hBmpCtxt, 0x00000000) ;clear bitmap with color white for $i=0 to UBound($colors)-1 for $i2=0 to UBound($colors,2 )-1 ;~ if $colors[$i][$i2] > 30 Then ;~ ConsoleWrite($i&","&$i2&' - '&$colors[$i][$i2]&@CRLF) _GDIPlus_BitmapSetPixel($hBitmap, $i2, $i, $colors[$i][$i2]&'0') ;~ ConsoleWrite($i2&','&$i&' '&$colors[$i][$i2]&@CRLF) ;~ EndIf Next Next return $hBitmap ;return bitmap ;cleanup GDI+ resources _GDIPlus_GraphicsDispose($hBmpCtxt) EndFunc ;==>Example Func _StringEqualSplit($sString, $iNumChars) If (Not IsString($sString)) Or $sString = "" Then Return SetError(1, 0, 0) If (Not IsInt($iNumChars)) Or $iNumChars < 1 Then Return SetError(2, 0, 0) Return StringRegExp($sString, "(?s).{1," & $iNumChars & "}", 3) EndFunc Cheers,NullSchritt PS: If I find the time, I'll add a motion tracking version of the script as well. (It can detect but not track motion in it's current form)1 point -
Hey Every 1 When I was a Beginner I always had a Hard Time to Understand the SQLite I have made a UDF for SQLite so that Beginners Would Also Be Able to Do the Stuff . Much Of Description is Given in the UDF. To Understand Read It. For Advanced Users it may not be sooo goood But Then Also Have a Look . Thumbs Up if it Helped.. The UDF is Attached for Download.. N herez the Index #region -Functions For User- ;_Insert ;_Update ;_Delete ;_FetchData ;_LoadDatabase ;_UnLoadDatabase ;_Cryptor #endregion -Functions For User- #region -Internal Functions- ;_DefaultAnalyser() #endregion -Internal Functions- 1 more Request If You Use the Script Please Reply me of any Bugs or any Further Modifications for Betterment... The UDF v0.3 Database.7z [Previous Downloads : 388] Regards Phoenix XL1 point
-
With the new Answered graphic, I find it difficult to scan down content, particularly search results. Having the graphic to the end of the topic seems to solve the problem. Anyone agree?1 point
-
alternative, using WMI: code adapted from: http://artisgeek.com/weblog/scripts/-getdevices-autoit/ #include <Array.au3> $aDeviceList=_getDevices('Silicon Labs CP210x USB to UART Bridge',1) _ArrayDisplay($aDeviceList) ;Function Name: Get (Connected) Devices ;Written By: Amin Babaeipanah ;Usage: _getDevices(1,'') ;_getDevices("search for", flag) ;"search for": can be set to empty to list everything ;flag: ; 1 = List Device Name(s) ; 2 = List Device ID(s) ; 3 = List Device Name(s) @ Device ID(s) ;Example 1: ; Code below will list all the connected devices by name ; _getDevices('',1) ; Code below will list all the connected devices by ID ; _getDevices('',2) ; Code below will list all the connected devices by name that has the word "COM" ; _getDevices('COM',1) ; adaptation: replace ConsoleWrite with array return ; adaptation by: orbs ; original source at: http://artisgeek.com/weblog/scripts/-getdevices-autoit/ Func _getDevices($name,$type) Dim $aDeviceList[1]=[0] Local $objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2') Local $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PnPEntity WHERE Name LIKE '%"&$name&"%'", "WQL", 48) If IsObj($colItems) Then If $type = 1 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.Name ;ConsoleWrite($objItem.Name&@LF) Next ElseIf $type = 2 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.PNPDeviceID ;ConsoleWrite($objItem.PNPDeviceID&@LF) Next ElseIf $type = 3 Then For $objItem In $colItems $aDeviceList[0]+=1 ReDim $aDeviceList[$aDeviceList[0]+1] $aDeviceList[$aDeviceList[0]]=$objItem.Name&'@'&$objItem.PNPDeviceID ;ConsoleWrite($objItem.Name&'@'&$objItem.PNPDeviceID&@LF) Next EndIf EndIf Return $aDeviceList EndFunc the function returns an array of all devices by criteria (name or type). calling he function with your device name will return (hopefully) only one result, then use string manipulation - like _StringBetween() - to parse the port.1 point
-
The friend @joelson0007 passed me a code that does what I need, thanks to all those who helped. #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <GuiImageList.au3> #include <GuiButton.au3> Example() Func Example() Local $msg GUICreate("My GUI") ; will create a dialog box that when displayed is centered $b = GUICtrlCreateButton("my picture button", 10, 20, 40, 40, $BS_ICON) GUISetState() MsgBox(4096, "", "o controle tem um image?" & @CRLF & CtrlHasPic($b)) Sleep(500) GUICtrlSetImage($b, "shell32.dll", 22) MsgBox(4096, "", "o controle tem um image?" & @CRLF & CtrlHasPic($b)) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd EndFunc ;==>Example ;função para checar se o controle tem imagem Func CtrlHasPic($h) Return IsPtr(_GUICtrlButton_GetImage($h)) EndFunc ;==>CtrlHasPic1 point
-
File uploaded size 0
michaelslamet reacted to MRXTO09 for a topic
they have access to ftp because the file was created on ftp server but the size of the file is 0 they have a windows 7/8 32 or 64 bit i have the 64 and work, they have internet connection1 point -
AdamgJohnson, Welcome to the AutoIt forum. This is the easiest way to do that: $sString = "F042EFCA" $sReversed = StringRegExpReplace($sString, "(.{2})(.{2})(.{2})(.{2})", "$4$3$2$1") MsgBox(0, "Reversed (sort of)", $sReversed) Basically we divide the string into 2 character bits and then recombine them in reverse order. M231 point
-
Image Compare [lighting, motion detection]
jaberwacky reacted to nullschritt for a topic
UPDATE _Datacompare() now returns an array with two values, the first value is localized change, which only accounts for pixels that have actually changed, and measures how much they have changed. Global calculates in all pixels in the photo, even ones that haven't changed. As such, to put them simply. Global calculates the difference that occurred overall in the whole photo, localized calculated how much has changed in the areas that have changed.Note: These two values are relevant to detecting the difference between ambient light shifts, and on screen motion. (though a simple script that monitors the local changes should be enough for simple motion detection, anything above 25% local change should indicate motion rather than lighting change). If you have any recommendations or suggestions, please throw them my way. Edit: Tonight/Tomorrow I will be modifying the local analysis algorithm, in order to exclude most lighting updates. This way local results will only return moving objects or VERY bright lights. Global percentage will include all data, including local data. This does not affect motion tracking in any way. Motion tracking returns the raw percentage of change for each pixel, it is up to you to decide how to process that data/determine lighting/motion.1 point -
Yes. not important though. Me too, roll on nom nom1 point
-
Yes, you are right czardas. I forgot to mention it. Br, UEZ1 point
-
Getting Local machine IP address
jaberwacky reacted to ZebulonSmith for a topic
This is an old thread, but it's also one of the first Google results when searching for "autoit get IP," so I thought I'd chime in. _GetIP() will return the external WAN IP address of a device. For the local IP, follow Manish's advice.1 point -
IE download save/open dialog. How to access?
JohnGetzke reacted to DW1 for a topic
It's not pretty, in fact, I think it's downright ugly, but it works in IE10 (likely 9 as well). Here is to hoping somebody swoops in and proposes a better solution. AdlibRegister("AutoCancel") While 1 Sleep(10) WEnd Func AutoCancel() If WinActive("[Class:IEFrame]") Then Local $hIE = WinGetHandle("[Class:IEFrame]") Local $hCtrl = ControlGetHandle($hIE, "", "[ClassNN:DirectUIHWND1]") Local $aPos = ControlGetPos($hIE, "", $hCtrl) Local $aWinPos = WinGetPos($hIE) If ControlCommand($hIE, "", $hCtrl, "IsVisible") And $aPos[1] > .75 * $aWinPos[3] Then ; Check if the control is in the bottom 25% of the page. ControlClick($hIE, "", $hCtrl, "primary", 1, $aPos[2] - 70, $aPos[3] - 30) Sleep(500) ControlSend($hIE, "", $hCtrl, "{enter}") EndIf EndIf EndFunc ;==>AutoCancel1 point -
rename computer description to logged on user
coffeeturtle reacted to JRSmile for a topic
I created ths because: "net config server /srvcomment: %USERNAME%" does not work if started as system user. so now the computer description gets updated with the username that last started explorer.exe which is most of the time the last logged on user. it is fired by wmi events and reduces its memory requirements itself after every call, so it can be started with system credentials watching users logging on and then writing them behind the hostname in the network environment. i didn't wanted to use ProcessWait because: "The process is polled approximately every 250 milliseconds." using events is nicer i thought. this works even if the user is not an administrator on the maschine. best regards, J. #NoTrayIcon #include <security.au3> ; Get OWNER from SID. #include <process.au3> ;~ #include <admin.au3> ; needed for me excluded in release. Global Const $tag_WTS_PROCESS_INFO = _ "DWORD SessionId;" & _ "DWORD ProcessId;" & _ "PTR pProcessName;" & _ "PTR pUserSid" wait_for_process() while True Sleep(1000) WEnd Func SINK_OnObjectReady($objObject, $objAsyncContext) Local $username $temp = _WinAPI_ProcessListOWNER_WTS() $temp[0][0] = "Process" $temp[0][1] = "ProcessId" $temp[0][2] = "SessionId" $temp[0][3] = "ProcessOWNER" For $i = 1 To UBound($temp) - 1 If $temp[$i][0] = "explorer.exe" Then $username = $temp[$i][3] Next If StringLen($username) = 3 Then _RunDOS("net config server /srvcomment:" & $username) EndIf _ReduceMemory() Return True EndFunc Func _WinAPI_ProcessListOWNER_WTS() $ret = DllCall("WTSApi32.dll", "int", "WTSEnumerateProcesses", "int", 0, "int", 0, "int", 1, "ptr*", 0, "int*", 0) Local $array[$ret[5]][4] $mem = DllStructCreate($tag_WTS_PROCESS_INFO, $ret[4]) For $i = 0 To $ret[5] - 1 $mem = DllStructCreate($tag_WTS_PROCESS_INFO, $ret[4] + ($i * 16)) ;if DllStructGetData($mem, "pProcessName") Then $string = DllStructCreate("char[256]", DllStructGetData($mem, "pProcessName")) $array[$i][0] = DllStructGetData($string, 1) ;EndIf $array[$i][1] = DllStructGetData($mem, "ProcessId") $array[$i][2] = DllStructGetData($mem, "SessionId") ;if DllStructGetData($mem, "pUserSid") Then $ret1 = _Security__LookupAccountSid(DllStructGetData($mem, "pUserSid")) If IsArray($ret1) Then $array[$i][3] = $ret1[0] ;EndIf Next DllCall("WTSApi32.dll", "int", "WTSFreeMemory", "int", $ret[4]) Return $array EndFunc ;==>_WinAPI_ProcessListOWNER_WTS Func wait_for_process() $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $MySink = ObjCreate("WbemScripting.SWbemSink") ObjEvent($MySink, "SINK_") $objWMIService.ExecNotificationQueryAsync($MySink, "SELECT * FROM Win32_ProcessStartTrace WHERE ProcessName = 'explorer.exe'") EndFunc ;==>wait_for_process Func _ReduceMemory($i_PID = -1) If $i_PID <> -1 Then Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID) Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0]) DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0]) Else Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1) EndIf Return $ai_Return[0] EndFunc;==> _ReduceMemory()1 point -
Maybe not exactly what you're looking for, but a hell of a lot faster ... function originally posted by trancexx Edit: Looking at the function CryptBinaryToString the output can tweaked to look more like your original one by using different dwFlags (only that there are two spaces right in the middle)... *test*test*, example #4 replaces those manually to mimic your example exactly... and , for me it's even faster than example #3 because parsing that data to the edit controls takes less time. #include <EditConstants.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> Global $sFile, $hFile, $iSize, $sData, $tData, $iRead $sFile = @WindowsDir & '\regedit.exe' $iSize = FileGetSize($sFile) $tData = DllStructCreate('byte[' & $iSize & ']') $hFile = _WinAPI_CreateFile($sFile, 2, 2, 2) _WinAPI_ReadFile($hFile, DllStructGetPtr($tData), $iSize, $iRead) _WinAPI_CloseHandle($hFile) MsgBox(0, '', Hex(DllStructGetData($tData, 1, 1), 2) & Hex(DllStructGetData($tData, 1, 2), 2) & ' (' & Chr(DllStructGetData($tData, 1, 1)) & Chr(DllStructGetData($tData, 1, 2)) & ') - signature for EXE fies.') $sData = '' $timer = TimerInit() For $i = 1 To $iSize $sData &= Hex(DllStructGetData($tData, 1, $i), 2) If Mod($i, 16) = 0 Then $sData &= @CRLF Else $sData &= ' ' EndIf Next $sData = StringTrimRight($sData, 2) GUICreate('1) DllStructGetData()', 422, 526) $Edit = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit, $sData) GUISetState() ConsoleWrite("1) " & TimerDiff($timer) & @CRLF) $timer = TimerInit() $sData = _HexEncode(DllStructGetData($tData, 1)) GUICreate('2) CryptBinaryToString - 0x0000000b', 422, 526) $Edit2 = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit2, $sData) GUISetState() ConsoleWrite("2) " & TimerDiff($timer) & @CRLF) $timer = TimerInit() $sData = _HexEncode(DllStructGetData($tData, 1), 0x00000004) GUICreate('3) CryptBinaryToString - 0x00000004', 422, 526) $Edit3 = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit3, $sData) GUISetState() ConsoleWrite("3) " & TimerDiff($timer) & @CRLF) $timer = TimerInit() $sData = _HexEncode(DllStructGetData($tData, 1), 0x00000004) GUICreate('4) CryptBinaryToString - 0x00000004 + StringReplace()', 422, 526) $Edit4 = GUICtrlCreateEdit('', 10, 10, 402, 506, BitOR($ES_READONLY, $WS_VSCROLL, $WS_HSCROLL)) GUICtrlSetFont(-1, 8.5, 400, 0, 'Courier') GUICtrlSetData($Edit4, StringReplace($sData, " ", " ", 0, 2)) GUISetState() ConsoleWrite("4) " & TimerDiff($timer) & @CRLF) Do Until GUIGetMsg() = -3 Func _HexEncode($bInput, $iFlags = 0x0000000b) ; CryptBinaryToString function (Windows) ; http://msdn.microsoft.com/en-us/library/windows/desktop/aa379887%28v=vs.85%29.aspx Local $tInput = DllStructCreate("byte[" & BinaryLen($bInput) & "]") DllStructSetData($tInput, 1, $bInput) Local $a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword", $iFlags, _ "ptr", 0, _ "dword*", 0) If @error Or Not $a_iCall[0] Then Return SetError(1, 0, "") EndIf Local $iSize = $a_iCall[5] Local $tOut = DllStructCreate("char[" & $iSize & "]") $a_iCall = DllCall("crypt32.dll", "int", "CryptBinaryToString", _ "ptr", DllStructGetPtr($tInput), _ "dword", DllStructGetSize($tInput), _ "dword", $iFlags, _ "ptr", DllStructGetPtr($tOut), _ "dword*", $iSize) If @error Or Not $a_iCall[0] Then Return SetError(2, 0, "") EndIf Return SetError(0, 0, DllStructGetData($tOut, 1)) EndFunc ;==>_HexEncode1 point
-
You are the man! the following worked correctly.. ShellExecute("chrome.exe", "http:\\www.accuweather.com","","") I am still perplexed why my run command did not work!!! Thank you...1 point