| www.ClassicTW.com https://mail.black-squirrel.com/ |
|
| Read Swath cfg https://mail.black-squirrel.com/viewtopic.php?f=15&t=17731 |
Page 1 of 1 |
| Author: | Promethius [ Sun Sep 03, 2006 9:40 pm ] |
| Post subject: | |
[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 |
|
| Author: | RexxCrow [ Sun Sep 03, 2006 10:09 pm ] |
| Post subject: | |
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? |
|
| Author: | Promethius [ Sun Sep 03, 2006 10:15 pm ] |
| Post subject: | |
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. |
|
| Author: | RexxCrow [ Sun Sep 03, 2006 10:45 pm ] |
| Post subject: | |
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 |
|
| Author: | Maverick2002 [ Mon Sep 04, 2006 1:01 am ] |
| Post subject: | |
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 |
|
| Author: | Promethius [ Mon Sep 04, 2006 1:22 am ] |
| Post subject: | |
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. |
|
| Author: | Maverick2002 [ Mon Sep 04, 2006 2:30 am ] |
| Post subject: | |
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 |
|
| Author: | Vulcan [ Mon Sep 04, 2006 2:48 am ] |
| Post subject: | |
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. |
|
| Author: | Thrawn [ Mon Sep 04, 2006 2:53 am ] |
| Post subject: | |
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. |
|
| Author: | Thrawn [ Mon Sep 04, 2006 2:55 am ] |
| Post subject: | |
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. |
|
| Author: | Promethius [ Mon Sep 04, 2006 3:36 am ] |
| Post subject: | |
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. |
|
| Author: | Vulcan [ Mon Sep 04, 2006 3:39 am ] |
| Post subject: | |
Oh and I have my swath and TWX set up with % to access the twx and not the $. Mine seems to be working fine. |
|
| Author: | Promethius [ Mon Sep 04, 2006 3:51 am ] |
| Post subject: | |
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 |
|
| Author: | Thrawn [ Mon Sep 04, 2006 4:53 am ] |
| Post subject: | |
Works now. Thank you very much for your help [^] |
|
| Author: | Maverick2002 [ Mon Sep 04, 2006 8:18 am ] |
| Post subject: | |
Works for me too. Thanks Mav |
|
| Page 1 of 1 | All times are UTC - 5 hours |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|