Difference between revisions of "Ide/External Tools"

From wiki.visual-prolog.com

(New page: {{ideNavbar|External Tools}} === How to Add Calls of Other Applications === The Tools | Configure Tools command opens the '''Tools''' dialog. In this dialog you can assign 10 commands tha...)
 
 
Line 14: Line 14:
Then type into the '''Name:''' field a short name you wish to use to the command, for instance, <vpbnf><TmpWritable></vpbnf>.
Then type into the '''Name:''' field a short name you wish to use to the command, for instance, <vpbnf><TmpWritable></vpbnf>.


Now clicking the '''Tools''' menu item you will see that the new sub-menu item <span class="code-span">TmpWritable '''Ctrl+3''' appears.<span>''' '''</span>So you can call the inserted command by both pressing onto the hot key <span>'''Ctrl 3'''</span> and by selecting this new sub-menu command <span>'''Tools | TextPad'''</span>.
Now clicking the '''Tools''' menu item you will see that the new sub-menu item <vpbnf><TmpWritable></vpbnf> '''Ctrl+3''' appears. So you can call the inserted command by both pressing onto the hot key '''Ctrl+3''' and by selecting this new sub-menu command '''Tools | TextPad'''.


== Command Line Syntax ==
=== Command Line Syntax ===


Notice that in the <span>'''Command Line'''</span> you should not surround a filename to be executed with the quotation marks, the IDE makes this automatically. However, you should surround a filename to be executed with quotation marks (if the filename contains blank characters)<span>''' '''</span>when<span>''' '''</span>you use it inside a command file. Also notice that the IDE passes the following parameters to the specified command line:
Notice that in the '''Command Line''' you should not surround a filename to be executed with the quotation marks, the IDE makes this automatically. However, you should surround a filename to be executed with quotation marks (if the filename contains blank characters) when you use it inside a command file. Also notice that the IDE passes the following parameters to the specified command line:
$(file:pne) – is the full filename (with the path and the filename extension) of the file opened in the having focus IDE editor.
*<vp>$(file:pne)</vp> – is the full filename (with the path and the filename extension) of the file opened in the having focus IDE editor.
$(file:p) – is the full path of the filename (i.e. without the filename) of the file opened in the having focus IDE editor.
*<vp>$(file:p)</vp> – is the full path of the filename (i.e. without the filename) of the file opened in the having focus IDE editor.
*<vp>$(file:n)</vp> – is the filename without the path and without the extension of the file opened in the having focus IDE editor.
*<vp>$(file:e)</vp> – is the filename extension without the path of the file opened in the having focus IDE editor.
*<vp>$(file:ne)</vp> – is the short filename without the path of the file opened in the having focus IDE editor.
*<vp>$(file:pn)</vp> – is the full filename without the extension of the file opened in the having focus IDE editor.
*<vp>$(file)</vp> – is the full filename (with the path and the filename extension) of the file opened in the having focus IDE editor.
*<vp>$(line)</vp> – is the number of the current line (where the caret is placed) in the having focus IDE text editor. It is always <vp>0</vp>, if a non-text editor is the currently active editor.
*<vp>$(column)</vp> – is the number of the current column number (where the caret is placed) in the having focus IDE text editor. It is always <vp>0</vp>, if a non-text editor is the currently active editor.
*<vp>$(repository)</vp> – is the repository path, which can be used for a source control system
*<vp>$(password)</vp> – is the password, which can be used for a source control system
*<vp>$(user)</vp> – is the user name, which can be used for a source control system
*<vp>$(scfile)</vp> – is the file name with path in the source control system
*<vp>$(host)</vp> – is the host address, which can be used for a source control system


<li class=kadov-p
class=kadov-p><span class=code-span>$(file:n)</span> – is the filename
without the path and without the extension of the file opened in the having
focus IDE editor.</li>


<li class=kadov-p
The tools works on the active file (e.g. in the active editor).
class=kadov-p><span class=code-span>$(file:e)</span> – is the filename
extension without the path of the file opened in the having focus IDE
editor.</li>


<li class=kadov-p
{|{{prettytable}}
class=kadov-p><span class=code-span>$(file:ne)</span> – is the
|-
short filename without the path of the file opened in the having focus
| $(column)
IDE editor.</li>
| The column in which the caret is placed
|-
| $(line)
| The line number in which the caret is placed
|-
| $(file)
| File name
|-
| $(file:p)
| Path of the file name
|-
| $(file:n)
| Name of the file name
|-
| $(file:e)
| Extension of the file name
|-
| $(file:pn)
| Path and name
|-
| $(file:ne)
| Name and extension
|-
| $(file:pne)
| Path, Name and extension (same as $(file) )
|}


