View unanswered posts | View active topics It is currently Wed Apr 29, 2026 5:41 pm



Reply to topic  [ 15 posts ] 
 Read Swath cfg 
Author Message
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
[EDIT] Although I posted the fixed version later in the thread, I thought someone might not bother to read that far - this is the fixed version. [/EDIT]

The script below will read the SWATH config file and place the macros and triggers you have setup in a window for reference.

Why? If you have been editing your triggers, the needed trigger may not yet be intuitive - and besides I just wanted to see if I could do it. The script isn't pretty and may not contain values for some items - up to you to modify for that.

NOTE: !!! You may have to edit the path to your SWATH config file !!!

============================================

# display swath macros and triggers in a window - Promethius Sept 2006

setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

setVar $mac 0
setVar $action 0
setVar $key 0
Window cfg 425 525 " CRS --- Swath Config by Promethius " ONTOP
setVar $cfgWindow ""

if ($SWATHcfg <> 0)
read $SWATHcfg $eofChk 1
setVar $i 1
while ($eofChk <> EOF)
getword $eofchk $chk 1
if ($chk = "<Macro") and ($chk <> "<Macros")
add $mac 1
getword $eofChk $macroID[$mac] 2
stripText $macroID[$mac] "id="
stripText $macroID[$mac] ">"
getText $eofChk $macroName[$mac] "name=" ">"
getText $eofChk $macroString[$mac] ">" "</"
add $numMacrosInFile 1
elseif ($chk = "<Event")
add $key 1
gettext $eofChk $event[$key] "key=" " mod"
getText $eofChk $mod[$key] "mod=" "/>"

elseif ($chk = "<Action")
add $action 1
getText $eofChk $atype[$action] "type=" ">"
gettext $eofChk $actionScript[$action] ">" "</Action"
end
add $i 1
read $SWATHcfg $eofChk $i
end
end


setVar $i 1
setVar $cfgWindow "**-=-= Macros =-=-*"
while ($i <= $mac)
setVar $cfgWindow $cfgWindow & " " & $macroName[$i] & " " & $macroString[$i] & "*"
# setVar $cfgWindow $cfgWindow & "* " & $macroName[$i] & " " & $macroString[$i] & "*"
add $i 1
end

setVar $i 1
setVar $cfgWindow $cfgWindow & "**-=-= Events =-=-*"
gosub :keycodes
while ($i <= $key)
setVar $dispEvent ""
getwordpos $atype[$i] $pos "65796"
if ($pos = 0)
# swath script
getWordPos $atype[$i] $pos "65793"
end
stripText $event[$i] #034
setVar $dispEvent $event[$i]
getWordPos $mod[$i] $shift 1
setVar $modKey ""
if ($shift > 0)
setVar $modkey "Shift-"
else
getwordpos $mod[$i] $shift 4
if ($shift > 0)
setVar $modkey "ALT-"
end
end
getwordpos $mod[$i] $shift 2
if ($shift > 0)
setVar $modkey "CTRL-"
end
if ($pos > 0)
setVar $cfgWindow $cfgWindow & " " & $modkey & $keys[$dispEvent] & " " & $actionScript[$i] & "*"
# setVar $cfgWindow $cfgWindow & "* " & $modkey & $keys[$dispEvent] & " " & $actionScript[$i] & "*"
else
setVar $imac 1
while ($imac <= $mac)
getwordpos $macroID[$imac] $macPos $actionscript[$i]
if ($macPos > 0)
# setVar $cfgWindow $cfgWindow & "* " & $modkey & $keys[$dispEvent] & " " & $macroName[$imac] & " " & $macroString[$imac] & "*"
setVar $cfgWindow $cfgWindow & " " & $modkey & $keys[$dispEvent] & " " & $macroName[$imac] & " " & $macroString[$imac] & "*"
end
add $imac 1
end
end
add $i 1
end
setWindowContents cfg $cfgWindow
setTextTrigger lmao :lmao "xyzzy"
pause
halt

