TextSweep

Check-in [e314a576e6]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement dde support on Windows
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e314a576e6732f445ff17bcf2679b52c38ce71fc
User & Date: kevin 2017-12-28 16:56:05
Context
2017-12-28
17:43
Prepare 4.0 for Windows check-in: 03b7537752 user: kevin tags: trunk
16:56
Implement dde support on Windows check-in: e314a576e6 user: kevin tags: trunk
2017-12-27
19:13
Update to help docs check-in: e0e4b8ed66 user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scriptlibs/machelp/help.txt.

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76

77









78
79
80
81
82
83
84
 * set_search_folder(folder) -- set the search directory
 * set_search_pattern(pattern) -- set the pattern to filter files by types, i.e. html
 * set_search_term(term) -- the text to be replaced
 * set_replace_term(term) -- replacement text
 * execute_replace -- run the search and replacement operation


Here is a sample AppleScript for macOS:

   tell application "TextSweep"
      delay 3
      set_search_pattern("*.html")
      set_search_term("WordTech")
      set_replace_term("AWP")
      set_search_folder("\"/Users/kevin/Desktop/CGWEB copy\"")
      execute_replace()				
   end tell


Windows scripting is currently under development.











-------------------
title: Help
alias: Help

TextSweep provides comprehensive user documentation from the "Help" menu, and also provides tooltips for the toolbar buttons. Additional user support is available via the "Contact Code by Kevin" item in the Help menu; and the website link in the help menu.







|










>
|
>
>
>
>
>
>
>
>
>







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 * set_search_folder(folder) -- set the search directory
 * set_search_pattern(pattern) -- set the pattern to filter files by types, i.e. html
 * set_search_term(term) -- the text to be replaced
 * set_replace_term(term) -- replacement text
 * execute_replace -- run the search and replacement operation


Automating the application on macOS can be done via AppleScript. Type this script into AppleScript Editor and run it, or save the script as "test.applescript" and run "osascript test.applescript" from the command line: 

   tell application "TextSweep"
      delay 3
      set_search_pattern("*.html")
      set_search_term("WordTech")
      set_replace_term("AWP")
      set_search_folder("\"/Users/kevin/Desktop/CGWEB copy\"")
      execute_replace()				
   end tell

Automating the application on Windows can be done using the Dynamic Data Exchange (DDE) protocol. The DDE protocol has several components, including a "Service," "Topic," and "Items." In TextSweep, the Service name is always TclEval (because that is the underlying name that the Tcl interpreter supports), the Topic name is TextSweep, and Items (data or return values) are not currently required. 

There are various programming languages on Windows in which one can write a DDE client to automate a DDE application, including Tcl, Python, VBA, C/C++, and others. An easy way to automate TextSweep from the command line is to install Chris Oldwood's free DDE Command tool from [http://www.chrisoldwood.com/win32.htm]. The tool can then be incorporated into a batch script such as the following: 

   @echo off
   start TextSweep.exe 
   call timeout 2 >null
   call DDECmd.exe execute --server TclEval --topic TextSweep --command "set_search_pattern(\"*.html\")"
   call DDECmd.exe execute --server TclEval --topic TextSweep --command "set_search_term WordTech"
   call DDECmd.exe execute --server TclEval --topic TextSweep --command "set_replace_term AWP"
   call DDECmd.exe execute --server TclEval --topic TextSweep --command "execute_replace"


-------------------
title: Help
alias: Help

TextSweep provides comprehensive user documentation from the "Help" menu, and also provides tooltips for the toolbar buttons. Additional user support is available via the "Contact Code by Kevin" item in the Help menu; and the website link in the help menu.

Changes to scriptlibs/textsweep/textsweep-main.tcl.

28
29
30
31
32
33
34

35
36
37
38
39
40
41
    aem::installeventhandler CoKv sStm set_search_term
    aem::installeventhandler CoKv sRtm set_replace_term
    aem::installeventhandler CoKv sExr execute_replace
}

if {[tk windowingsystem] eq "win32"} {
    package require dde

}


#initialize variables
global folder
global searchvar
global patternvar







>







28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
    aem::installeventhandler CoKv sStm set_search_term
    aem::installeventhandler CoKv sRtm set_replace_term
    aem::installeventhandler CoKv sExr execute_replace
}

if {[tk windowingsystem] eq "win32"} {
    package require dde
    dde servername TextSweep
}


#initialize variables
global folder
global searchvar
global patternvar