<li class=kadov-p
class=kadov-p><span class=code-span>$(file:pn)</span> – is the
full filename without the extension of the file opened in the having focus
IDE editor.</li>


<li class=kadov-p
These variables are for use with a source control system (e.g. SourceSafe, Vault, etc):
class=kadov-p><span class=code-span>$(file)</span> – is the full
filename (with the path and the filename extension) of the file opened
in the having focus IDE editor.</li>


<li class=kadov-p><p><span class=code-span>$(line)</span> – is the
{|{{prettytable}}
number of the current line (where the caret is placed) in the having focus
|-
IDE text editor. It is always <span class=code-span>0</span>, if a non-text
| $(repository)
editor is the currently active editor.</p></li>
| Source Control repository
|-
| $(scfile)
| Source Control file name
|}


<li class=kadov-p><p><span class=code-span>$(column)</span> – is the
The values of these variable depends on the settings you have made in '''Tools -> Source Control Repositories...'''.
number of the current column number (where the caret is placed) in the
having focus IDE text editor. It is always <span class=code-span>0</span>,
if a non-text editor is the currently active editor.</p></li>


<li class=kadov-p
If the file name is c:\xxx\yyy\zzz\aaa.pro and you have defined a repository RRR with Directory c:\xxx\yyy then these variables will get the values:
class=kadov-p><span class=code-span>$(repository)</span> – is the
<vip>$(repository) = RRR
repository path, which can be used for a source control system</li>
$(scfile) = $/zzz/aaa.pro</vip>


<li class=kadov-p
Such values are suitable for defining the '''CheckOut''' command ('''Ctrl+1''') which the IDE will use for some operations if the file is read-only. (And of course if you press '''Ctrl+1''').
class=kadov-p><span class=code-span>$(password)</span> – is the
password, which can be used for a source control system</li>


<li class=kadov-p
The last variables from the list (i.e. <vp>$(password) $(user) $(host)</vp>) are partly nonsense. These are handy variables for use with the '''CheckOut''' command, but they are merely variables defined in '''Tools -> IDE Variables...'''.
class=kadov-p><span class=code-span>$(user)</span> – is the user
name, which can be used for a source control system</li>


<li class=kadov-p
Finally, the variable '''$(ProDir)''' represents the directory in which Visual Prolog is installed.
class=kadov-p><span class=code-span>$(scfile)</span> – is the file
name with path in the source control system</li>


<li class=kadov-p
=== How to 'Check In' a File in MS Visual Source Safe ===
class=kadov-p><span class=code-span>$(host)</span> – is the host
address, which can be used for a source control system</li>
</ul>


The tools works on the active file (e.g. in the active editor). <br />A <br />$(column) The column in which the caret is placed <br />$(line) The line number in which the caret is placed <br />$(file) File name <br />$(file:p) Path of the file name <br />$(file:n) Name of the file name <br />$(file:e) Extension of the file name <br />$(file:pn) Path and name <br />$(file:ne) Name and extension <br />$(file:pne) Path, Name and extension (same as $(file) ) <br />A  <br />These variables are for use with a source control system (e.g. SourceSafe, Vault, etc): <br />A  <br />$(repository) Source Control repository <br />$(scfile) Source Control file name
Let us, for example, discuss - how we can use parameters passed to command lines in a command file with which we can in MS Visual Source Safe (VSS) set "Check In" marker to a file opened in any IDE editor. We can do this with the following steps:


The values of these variable depends on the settings you have made in Tools -&gt; Source Control Repositories... If the file name is c:\xxx\yyy\zzz\aaa.pro and you have defined a repository RRR with Directory c:\xxx\yyy then these variables will get the values:
* Select the menu item '''Tools | Configure Tools''' to open the '''Tools''' dialog.
 
* Select a not used command, for instance 2, and as '''Name''' type in '''Check In'''.
$(repository) = RRR <br />$(scfile) = $/zzz/aaa.pro
* Now into the filed '''Command Line''' type in a command like this:
 
<vipbnf>C:\Visual Prolog 6\Check_In.cmd</vipbnf>
Such values are suitable for defining the CheckOut command (Ctrl-1) which the IDE will use for some operations if the file is read-only. (And of course if you press Ctrl-1).
 
The last variables from the list (i.e. $(password) $(user) $(host)) are partly nonsense. These are handy variables for use with the CheckOut command, but they are merely variables defined in Tools -&gt; IDE Variables....
 
Finally, the variable $(ProDir) represents the directory in which Visual Prolog is installed.
 
== How to 'Check In' a File in MS Visual Source Safe ==
 
