~ubuntu-branches/ubuntu/utopic/kde-workspace/utopic-proposed

« back to all changes in this revision

Viewing changes to libs/ksysguard/scripts/README

  • Committer: Bazaar Package Importer
  • Author(s): Michał Zając
  • Date: 2011-07-09 08:31:15 UTC
  • Revision ID: james.westby@ubuntu.com-20110709083115-ohyxn6z93mily9fc
Tags: upstream-4.6.90
Import upstream version 4.6.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
To create a script:
 
2
 
 
3
* Make a folder here with any name
 
4
* Inside create a file with any name, ending .desktop, looking like:
 
5
 
 
6
 
 
7
[Desktop Entry]
 
8
Name=What's this process...
 
9
Comment=General information about this program
 
10
X-KDE-ServiceTypes=KSysGuard/Script
 
11
Type=Service
 
12
 
 
13
You will now get the Name in a context menu when right clicking on a process.  This can be translated by doing  Name[gr]=   etc.
 
14
 
 
15
* Create a main.js file containing javascript code.  This code will be run when the user choses the context menu entry.
 
16
* There are the following functions:
 
17
 
 
18
filecontent = readFile("/proc/blah")
 
19
 
 
20
exists = fileExists("/proc/blah")
 
21
 
 
22
setHtml("<html><b>Hi!</b>");
 
23
 
 
24
* For a quick and simple GUI, you can just call "setHtml" which will create a dialog box with a webkit browser.  Subsequent calls to setHtml will replace the html in the same browser widget.
 
25
 
 
26
* If you create a GUI using designer, save the file in the same folder.  Any file ending .ui  will be made accessible to the script, with the variable name
 
27
being the filename, with "." replaced with "_".
 
28
 
 
29
e.g. A file called "dialog.ui" with a textbox called 'textBox' can be used like:
 
30
 
 
31
dialog_ui.textBox.text = "Hello";
 
32
dialog_ui.show();
 
33
 
 
34
* The following variables are also available to use, with their values set to the process selected:
 
35
 
 
36
process.pid
 
37
process.ppid
 
38
process.name
 
39
process.fullname
 
40
process.command