:keyCodes
setVar $keys[112] "F1"
setVar $keys[113] "F2"
setVar $keys[114] "F3"
setVar $keys[115] "F4"
setVar $keys[116] "F5"
setVar $keys[117] "F6"
setVar $keys[118] "F7"
setVar $keys[119] "F8"
setVar $keys[120] "F9"
setVar $keys[121] "F10"
setVar $keys[122] "F11"
setVar $keys[123] "F12"
setVar $keys[187] "="
setVar $keys[189] "-"
setVar $keys[192] "`"
setVar $keys[48] "0"
setVar $keys[49] "1"
setVar $keys[50] "2"
setVar $keys[51] "3"
setVar $keys[52] "4"
setVar $keys[53] "5"
setVar $keys[54] "6"
setVar $keys[55] "7"
setVar $keys[56] "8"
setVar $keys[57] "9"
setVar $keys[65] "A"
setVar $keys[66] "B"
setVar $keys[67] "C"
setVar $keys[68] "D"
setVar $keys[69] "E"
setVar $keys[70] "F"
setVar $keys[71] "G"
setVar $keys[72] "H"
setVar $keys[73] "I"
setVar $keys[74] "J"
setVar $keys[75] "K"
setVar $keys[76] "L"
setVar $keys[77] "M"
setVar $keys[78] "N"
setVar $keys[79] "O"
setVar $keys[80] "P"
setVar $keys[81] "Q"
setVar $keys[82] "R"
setVar $keys[83] "S"
setVar $keys[84] "T"
setVar $keys[85] "U"
setVar $keys[86] "V"
setVar $keys[87] "W"
setVar $keys[88] "X"
setVar $keys[89] "Y"
setVar $keys[90] "Z"

return

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sun Sep 03, 2006 9:40 pm
Profile ICQ
Captain
User avatar

Joined: Sat Jun 18, 2005 2:00 am
Posts: 2214
Location: USA
Unread post 
Hahaa, lmao, you are demented! j/k

Are those three var’s suppose to be commented out like that or did you actually mean to remove them?

_________________
Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact!
Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!


Sun Sep 03, 2006 10:09 pm
Profile ICQ WWW
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
quote:Originally posted by RexxCrow

Hahaa, lmao, you are demented! j/k

Are those three var’s suppose to be commented out like that or did you actually mean to remove them?


Guilty on demented...

If they are commented then it means they should be. The only change I think was removing a "*" to single space instead of double space. When changing some lines, I usually copy/paste and comment out the line I am changing to be able to go back to it easily if the change doesn't work out. The CRS in the window title stands for "Can't Remember ****" - that is also the reason for doing the above.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Sun Sep 03, 2006 10:15 pm
Profile ICQ
Captain
User avatar

Joined: Sat Jun 18, 2005 2:00 am
Posts: 2214
Location: USA
Unread post 
I was wondering what that CRS part was, A sense of humor and scripting I like that… like coffee and donuts.. or donuts and cops… hehee

_________________
Your reliance upon subjective IRM's, subjugates you through utter omission, obfuscation, and distortion of fact!
Don't mess with me, I will 26 U.S.C. § 7212(a) your IRS!


Sun Sep 03, 2006 10:45 pm
Profile ICQ WWW
Gunnery Sergeant

Joined: Sat Jul 29, 2006 2:00 am
Posts: 26
Location: USA
Unread post 
Script run-time error in 'PROSWATHCFG.TS':
CutText: Cannot cut from past end of text, line 60

line 60 in my cut and paste version is the last line in the following:

# swath script
getWordPos $atype[$i] $pos "65793"
end
getlength $event[$i] $eventLen
cuttext $event[$i] $dispEvent 2 ($eventLen - 2)
getWordPos $mod[$i] $shift 1

_________________
Kill 'em all and let God sort 'em out


