
kevinlaikf
Members-
Posts
10 -
Joined
-
Last visited
kevinlaikf's Achievements

Seeker (1/7)
0
Reputation
-
how to scan and close a hidden process?
kevinlaikf replied to sandin's topic in AutoIt General Help and Support
I am looking for ways to detect either this maplestory.exe process or its accompanied gameguard process too.. I just need the detection scripts, just to stop all my P2P application while my kids are playing the game without the lag. Scheduled the detection script every hour. Conditions: 1) If the game process or guardian process active, the script would check if my P2P app is running, if so, killing it. 2) And if both Game and P2P application are not active, and the script restart the P2P app. So far, I am unable to detect this Maplestory.exe or the GameGuard. Any tips? -
My script will read a subdirectory for files 200*.DAT, and store into array. Useful data start after 691280 bytes of every files. For each array data, it will extract a series JPEG data streams and 8-bytes of every 34 bytes header before every JPEG header. This first 8 bytes contain numeric value of epoch-seconds (seconds since 01-01-1970 00:00:00) in GMT +0 timezone. This script was developed on a Windows 2000 workstation, and work perfectly fine. But when run on a WinXP, it produced different results (incorrect data extracted, due to wrong value obtained in $jpegstart and $jpegend, $jpegstart keep returning null value). I believe it has to be some unicode issue. But I can't proof it as the system setting was alright. I had checked my Region settings on both PC, they are using 0409, same region settings. Same AutoIt3 compiler version (AutoIt v3.2.12.1), same AutoIt Script Editor (14-8-2008). Anyone know the cause of the erratic results? Thank you. ; ==================== ; My script start here ; ==================== #include <File.au3> #include <string.au3> #include <Date.au3> $gmt = 8 ;GMT Timezone for Singapore +8 $sourcedir = "C:\SCREEN\" $targetdir = "C:\JPEG\" $filelist = _FileListToArray($sourcedir, "200*.DAT", 0) $listcount = 0 For $fc = 1 To $filelist[0] $errfound=0 $listcount += 1 $binfile = $sourcedir & $filelist[$fc] $count=1 $file = FileOpen($binfile, 4) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") EndIf $size = FileGetSize($binfile) $usefuldata=FileRead($file, $size) FileClose ($file) $jpegend=0 While $size <> $jpegend + 1 ; Search for JPEG Stream Header (0xFFD8FF) $jpegstart = StringInStr(BinaryToString($usefuldata),BinaryToString("0xFFD8FF"),1,$count,691280) if @Error = 1 Then MsgBox (0,"Status","EOF Reached",2) ExitLoop endif ; Search for JPEG Stream End of File (0xFFD9) $jpegend = StringInStr(BinaryToString($usefuldata),BinaryToString("0xFFD9"),1,$count,691280) ;MsgBox(0,"Debug", "$count: "& $count &" [ $jpegstart : " & $jpegstart & "] [ $jpegend : " & $jpegend & " ] " & $size,3) if $jpegend = 0 Then MsgBox (0,"Status","EOF Reached",2) ExitLoop endif ;Every file creation date in epoch second data stored first 8 of the 34 bytes offset before the JPEG header 0xFFD8FF $epochraw = BinaryMid ( BinaryToString($usefuldata),$jpegstart-34,8) $hex1 = StringMid($epochraw, 3, 2) $hex2 = StringMid($epochraw, 5, 2) $hex3 = StringMid($epochraw, 7, 2) $hex4 = StringMid($epochraw, 9, 2) $epochhex = "0x" & $hex4 & $hex3 & $hex2 & $hex1 $epochsec = Number($epochhex) $creationdate = _DateAdd("s", $epochsec, "1970/01/01 00:00:00") $creationdate2 = _DateAdd("h", $gmt, $creationdate) ;MsgBox(0,"Debug", "[ $jpegstart : " & $jpegstart & "] [ $jpegend : " & $jpegend & " ]" & @CRLF & "$epochraw : " & $epochraw & @CRLF & "[ $epochhex = " & $epochhex & " ] " & " [ $epochsec = "& $epochsec & " ]",3) $fyear = StringMid($creationdate2, 1, 4) $fmonth = StringMid($creationdate2, 6, 2) $fday = StringMid($creationdate2, 9, 2) $fhour = StringMid($creationdate2, 12, 2) $fmin = StringMid($creationdate2, 15, 2) $fsec = StringMid($creationdate2, 18, 2) $newdir = $targetdir & $fyear & $fmonth & $fday If Not FileExists($newdir) Then DirCreate($newdir) EndIf $filename = $newdir & "\" & $fyear & $fmonth & $fday & "_" & $fhour & $fmin & $fsec & ".jpg" ;TrayTip("Status",$listcount & " [Raw Files: " & $binfile & "]" & @CRLF & "Bytes Processed: " & $jpegend + 1 & "/" & $size & @CRLF & "[" & $count & "] " & $filename & @CRLF,1,16) $data=BinaryMid($usefuldata,$jpegstart,$jpegend-$jpegstart+2) FileDelete($filename) filewrite($filename,Binary($data)) $count+=1 WEnd MsgBox(0,"File Deletion","Deleting " & $binfile,2) FileDelete($binfile) Next ; =================== ; My script ends here ; ===================
-
How to read/extract binary data?
kevinlaikf replied to kevinlaikf's topic in AutoIt General Help and Support
Yes, I tried that before. $hex1 = BinaryMid ($usefuldata,1,1) $hex2 = BinaryMid ($usefuldata,2,1) $hex3 = BinaryMid ($usefuldata,3,1) $hex4 = BinaryMid ($usefuldata,4,1) The problem is, I had failed trying to convert them back to integer/number using Int() or Number() to get the value into var $epochsec. But i believe each $hex* var of the above value had an additional prefix of "0x", it is more efficient to get them into string value to merge into a 4 bytes strings in right to left hex value orientation. -
Pardonb my ignorance, I had a hard time extracting binary info from a binary datafile. I am struggling reading 8-bytes of data, reading them in hexadecimal right to left. Below is part of my working script, but i believe there is a much efficient approach using Binary and BinaryMid functions. $file = FileOpen($binfile, 16) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $size = FileGetSize($binfile) $newdatasize = $size - 691280 $junkdata = FileRead($file, 691280) $usefuldata = FileRead($file, $newdatasize) $hex1 = StringMid($usefuldata, 3, 2) $hex2 = StringMid($usefuldata, 5, 2) $hex3 = StringMid($usefuldata, 7, 2) $hex4 = StringMid($usefuldata, 9, 2) $hexdata = "0x" & $hex4 & $hex3 & $hex2 & $hex1 $epochsec = Number ($hexdata) MsgBox(0,"hexdata",$hexdata & "-"& $epochsec,10) $creationdate = _DateAdd("s", $epochsec, "1970/01/01 00:00:00") Anyone would direct me to a better design? Apart from the above issue, i had yet to find a good solution to extract the data. The situation is: I got few data files, I had managed to spool the useful data without the junk data. Now my new datafile had a data structure of 34 bytes of info header followed by a JPEG stream, and continue to the next 34 bytes, then JPEG data stream until EOF. Of the 34 bytes, the first 4 bytes contain the epoch seconds (seconds since 1970/1/1 00:00:00), the JPEG stream start with FF D8 FF and ends with FF D9. I need to spool the JPEG data(s) with with filename linked to the individual epoch seconds date/time. Any help for this? Thanks in advance.. Regards, Kevin Lai.
-
I had searched "parameter" in the AutoIT3 help file, but returned no hits. Anyone know how to accept or read in commandline parameters for your own compiled executable (EXE) autoit3 scripts? Any literature on this? Thanks.
-
I had spool a list of 4000+ files into an array. Running a While loop to parse every file in this array. Occasionally I would hit the "memory allocation error", which i read here in related topics, is caused by large string length. Upon hitting this error, my script stopped. My parsing program would run for hours, and hitting errors would results in loss of time due to absence of intervention in case of error. I would like to find a solution, in which I would allow to continue the script by moving the questionable file to a temp folder skipping it, and continue with the rest of my files. Anyone know the AUTOIT3 equivalent of BASIC "ON ERROR "memory allocation error" Move current array file away, and CONTINUE WHILE LOOP...?