|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Announcements
Services
Chapters
Feature Zones
|
Application EditionScript EditionRequirement
GoalMany users use TortoiseSVN (a Subversion Client for Windows) to control source code, and use .dan.g.'s ToDoList to manage issues and bugs. If a user uses a Web application bug/issue tracker, SVN can set its URL in the projects' property. Then the user can click bug/issue ID in the log window to open the bug/issue page. But how to do that with We must implement a URL protocol to call ToDoList.exe. There are two ways:
This article follows the second way.
Application edition screenshot.
Script edition screenshot.
Difference Between Application Edition and Script Edition
IntroductionThe program registers a fake protocol named TDL in Windows, by writing to the registry. The registered things are as follows (contents of an exported *.reg file): Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\tdl]
@="\"URL: ToDoList protocol\""
"URL Protocol"=""
[HKEY_CLASSES_ROOT\tdl\shell]
[HKEY_CLASSES_ROOT\tdl\shell\open]
[HKEY_CLASSES_ROOT\tdl\shell\open\command]
@="wscript \"C:\\Program Files\\TodoList\\Tdl\\todolist.wsf\" \"%1\""
After registering, the user can run the URL tdl:///blabla in the address bar of Internet Explorer or Run Dialog (Start Menu->Run, or [Win]+[R]) and Windows should call the registered command with the URL as the first argument. For example: If you run the URL: tdl:///C:\My%20Documents\todo.tdl?10
Then the system will call: wscript C:\\Program Files\\TodoList\\Tdl\\todolist.wsf
"tdl:///C:\My%20Documents\todo.tdl?10"
So, it should be OK to write a WSH script named todolist.wsf and put it into C:\Program Files\TodoList\Tdl. Application Source CodeThe application is built by Turbo C++ Explorer with VCL. There is a class named
WScript Components
var url = WScript.Arguments(0)
After parsing the URL, var commandLine = ...
var wshShell = WScript.CreateObject("WScript.Shell");
// or
// var wshShell = new ActiveXObject("WScript.Shell");
wshShell.Run(commandLine);
FileSystemObject ComponentsThe script can get var fso = new ActiveXObject("Scripting.FileSystemObject");
Read: var ts = fso.OpenTextFile("tdl.ini");
var line;
while (!ts.AtEndOfStream) {
line = ts.ReadLine();
if (parseLineToGetExecutable()) break;
}
ts.Close();
Write: var ts = fso.CreateTextFile("tdl.ini", true);
ts.WriteLine("todolist=" + executable);
ts.Close();
We need a friendly user interface. An HTML page is a right way since JavaScript can also run in the Web page browser. When you write an HTML page, please note that there are some differences between WSH script and script in HTML. Differences Between WSH Script and Script in HTMLWSH script can use a default object named If you want to do something in WSH, you can write code as follows: // create WshShell object
var wshShell = WScript.CreateObject("WScript.Shell");
// popup a message box
WScript.Echo("message");
// get the full filename of the running script
var filename = WScript.ScriptFullName
But in HTML, you must write: // create WshShell object
var wshShell = new ActiveXObject("WScript.Shell");
// popup a message box
alert("message");
// get the URL of current HTML page in which the script is
var filename = window.location.href
TDL Application Edition History
TDL Script Edition History
ToDoList's tdl:// Protocol Setting.dan.g's ToDoList support tdl:// url protocol from version 5.2. If you want enable tdl:// url protocol, you can just check on a options in ToDoList's preference. Follow screenshot show you how to enable ToDoList's tdl:// url protocol.
Links
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||