Difference between revisions of "Execute"

From Wiki
Jump to: navigation, search
(Write a many lines to a file at once)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{command header|Miscellaneous Commands}}
+
{{command header|Miscellaneous}}
  
 
{{body|execute {filename} [argument...]|The ''execute'' command executes an external command with the argunments given.}}
 
{{body|execute {filename} [argument...]|The ''execute'' command executes an external command with the argunments given.}}
 +
  
 
{{note|This command does NOT work unless you have enabled the "Allow Execute" configuration option.}}
 
{{note|This command does NOT work unless you have enabled the "Allow Execute" configuration option.}}
  
==== Example ====
+
 
 +
=== Examples ===
 +
= Example 1 : Script in Script=
 +
Running a script, from a script.
 
<pre>
 
<pre>
 
execute EasyUO.exe healthWatch.euo
 
execute EasyUO.exe healthWatch.euo
 +
</pre>
  
execute cmd.exe /c echo >>rail.txt move #charPosX #charPosY 0
+
= Example 2 : File Writing =
 +
For example purposes, assume the following:
 +
<pre>
 +
%task is move
 +
%guardzone is #false
 +
#charPosX is 4321
 +
#charPosY is 1234
 +
#charPosZ is 3
 +
%tileid is 7
 +
</pre>
 +
 
 +
=== Write line at a time to a file ===
 +
<pre>
 +
execute cmd.exe /c echo gosub railtask move %task %guardzone #charPosX #charPosY #charPosZ %tileid >>rail.txt
 +
</pre>
 +
 
 +
Makes a file named rail.txt that consists of:
 +
<pre>
 +
gosub railtask move 0 4321 1234 3 7
 +
</pre>
 +
 
 +
=== Write a many lines to a file at once ===
 +
The magic of cmd.exe! This only opens console window once, improves long write times dramatically. Windows 2000+ only: Maximum command in Win2000 is 4096, WinXP and Vista 8192
 +
 
 +
'''Do not press Enter anywhere on the execute line until the final ", it must be one solid line without line breaks.'''
 +
(The Wiki is limited in its ability to wrap code text.)
 +
 
 +
<pre>
 +
  for %counter 1 %endspot
 +
  {
 +
      execute cmd.exe /c "echo set % , RailStep %counter >> rail.txt && echo set % , Task , %counter %Task >> rail.txt && echo set % , Guardzone
 +
, %counter %GuardZone >> rail.txt && echo set % , SpotX , %counter #charPosX >> rail.txt && echo set % , SpotY , %counter #charPosY >> rail.txt && echo
 +
set % , SpotZ , %counter #charPosZ >> rail.txt && echo set % , TileID , %counter %TileID >> rail.txt" 
 +
  }
 +
</pre>
 +
 
 +
 
 +
EDIT on 23 jan 2008: You can break lines, though you must use the concatenation operator '+'
 +
as the first character on the "breaked lines":
 +
<pre>
 +
  for %counter 1 %endspot
 +
  {
 +
      execute cmd.exe /c "echo set % , RailStep %counter >> rail.txt && echo set % , Task , %counter %Task
 +
      + >> rail.txt && echo set % , Guardzone , %counter %GuardZone >> rail.txt && echo set % , SpotX , %counter
 +
      + #charPosX >> rail.txt && echo set % , SpotY , %counter #charPosY >> rail.txt && echo
 +
      + set % , SpotZ , %counter #charPosZ >> rail.txt && echo set % , TileID , %counter %TileID >> rail.txt" 
 +
  }
 +
</pre>
 +
 
 +
 
 +
Makes a file named rail.txt that consists of:
 +
<pre>
 +
set %RailStep 1
 +
set %Task1 move
 +
set %Guardzone1 0
 +
set %SpotX1 4321 
 +
set %SpotY1 1234 
 +
set %SpotZ1 3 
 +
set %TileID1 7
 
</pre>
 
</pre>
  
{{footer}}
+
== Related Commands ==
 +
{| style="background:gainsboro; color:black; border: 2px #aaa solid;"
 +
| Width=250px align=center | [[Terminate]] || Width=250px align=center | [[UoXL]]
 +
|}
 +
=See Also=
 +
{{Miscellaneous}}

Latest revision as of 08:53, 23 January 2008


Synopsis

execute {filename} [argument...]

Description

The execute command executes an external command with the argunments given.


Note: This command does NOT work unless you have enabled the "Allow Execute" configuration option.


Examples

Example 1 : Script in Script

Running a script, from a script.

execute EasyUO.exe healthWatch.euo

Example 2 : File Writing

For example purposes, assume the following:

%task is move
%guardzone is #false
#charPosX is 4321 
#charPosY is 1234
#charPosZ is 3
%tileid is 7

Write line at a time to a file

execute cmd.exe /c echo gosub railtask move %task %guardzone #charPosX #charPosY #charPosZ %tileid >>rail.txt

Makes a file named rail.txt that consists of:

gosub railtask move 0 4321 1234 3 7

Write a many lines to a file at once

The magic of cmd.exe! This only opens console window once, improves long write times dramatically. Windows 2000+ only: Maximum command in Win2000 is 4096, WinXP and Vista 8192

Do not press Enter anywhere on the execute line until the final ", it must be one solid line without line breaks. (The Wiki is limited in its ability to wrap code text.)

   for %counter 1 %endspot
   {
      execute cmd.exe /c "echo set % , RailStep %counter >> rail.txt && echo set % , Task , %counter %Task >> rail.txt && echo set % , Guardzone 
, %counter %GuardZone >> rail.txt && echo set % , SpotX , %counter #charPosX >> rail.txt && echo set % , SpotY , %counter #charPosY >> rail.txt && echo 
set % , SpotZ , %counter #charPosZ >> rail.txt && echo set % , TileID , %counter %TileID >> rail.txt"   
   }


EDIT on 23 jan 2008: You can break lines, though you must use the concatenation operator '+' as the first character on the "breaked lines":

   for %counter 1 %endspot
   {
      execute cmd.exe /c "echo set % , RailStep %counter >> rail.txt && echo set % , Task , %counter %Task
       + >> rail.txt && echo set % , Guardzone , %counter %GuardZone >> rail.txt && echo set % , SpotX , %counter
       + #charPosX >> rail.txt && echo set % , SpotY , %counter #charPosY >> rail.txt && echo
       + set % , SpotZ , %counter #charPosZ >> rail.txt && echo set % , TileID , %counter %TileID >> rail.txt"   
   }


Makes a file named rail.txt that consists of:

set %RailStep 1
set %Task1 move
set %Guardzone1 0
set %SpotX1 4321  
set %SpotY1 1234  
set %SpotZ1 3  
set %TileID1 7 

Related Commands

Terminate UoXL

See Also

Miscellaneous

  • Miscellaneous commands
display Shows a message
execute Executes an external program
linesPerCycle Sets the execution speed
set sets a variable to a value (variable assignment)
send Sends a HTTP request to a server and runs the code that is returned
shutDown Shuts your computer down
sound Plays a wave file or the SystemDefault beep
str performs a operation on a string
tile retrieves information about tiles