Jump to content
Ketarin forum

Need some help capturing and appending changelogs to a file.[SOLVED]


Tomorrow
 Share

Recommended Posts

Basicly i've had this idea for some time already and now im starting to search if there is a way to accomplish this.

The whole idea would be to create a variable that captures the changelog (that's the easy part) and then appending that variable content to a global changelog file.

 

I tried this and it works in windows commandline:

echo variable_captured_text >> "changelog location"

 

But this does not work in ketarin:

echo {changelog} >> "changelog location"

 

It seems that it's trying to execute every command separately:

7.06.2011 15:51:00: [#T] Fraps: Replacing {changelog} in 'echo "{changelog}" >> "D:\Resources\Apps x86\Portable x86\Ketarin\CHANGELOG.txt"' with '

Fraps 3.4.5 - 28th May 2011

- Fixed some videos being recorded with scrambled colors'

7.06.2011 15:51:00: [#T] Fraps: Executing command: echo "

7.06.2011 15:51:00: [#T] Fraps: Executing command: Fraps 3.4.5 - 28th May 2011

7.06.2011 15:51:00: [#T] Fraps: Executing command: - Fixed some videos being recorded with scrambled colors" >> "D:\Resources\Apps x86\Portable x86\Ketarin\CHANGELOG.txt"

7.06.2011 15:51:00: [#T] Fraps: Command result: Microsoft Windows [Version 6.1.7601]

Copyright © 2009 Microsoft Corporation. All rights reserved.

D:\Resources\Apps x86\Portable x86\Ketarin>echo "

"

D:\Resources\Apps x86\Portable x86\Ketarin>Fraps 3.4.5 - 28th May 2011

'Fraps' is not recognized as an internal or external command,

operable program or batch file.

D:\Resources\Apps x86\Portable x86\Ketarin>- Fixed some videos being recorded with scrambled colors" >> "D:\Resources\Apps x86\Portable x86\Ketarin\CHANGELOG.txt"

'-' is not recognized as an internal or external command,

operable program or batch file.

 

Im not sure.Perhaps i've overlooked something simple here but sorry.It's 30+ degrees heat here today and that's defenetly too much for a northern european persons braing to function correctly :P

Edited by Tomorrow
Link to comment
Share on other sites

It is a well known problem with line breaks in batch files. You have to remove them.

 

echo {changelog:regexreplace:[\n|\r]:}>>"{file:directory}"\changelog.txt

 

If your {changelog} contains html characters (especially > and <) I think you have to remove/replace them too. It's just a guess, though.

Link to comment
Share on other sites

You're welcome!

I have a request regarding your changelog variable. If possible, can you please share your final regex for the changelog variable of Fraps?

 

In case you need line breaks you can try replacing the windows/dos line brakes with html line brakes and save the whole changelog to a html/htm file as shown below.

 

Use

<br />

instead of

<br />

Link to comment
Share on other sites

This is why I store the changelog URL within the app profile and export that, as well as the app name, version and download URL, to my recent changes txt. This is what I use in my global "after updating an application" setting:

echo {category} /// {appname} {version} /// {snotes} /// {schangelog} /// {swebsite}>> "Updates.txt"

 

And this is what I use in my "after updating all applications" global setting:

IF "%ProgramFiles(x86)%"=="" "%ProgramFiles%\Notepad++\notepad++.exe" "Updates.txt"
IF NOT "%ProgramFiles(x86)%"=="" "%ProgramFiles(x86)%\Notepad++\notepad++.exe" "Updates.txt"

 

That makes sure that regardless of which system I use (32 bit or 64 bit), NPP opens up my "updates.txt" file with the recent changes listed.

Link to comment
Share on other sites

You're welcome!

I have a request regarding your changelog variable. If possible, can you please share your final regex for the changelog variable of Fraps?

Unfortunately i don't use regex as im not experienced enough to capture the changelog with it.I can do some very basic stuff but this over my head.So only start/end currently.

 

I ran into the < and > chars.Nasty buggers.I got rid of them but the html code letters they hold still stays.For example:

AC3 decoding bug fixed (Issue 1)lili Channel order bug fixed (issue 43)lili Remote control using messageslili Write version number to the registry on install (issue 17)lili Command line interface for AC3Config utility (run ac3config ? for help)lili Swedish translation added (thanks to Niclas Burgren)lili French language updated (thanks to Philippe AGUESSE)

----------------------------------------------------

the "lili" is actually </li><li> before each changelog line but i cant really replace letters L and I with nothing as it would render the whole text unreadable.Also it's a bit of a mess as all lines are after eachother.I would really like this:

AC3 decoding bug fixed (Issue 1)

Channel order bug fixed (issue 43)

Remote control using messages

Write version number to the registry on install (issue 17)

Command line interface for AC3Config utility (run ac3config ? for help)

Swedish translation added (thanks to Niclas Burgren)

French language updated (thanks to Philippe AGUESSE)

----------------------------------------------------

 

I suppose saving as a HTML file would solve this problem and when that html is opened in browser is see correct formatting and would have no need to replace these HTML chars.I'll have to test it out.

 

Currently this is my "after updating all applications" line:

"%ProgramFiles(x86)%\Notepad++\notepad++.exe" -alwaysOnTop -ro -n9999 "{Apps x86p}\Ketarin\CHANGELOG.txt"

-alwaysOnTop - kinda says it all.

-ro - read only so i wont accidently delete something there.

-n99999 - there is no command line switch for N++ to jump to the last line so setting ridiciously high number does the trick.Let's just say i don't want to jump to the first line of a long appended file and having to manually scroll all the way to the bottom where the newest entries are.

 

And these are the write to changelog lines:

echo {changelog:regexreplace:[\n|\r\</>]:}>>"{Apps x86p}\Ketarin\CHANGELOG.txt"

echo ---------------------------------------------------->>"{Apps x86p}\Ketarin\CHANGELOG.txt"

The long --------------------------------------- line is for separation to make the log a bit more readable and to separate different changelogs.

Link to comment
Share on other sites

Ok i tried to save to .html but with

{changelog:regexreplace:[\n|\r]:}

It wrote nothing there and with

{changelog:regexreplace:[\n|\r\</>]:}

It wrote the needed text but with the formatting removed so it kinda defeats the whole purpose of saving as .html

Edited by Tomorrow
Link to comment
Share on other sites

It wrote the needed text but with the formatting removed so it kinda defeats the whole purpose of saving as .html

 

That's one of the reasons I want to write a POST handler on one of my sites to process the data and then store it for display and processing. I haven't had the time yet, but this would essentially require setting up a variable within the app profile for the actual changelog data ({changelog}) and another as an activator ({pushed}). Then you setup your "after update" routine to "echo {pushed}", which effectively causes that variable to be populated. The {pushed} variable exists as a start/end request that has this as it's URL source:

http://example.com/ketarinstuff/changes/?cat={category}&app={appname}&version={version}&changelog={urlencode:schangelog}

The server would then populate that data into a database along with the timestamp, and return ONLY an "ok" or "oops" as the content of the response, enabling you to look in the echo logs for issues.

 

It's on my "todo" list for "sooner" rather than "later".

 

Thanks for the recommendations on N++, but I ALWAYS have it open (I do a lot of coding directly into it, and store my clients time there, too) so it would risk changing my own behavior -- and I don't like that kind of thing. :)

Link to comment
Share on other sites

My problem is the exact same as you are having http://ketarin.org/forum/viewtopic.php?id=794

 

However the best workaround has been using powershell

 

echo "{changelog:regexreplace:[\r|\n]:¶}" ^| %{$_ -replace "¶","`n"}^>changelog.txt>changelog.ps1
start powershell -file changelog.ps1
del changelog.ps1

 

As you can see I just replaced the newlines with a rare character and then subsequently replaced it again with powershell. At the end of the day batch just isn't going to do it so I used an external approach fully contained within the ketarin batch command.

 

So really so long as you have Windows XP SP2 or higher it should work. Not sure who wouldn't be using at least that these days anyway.

 

I'm sure C# has a way of doing things but I don't know C# and this will work.

 

Do let me know if this works for you, I like problem solving

 

 

Also for Fraps Changelog the best I can get is using

<h2>.*?</font>

It captures all relevant text but still has some html formatting like so

 

<h2>28th May 2011 - Fraps 3.4.5 Released</h2>

<p>The latest version of Fraps includes an update to the loop recording mode, allowing you to specify a custom length for the buffer (rather than the default 30 seconds).  To activate the recording loop simply press and hold your video capture hotkey until the Fraps counter turns pink, indicating that loop recording has begun.</p>
<p>We have also included new optimizations for recording at high resolutions such as 1920x1080 (1080P).  Performance gains should be seen in most OpenGL and DirectX games with Fraps 3.4.</p>
<br>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
       <tr>
               <td class="spacer" width="10" height="10" bgcolor="#999999"> <br/></td>
               <td class="spacer" width="10" height="10" bgcolor="#EEEEEE"> <br/></td>
               <td class="spacer" width="10" height="10" bgcolor="#CCCCCC"> <br/></td>
               <td class="spacer" width="10" height="10" bgcolor="#999999"> <br/></td>
               <td class="spacer" height="10" bgcolor="#666666"> <br/></td>
               <td class="spacer" width="10" height="10" bgcolor="#CCCCCC"> <br/></td>
       </tr>
</table>
<div class="changelog"><strong>Changelog</strong></div>
<pre><font size="+1">
Fraps 3.4.5 - 28th May 2011
- Fixed some videos being recorded with scrambled colors

Fraps 3.4.4 - 26th May 2011
- Increased performance capturing Vista/Windows 7 aero desktop (DWM)
- Reduced memory footprint of Fraps process
- Fixed Fraps crash while idling on desktop
- Fixed gem glowing while recording The Dark Mod
- Fixed hotkeys not responding when simulated from autohotkey/macro apps
- Fixed graphic corruption in some OpenGL titles

Fraps 3.4.3 - 12th May 2011
- Improved DirectDraw capture speed
- Fixed recording crash on single CPU systems
- Fixed invalid colors/crashing recording from 16-bit color games
- Fixed corrupt/oversized AVIs being written at high resolutions
- Fixed Dirt not loading with Fraps running
- Other minor bug fixes and optimizations

Fraps 3.4.2 - 14th Apr 2011
- Improved OpenGL capture speed
- Fixed freeze when clicking on Minimize button
- Fixed GL state not being restored properly
- Fixed blank video showing in some AVIs

Fraps 3.4.1 - 2nd Apr 2011
- Fixed crash when starting Fraps for some users
- Fixed hotkeys not being detected when modifier keys held
- Fixed keys getting stuck when used by both the game and Fraps

Fraps 3.4.0 - 29th Mar 2011
- Added configurable buffer size for loop recording mode
- Increased video capture performance at high resolutions
- Fixed slow recording of Minecraft at default window size
- Fixed benchmark crashing when configured to stop automatically after 1 second
</font>

 

Obviously you could just remove the extra formatting by going {fraps:regexreplace:<.*?>:} keep in mind you'd still have   in there. So with a few variable chains you could also remove that, format it up a bit nicer then output it.

Edited by Omniferum
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.