<br />Let us, for example, discuss - how we can use parameters passed to command lines in a command file with which we can in MS Visual Source Safe (VSS) set "Check In" marker to a file opened in any IDE editor. We can do this with the following steps:
 
* Select the menu item <span>'''Tools | Configure Tools'''</span> to open the <span>'''Tools'''</span> dialog.
* Select a not used command, for instance 2, and as <span>'''Name'''</span> type in <span class="code-span">"Check In"</span>.
* Now into the filed <span>'''Command Line'''</span> type in a command like this:
 
 
C:\Visual Prolog 6\Check_In.cmd


and attributes
and attributes
 
<vipbnf>$(file) $(file:p) $(file:ne) $(line) $(column) $(repository) $(scfile)</vipbnf>
 
$(file) $(file:p) $(file:ne) $(line) $(column) $(repository) $(scfile)


* The file '''Check_In.cmd''' should contain code like this:
* The file '''Check_In.cmd''' should contain code like this:
<vipbnf>setlocal
set ssexe="v:\win32\SS.EXE"
set ssdir=v:\VIP6
cd "%2"
"%ssexe%" Checkin "%3" -I-
endlocal</vipbnf>


This code contains Visual Source Safe command line options, which we will not discuss here, but this command file also uses parameters:


setlocal set ssexe="v:\win32\SS.EXE" set ssdir=v:\VIP6 cd %2 %ssexe% Checkin %3 -I- endlocal
* <vp>$(file:p)</vp> to get "a path to the file opened in the having focus IDE editor" and
* <vp>$(file:ne)</vp> to get "the filename (with a filename extension) of this file"


This code contains Visual Source Safe command line options, which we will not discuss here, but this command file also uses parameters:
Now you can open a file (stored in a Visual Source Safe database) in an appropriate IDE editor (for example, in the '''IDE Designer''') and press the hot key '''Ctrl+2''' (or select the '''Tools | VSS Check In''' menu command). This will execute the '''Check_In.cmd''' file, which will "'''Check In'''" the opened file. This operation will copy your changes into the VSS database, creating a new version of the file containing the dialog description in VSS database. When other users use the '''Get Latest Version''' command or "'''Check out'''" the file, they receive all modifications you have made in this dialog.


#* <span class="code-span">$(file:p)</span> to get "a path to the file opened in the having focus IDE editor" and
=== How to 'Check Out' a File in Vault ===
#* <span class="code-span">$(file:ne)</span> to get "the filename (with a filename extension) of this file"


Now you can open a file (stored in a Visual Source Safe database) in an appropriate IDE editor (for example, in the '''IDE Designer''') and press the hot key <span>'''Ctrl 2'''</span> (or select the <span>'''Tools | VSS Check In'''</span> menu command). This will execute the <span class="code-span">Check_In.cmd</span> file, which will "<span>'''Check In'''</span>" the opened file. This operation will copy your changes into the VSS database, creating a new version of the file containing the dialog description in VSS database. When other users use the <span>'''Get Latest Version'''</span> command or "Check out" the file, they receive all modifications you have made in this dialog. <br />
Let us discuss how to '''Check Out''' a file opened in some IDE editor into the Vault repository (database).


== How to 'Check Out' a File in Vault ==
Like in the previous paragraph we should:
 
<br />Let us discuss how to <span>'''Check Out'''</span> a file opened in some IDE editor into the Vault repository (database). <br />Like in the previous paragraph we should:


* Create a command file activating Vault, forming and executing correspondent Vault command to the edited file.
* Create a command file activating Vault, forming and executing correspondent Vault command to the edited file.
* Add the call to this command file into the list of IDE commands.
* Add the call to this command file into the list of IDE commands.


For example, you can add a command activating this command file like these: <br />[[Image:Tools.png]]
For example, you can add a command activating this command file like these:  
 
[[Image:Ide_Tools.png]]


<br />Then the <span>'''Tools'''</span> sub-menu will look like this:
Then the '''Tools''' sub-menu will look like this:


[[Image:tools_menu.png]]
[[Image:Ide_Tools_menu.png]]