Mon Sep 04, 2006 1:01 am
Profile ICQ YIM
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
quote:Originally posted by Maverick2002

Script run-time error in 'PROSWATHCFG.TS':
CutText: Cannot cut from past end of text, line 60

line 60 in my cut and paste version is the last line in the following:

# swath script
getWordPos $atype[$i] $pos "65793"
end
getlength $event[$i] $eventLen
cuttext $event[$i] $dispEvent 2 ($eventLen - 2)
getWordPos $mod[$i] $shift 1



I have had a couple of people run into that. Are you running twxproxy 2.03 or 2.04?

[edit] Also are you using any SWATH or REXX scripts for the trigger to activate? I don't need their name. Since I don't run either type of script for my triggers, I never tested those.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Mon Sep 04, 2006 1:22 am
Profile ICQ
Gunnery Sergeant

Joined: Sat Jul 29, 2006 2:00 am
Posts: 26
Location: USA
Unread post 
Its v2.03, let me try it in v2.04 and I will post back

Mav

Same message in v2.04 but it says line 59 now.

I just start it from the twx load prompt in the startmenu tray

_________________
Kill 'em all and let God sort 'em out


Mon Sep 04, 2006 2:30 am
Profile ICQ YIM
Gameop
User avatar

Joined: Fri Sep 03, 2004 2:00 am
Posts: 2041
Location: Acworth, Georgis USA
Unread post 
Hey Prom,

did you change the swath file to the new version in the program files?

cause when I downloaded the new 1.8.3 the folder still is 1.8.2 and so does the new .exe, even thou swath shows up the 1.8.3 when loaded up.

I had to adjust the line with the 1.8.3 to match my file to get the script to work, and works good too, thanks

for all who are asking, this is the area I had to change to get it to work:
# display swath macros and triggers in a window - Promethius Sept 2006

# !!!!!!!!!!!! edit the path below as necessary !!!!!!!!!!!!

setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

Change this line from this:
setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

To this:
setVar $SWATHcfg "C:\Program Files\SWATH 1.8.2\SWATH.cfg"
and it should work well.

Also works nice on TWX 2.04.

_________________
Vulcan's Forge
v1 TWGS telnet://vulcansforge.homeip.net:2002
v2 TWGS telnet://vulcansforge.homeip.net:23
Forum and site down for now.
my Email is vulcan219@comcast.net now


Mon Sep 04, 2006 2:48 am
Profile ICQ YIM
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 
quote:Originally posted by Vulcan

Hey Prom,

did you change the swath file to the new version in the program files?

cause when I downloaded the new 1.8.3 the folder still is 1.8.2 and so does the new .exe, even thou swath shows up the 1.8.3 when loaded up.

I had to adjust the line with the 1.8.3 to match my file to get the script to work, and works good too, thanks

for all who are asking, this is the area I had to change to get it to work:
# display swath macros and triggers in a window - Promethius Sept 2006

# !!!!!!!!!!!! edit the path below as necessary !!!!!!!!!!!!

setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

Change this line from this:
setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

To this:
setVar $SWATHcfg "C:\Program Files\SWATH 1.8.2\SWATH.cfg"
and it should work well.

Also works nice on TWX 2.04.


Well I am having a problem, similar to Mav. I tried 2.03 and 2.04 of TWXProxy. Mind you it could just be my end.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Sep 04, 2006 2:53 am
Profile
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 
quote:Originally posted by Promethius

quote:Originally posted by Maverick2002

Script run-time error in 'PROSWATHCFG.TS':
CutText: Cannot cut from past end of text, line 60

line 60 in my cut and paste version is the last line in the following:

# swath script
getWordPos $atype[$i] $pos "65793"
end
getlength $event[$i] $eventLen
cuttext $event[$i] $dispEvent 2 ($eventLen - 2)
getWordPos $mod[$i] $shift 1



