android - Translating batch script to AHK for further development -


this part of batch script extract mtk android boot.img got stuck, shared dev.

an ahk newbie myself, title says , got stuck loop, %boot_size% & cpio not extracting rmdisk folder...

set /a n=0 :loop /f %%g in (bin\off2.txt) (     if !n!==1 (         set /a ofs1=%%g         set /a n+=1     )     if !n!==3 (         set /a ofs2=%%g         set /a n+=1     )     if !n!==5 (         set /a ofs3=%%g+4         set /a n+=1     )        if `%%g` equ `offset` (             set /a n+=1     ) ) %%i in (%1) ( set /a boot_size=%%~zi )  md %~n1  bin\sfk166.exe partcopy %1 -fromto 0x0 %ofs1% %~n1\kernel_header -yes  bin\sfk166.exe partcopy %1 -fromto %ofs1% %ofs2% %~n1\kernel -yes  bin\sfk166.exe partcopy %1 -fromto %ofs2% %ofs3% %~n1\ram_header -yes  bin\sfk166.exe partcopy %1 -fromto %ofs3% %boot_size% %~n1\ram_disk.gz -yes  bin\7z.exe -tgzip x -y %~n1\ram_disk.gz -o%~n1 >nul  md %~n1\rmdisk cd %~n1 cd rmdisk %~dp0bin\cpio.exe -i <../ram_disk 

any appreciated... ;-)

tia


@mcl reply. first part of script direct translation worked... :-p

#noenv  ; recommended performance , compatibility future autohotkey releases. ; #warn  ; enable warnings assist detecting common errors. sendmode input  ; recommended new scripts due superior speed , reliability. setworkingdir %a_scriptdir%  ; ensures consistent starting directory.  runwait, %comspec% /c %a_scriptdir%\bin\sfk166.exe hexfind %a_scriptdir%\recovery.img -pat -bin /88168858/ -case>%a_scriptdir%\bin\offset.txt, , min runwait, %comspec% /c %a_scriptdir%\bin\sfk166.exe hexfind %a_scriptdir%\recovery.img -pat -bin /ffffffff1f8b08/ -case>>%a_scriptdir%\bin\offset.txt , , min runwait, %comspec% /c %a_scriptdir%\bin\sfk166.exe find %a_scriptdir%\bin\offset.txt -pat offset>%a_scriptdir%\bin\off2.txt, , min runwait, %comspec% /c %a_scriptdir%\bin\sfk166.exe replace %a_scriptdir%\bin\off2.txt -binary /20/0a/ -yes, , min fileremovedir, %a_scriptdir%/recovery ;to make sure old failed extracted folder deleted filecreatedir, %a_scriptdir%/recovery 

hmm, i've translated & working great, guess true ahk can execute/ substitute batch command . . .

the key solution understand batch script trying & substitute ahk command. execute 1 command per line & see . . .

this did, add echo %ofs1% %ofs2% %ofs3% %boot_size% batch script & below command . . .

yourbatchfile.bat>log.txt 

analyse log.txt content & give idea next . . . luck ;-)


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -