Page 1 of 1
WildEdit : Command line interface
Posted: Mon Sep 22, 2008 1:22 pm
by objectsmith
would be great if it was possible to use wildedit in batch mode with no gui. Calling from the command line with parameters or passing a file containing the gui control equivalents. I have a weekly task which I could then setup as a schedule task. thanks...
Posted: Thu Mar 04, 2010 1:23 am
by kengrubb
It's not exactly what you're wanting, but I've recently ventured out into the world of AutoIt--a totally free scripting language.
http://www.autoitscript.com/autoit3/index.shtml
I started playing around with an automation script for WE2. It looks like it's easily doable, but it's a little oogie because you'll have to manipulate the config2.xml file.
You'll want to get a basic understanding of AutoIt, but here is a script I coded up. It doesn't actually execute and make changes, but I think it does a pretty good job of showing you what's possible.
; Opens WildEdit
; =====================================================================
Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declare
Dim $FilePath = @UserProfileDir & "\Application Data\Helios\WildEdit\config2.xml"
Dim $HoldPath = @UserProfileDir & "\Application Data\Helios\WildEdit\config2a.xml"
Dim $File, $HoldFile
If Not FileExists($FilePath) Then Exit
$File = FileRead($FilePath)
; Checkboxes are stored in config2.xml in 'modes' (0 is unchecked, 1 is checked)
; 1st byte - "." matches null characters
; 2nd byte - "." matches end of line characters
; 3rd byte - Literal replacement
; 4th byte - Search subfolders
; 5th byte - Match case
; 6th byte - Match whole words
; 7th byte - Regular expression
$File = StringRegExpReplace($File, '<value name="modes" type="bitset">[0-9]{7}</value>', '<value name="modes" type="bitset">0000000</value>')
$HoldFile = FileOpen($HoldPath, 2)
FileWrite($HoldFile, $File)
FileClose($HoldFile)
FileMove($HoldPath, $FilePath, 1)
Run("C:\Program Files\WildEdit\WildEdit.exe", "C:\Program Files\WildEdit", @SW_MAXIMIZE)
WinWaitActive("WildEdit", "")
; ^(.{4})(.*)\r\n\1
Dim $SearchFor = '^1{^}(.{{}4{}})(.*)\r\n\1'
; $1$2
Dim $ReplaceWith = '$1$2'
Dim $Include = 'Text*.txt'
Dim $Exclude = 'Text336.txt'
Send('^1' & $SearchFor & '{TAB 6}' & $ReplaceWith & '{TAB 2}' & $Include & '{TAB}' & $Exclude)
Posted: Thu Mar 04, 2010 10:04 am
by ben_josephs
If you don't need a GUI, you don't need a GUI application.
There are many ways of doing this on the command line, using any of many scripting languages.
For example, if you happen to use Perl, this one-line command will replace this with that everywhere in the given input file, saving the original with the extension .bak:
perl -i.bak -p -e "s/this/that/g" input.txt
For fancier tasks it's better to create a script and call that. There's no limit to what you can do.