I have had a couple of people run into that. Are you running twxproxy 2.03 or 2.04?

[edit] Also are you using any SWATH or REXX scripts for the trigger to activate? I don't need their name. Since I don't run either type of script for my triggers, I never tested those.


Ack, Promethius. Just saw your post. Is it the reason for the error? Because some of my triggers/macro's call TWXProxy/SWATH/REXX scripts.

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Sep 04, 2006 2:55 am
Profile
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
Looks like the problem is with the keys being used to activate the trigger. I have not found a good way to strip quotes - know it has to do with ascii 34 ("). I am useing:

getlength $event[$i] $eventLen
cuttext $event[$i] $dispEvent 2 ($eventLen - 2)

This is in order to try and get a number out of something like "50" that is enclosed in quotes. I will continue to try and find out what the issue is with it.

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Mon Sep 04, 2006 3:36 am
Profile ICQ
Gameop
User avatar

Joined: Fri Sep 03, 2004 2:00 am
Posts: 2041
Location: Acworth, Georgis USA
Unread post 
Oh and I have my swath and TWX set up with % to access the twx and not the $. Mine seems to be working fine.

_________________
Vulcan's Forge
v1 TWGS telnet://vulcansforge.homeip.net:2002
v2 TWGS telnet://vulcansforge.homeip.net:23
Forum and site down for now.
my Email is vulcan219@comcast.net now


Mon Sep 04, 2006 3:39 am
Profile ICQ YIM
Ambassador
User avatar

Joined: Mon Feb 09, 2004 3:00 am
Posts: 3141
Location: Kansas
Unread post 
k, should be fixed - got rid of the cutText command:

--

# display swath macros and triggers in a window

setVar $SWATHcfg "C:\Program Files\SWATH 1.8.3\SWATH.cfg"

setVar $mac 0
setVar $action 0
setVar $key 0
Window cfg 425 525 " CRS --- Swath Config by Promethius " ONTOP
setVar $cfgWindow ""

if ($SWATHcfg <> 0)
read $SWATHcfg $eofChk 1
setVar $i 1
while ($eofChk <> EOF)
getword $eofchk $chk 1
if ($chk = "<Macro") and ($chk <> "<Macros")
add $mac 1
getword $eofChk $macroID[$mac] 2
stripText $macroID[$mac] "id="
stripText $macroID[$mac] ">"
getText $eofChk $macroName[$mac] "name=" ">"
getText $eofChk $macroString[$mac] ">" "</"
add $numMacrosInFile 1
elseif ($chk = "<Event")
add $key 1
gettext $eofChk $event[$key] "key=" " mod"
getText $eofChk $mod[$key] "mod=" "/>"

elseif ($chk = "<Action")
add $action 1
getText $eofChk $atype[$action] "type=" ">"
gettext $eofChk $actionScript[$action] ">" "</Action"
end
add $i 1
read $SWATHcfg $eofChk $i
end
end


setVar $i 1
setVar $cfgWindow "**-=-= Macros =-=-*"
while ($i <= $mac)
setVar $cfgWindow $cfgWindow & " " & $macroName[$i] & " " & $macroString[$i] & "*"
# setVar $cfgWindow $cfgWindow & "* " & $macroName[$i] & " " & $macroString[$i] & "*"
add $i 1
end

setVar $i 1
setVar $cfgWindow $cfgWindow & "**-=-= Events =-=-*"
gosub :keycodes
while ($i <= $key)
setVar $dispEvent ""
getwordpos $atype[$i] $pos "65796"
if ($pos = 0)
# swath script
getWordPos $atype[$i] $pos "65793"
end
stripText $event[$i] #034
setVar $dispEvent $event[$i]
getWordPos $mod[$i] $shift 1
setVar $modKey ""
if ($shift > 0)
setVar $modkey "Shift-"
else
getwordpos $mod[$i] $shift 4
if ($shift > 0)
setVar $modkey "ALT-"
end
end
getwordpos $mod[$i] $shift 2
if ($shift > 0)
setVar $modkey "CTRL-"
end
if ($pos > 0)
setVar $cfgWindow $cfgWindow & " " & $modkey & $keys[$dispEvent] & " " & $actionScript[$i] & "*"
# setVar $cfgWindow $cfgWindow & "* " & $modkey & $keys[$dispEvent] & " " & $actionScript[$i] & "*"
else
setVar $imac 1
while ($imac <= $mac)
getwordpos $macroID[$imac] $macPos $actionscript[$i]
if ($macPos > 0)
# setVar $cfgWindow $cfgWindow & "* " & $modkey & $keys[$dispEvent] & " " & $macroName[$imac] & " " & $macroString[$imac] & "*"
setVar $cfgWindow $cfgWindow & " " & $modkey & $keys[$dispEvent] & " " & $macroName[$imac] & " " & $macroString[$imac] & "*"
end
add $imac 1
end
end
add $i 1
end
setWindowContents cfg $cfgWindow
setTextTrigger lmao :lmao "xyzzy"
pause
halt

:keyCodes
setVar $keys[112] "F1"
setVar $keys[113] "F2"
setVar $keys[114] "F3"
setVar $keys[115] "F4"
setVar $keys[116] "F5"
setVar $keys[117] "F6"
setVar $keys[118] "F7"
setVar $keys[119] "F8"
setVar $keys[120] "F9"
setVar $keys[121] "F10"
setVar $keys[122] "F11"
setVar $keys[123] "F12"
setVar $keys[187] "="
setVar $keys[189] "-"
setVar $keys[192] "`"
setVar $keys[48] "0"
setVar $keys[49] "1"
setVar $keys[50] "2"
setVar $keys[51] "3"
setVar $keys[52] "4"
setVar $keys[53] "5"
setVar $keys[54] "6"
setVar $keys[55] "7"
setVar $keys[56] "8"
setVar $keys[57] "9"
setVar $keys[65] "A"
setVar $keys[66] "B"
setVar $keys[67] "C"
setVar $keys[68] "D"
setVar $keys[69] "E"
setVar $keys[70] "F"
setVar $keys[71] "G"
setVar $keys[72] "H"
setVar $keys[73] "I"
setVar $keys[74] "J"
setVar $keys[75] "K"
setVar $keys[76] "L"
setVar $keys[77] "M"
setVar $keys[78] "N"
setVar $keys[79] "O"
setVar $keys[80] "P"
setVar $keys[81] "Q"
setVar $keys[82] "R"
setVar $keys[83] "S"
setVar $keys[84] "T"
setVar $keys[85] "U"
setVar $keys[86] "V"
setVar $keys[87] "W"
setVar $keys[88] "X"
setVar $keys[89] "Y"
setVar $keys[90] "Z"

return

_________________
               / Promethius / Enigma / Wolfen /

"A man who has no skills can be taught, a man who has no honor has nothing."


Mon Sep 04, 2006 3:51 am
Profile ICQ
Commander
User avatar

Joined: Fri Aug 20, 2004 2:00 am
Posts: 1801
Location: Outer Rims
Unread post 
Works now. Thank you very much for your help [^]

_________________
-Thrawn

But risk has always been an inescapable part of warfare.

--

Knight to Queen's Bishop 3


Mon Sep 04, 2006 4:53 am
Profile
Gunnery Sergeant

Joined: Sat Jul 29, 2006 2:00 am
Posts: 26
Location: USA
Unread post 
Works for me too. Thanks

Mav

_________________
Kill 'em all and let God sort 'em out


Mon Sep 04, 2006 8:18 am
Profile ICQ YIM
Display posts from previous:  Sort by  
Reply to topic   [ 15 posts ] 

Who is online

Users browsing this forum: Google [Bot] and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by wSTSoftware.