Now if a file is opened in some IDE editor, then you can apply to it Vault's <span>'''Check Out '''</span>command simply pressing the <span>'''Ctrl 1 '''</span>hot key (or with the <span>'''Tools | Check Out'''</span> menu commands). <br />Let us shortly discuss contents of the <span class="code-span">Check_Out.cmd</span><span>''' '''</span>batch file. But first we should set the attributes:
Now if a file is opened in some IDE editor, then you can apply to it Vault's '''Check Out''' command simply pressing the '''Ctrl+1''' hot key (or with the '''Tools | Check Out''' menu commands).


$(scfile) $(repository) $(password) $(user) $(host)
Let us shortly discuss contents of the '''Check_Out.cmd''' batch file. But first we should set the attributes:
<vipbnf>$(scfile) $(repository) $(password) $(user) $(host)</vipbnf>


What commands can be in the <span class="code-span">Check_Out.cmd</span> file:
What commands can be in the '''Check_Out.cmd''' file:
<vipbnf>set USER=%4
set PW=%3
set HOST=%5
set REPOSITORY=%1
set LOGIN=-user "%USER%" -password "%PW%" -host "%HOST%" -repository "%REPOSITORY%"
set HOME=C:\Program Files\SourceGear\Vault Client
set CMD="%HOME%\vault.exe" "%LOGIN%"
"%CMD%" checkout %1 </vipbnf>


Here first lines prepare the '''LOGIN''' command, which will be passed to the Vault command line executable. These lines is rather simple and do not require additional explanations.


set USER=%4 set PW=%3 set HOST=%5 set REPOSITORY=%1 set LOGIN=-user "%USER%" -password "%PW%" -host "%HOST%" -repository "%REPOSITORY%" set HOME=C:\Program Files\SourceGear\Vault Client set CMD="%HOME%\vault.exe" %LOGIN% %CMD% checkout %1
The next two lines prepare the '''CMD''' command, which will be used to call the command line version of the Vault client application '''vault.exe''' and pass to it the '''LOGIN''' parameters with which it will connect to the Vault server.


Here first lines prepare the <span class="code-span">LOGIN </span>A command, which will be passed to the Vault command line executable. These lines is rather simple and do not require additional explanations. <br />The next two lines prepare the <span class="code-span">CMD</span> command, which will be used to call the command line version of the Vault client application <span class="code-span">vault.exe</span> and pass to it the <span class="code-span">LOGIN</span> parameters with which it will connect to the Vault server. <br />And the last line is the real <span class="code-span">checkout</span> Vault command, which check out the specified file. For more information about Vault command line parameters use Vault help.
And the last line is the real '''checkout''' Vault command, which check out the specified file. For more information about Vault command line parameters use Vault help.

Latest revision as of 11:52, 4 April 2013

IDE

How to Add Calls of Other Applications

The Tools | Configure Tools command opens the Tools dialog. In this dialog you can assign 10 commands that will be executed when you pressing the hot keys from Ctrl+1 till Ctrl+0. These commands can be executed onto a file opened in any having focus IDE editor (in the IDE text editor and in the IDE resource editors).

How to Invoke a Command

For example, you can assign to the hot key Ctrl+3 a command line, which will invoke a command to switch off read only attribute from a file opened in the having focus IDE text editor. To do this one should select in the Tools dialog the line with Ctrl+3 hotkey, type in into the Command Line field a command line that should be executed on pressing the Ctrl+3 hot key. (Otherwise, you can find a file to be executed using the Browse button.) For example, you can specify:

attrib

and the attributes should be:

-r $(file)

Then type into the Name: field a short name you wish to use to the command, for instance, TmpWritable.

Now clicking the Tools menu item you will see that the new sub-menu item TmpWritable Ctrl+3 appears. So you can call the inserted command by both pressing onto the hot key Ctrl+3 and by selecting this new sub-menu command Tools | TextPad.

Command Line Syntax

Notice that in the Command Line you should not surround a filename to be executed with the quotation marks, the IDE makes this automatically. However, you should surround a filename to be executed with quotation marks (if the filename contains blank characters) when you use it inside a command file. Also notice that the IDE passes the following parameters to the specified command line:

  • $(file:pne) – is the full filename (with the path and the filename extension) of the file opened in the having focus IDE editor.
  • $(file:p) – is the full path of the filename (i.e. without the filename) of the file opened in the having focus IDE editor.
  • $(file:n) – is the filename without the path and without the extension of the file opened in the having focus IDE editor.
  • $(file:e) – is the filename extension without the path of the file opened in the having focus IDE editor.
  • $(file:ne) – is the short filename without the path of the file opened in the having focus IDE editor.
  • $(file:pn) – is the full filename without the extension of the file opened in the having focus IDE editor.
  • $(file) – is the full filename (with the path and the filename extension) of the file opened in the having focus IDE editor.
  • $(line) – is the number of the current line (where the caret is placed) in the having focus IDE text editor. It is always 0, if a non-text editor is the currently active editor.
  • $(column) – is the number of the current column number (where the caret is placed) in the having focus IDE text editor. It is always 0, if a non-text editor is the currently active editor.
  • $(repository) – is the repository path, which can be used for a source control system
  • $(password) – is the password, which can be used for a source control system
  • $(user) – is the user name, which can be used for a source control system
  • $(scfile) – is the file name with path in the source control system
  • $(host) – is the host address, which can be used for a source control system


The tools works on the active file (e.g. in the active editor).

$(column) The column in which the caret is placed
$(line) The line number in which the caret is placed
$(file) File name
$(file:p) Path of the file name
$(file:n) Name of the file name
$(file:e) Extension of the file name
$(file:pn) Path and name
$(file:ne) Name and extension
$(file:pne) Path, Name and extension (same as $(file) )


These variables are for use with a source control system (e.g. SourceSafe, Vault, etc):

$(repository) Source Control repository
$(scfile) Source Control file name

The values of these variable depends on the settings you have made in Tools -> Source Control Repositories....

If the file name is c:\xxx\yyy\zzz\aaa.pro and you have defined a repository RRR with Directory c:\xxx\yyy then these variables will get the values:

$(repository) = RRR
$(scfile) = $/zzz/aaa.pro

Such values are suitable for defining the CheckOut command (Ctrl+1) which the IDE will use for some operations if the file is read-only. (And of course if you press Ctrl+1).

The last variables from the list (i.e. $(password) $(user) $(host)) are partly nonsense. These are handy variables for use with the CheckOut command, but they are merely variables defined in Tools -> IDE Variables....

Finally, the variable $(ProDir) represents the directory in which Visual Prolog is installed.

How to 'Check In' a File in MS Visual Source Safe

Let us, for example, discuss - how we can use parameters passed to command lines in a command file with which we can in MS Visual Source Safe (VSS) set "Check In" marker to a file opened in any IDE editor. We can do this with the following steps:

  • Select the menu item Tools | Configure Tools to open the Tools dialog.
  • Select a not used command, for instance 2, and as Name type in Check In.
  • Now into the filed Command Line type in a command like this:
C:\Visual Prolog 6\Check_In.cmd

and attributes

$(file) $(file:p) $(file:ne) $(line) $(column) $(repository) $(scfile)
  • The file Check_In.cmd should contain code like this:
setlocal
set ssexe="v:\win32\SS.EXE"
set ssdir=v:\VIP6
cd "%2"
"%ssexe%" Checkin "%3" -I-
endlocal

This code contains Visual Source Safe command line options, which we will not discuss here, but this command file also uses parameters:

  • $(file:p) to get "a path to the file opened in the having focus IDE editor" and
  • $(file:ne) to get "the filename (with a filename extension) of this file"

Now you can open a file (stored in a Visual Source Safe database) in an appropriate IDE editor (for example, in the IDE Designer) and press the hot key Ctrl+2 (or select the Tools | VSS Check In menu command). This will execute the Check_In.cmd file, which will "Check In" the opened file. This operation will copy your changes into the VSS database, creating a new version of the file containing the dialog description in VSS database. When other users use the Get Latest Version command or "Check out" the file, they receive all modifications you have made in this dialog.

How to 'Check Out' a File in Vault

Let us discuss how to Check Out a file opened in some IDE editor into the Vault repository (database).

Like in the previous paragraph we should:

  • Create a command file activating Vault, forming and executing correspondent Vault command to the edited file.
  • Add the call to this command file into the list of IDE commands.

For example, you can add a command activating this command file like these:

Ide Tools.png

Then the Tools sub-menu will look like this:

Ide Tools menu.png

Now if a file is opened in some IDE editor, then you can apply to it Vault's Check Out command simply pressing the Ctrl+1 hot key (or with the Tools | Check Out menu commands).

Let us shortly discuss contents of the Check_Out.cmd batch file. But first we should set the attributes:

$(scfile) $(repository) $(password) $(user) $(host)

What commands can be in the Check_Out.cmd file:

set USER=%4
set PW=%3
set HOST=%5
set REPOSITORY=%1
set LOGIN=-user "%USER%" -password "%PW%" -host "%HOST%" -repository "%REPOSITORY%"
set HOME=C:\Program Files\SourceGear\Vault Client
set CMD="%HOME%\vault.exe" "%LOGIN%"
"%CMD%" checkout %1

Here first lines prepare the LOGIN command, which will be passed to the Vault command line executable. These lines is rather simple and do not require additional explanations.

The next two lines prepare the CMD command, which will be used to call the command line version of the Vault client application vault.exe and pass to it the LOGIN parameters with which it will connect to the Vault server.

And the last line is the real checkout Vault command, which check out the specified file. For more information about Vault command line parameters use Vault help.