Difference between revisions of "System Module"

From SolarStrike wiki
Jump to: navigation, search
m (Protected "System Module" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
== rest() ==
+
== rest ==
 
'''system.rest(number msec)'''
 
'''system.rest(number msec)'''
  
Line 5: Line 5:
  
  
== exec() ==
+
== exec ==
'''string system.rest(string cmd)'''
+
'''string system.exec(string cmd)'''
  
 
Run the given command and return its output as a string.
 
Run the given command and return its output as a string.
  
  
== getClipboard() ==
+
== shellExec ==
 +
'''number system.shellExec(table execInfo)'''
 +
 
 +
Execute a system command or process when given a SHELLEXECUTEINFO structure [https://msdn.microsoft.com/en-us/library/windows/desktop/bb759784%28v=vs.85%29.aspx]. Returns the process ID to the newly started process.
 +
 
 +
'execInfo' should be a table of key/value pairs of only the values which you want to set. For example:
 +
<source lang="lua">
 +
local data = {lpVerb = 'open', lpFile = 'cmd', lpDirectory = 'C:\\'};
 +
local procId = system.shellExec(data);
 +
</source>
 +
 
 +
== getClipboard ==
 
'''string system.getClipboard()'''
 
'''string system.getClipboard()'''
  
Line 17: Line 28:
  
  
== setClipboard() ==
+
== setClipboard ==
'''boolean system.rest(string data)'''
+
'''boolean system.setClipboard(string data)'''
  
 
Sets the system's clipboard to 'data'.
 
Sets the system's clipboard to 'data'.
Line 24: Line 35:
  
  
== getActiveCodePage() ==
+
== getActiveCodePage ==
 
'''number system.getActiveCodePage()'''
 
'''number system.getActiveCodePage()'''
  
Line 30: Line 41:
  
  
== getConsoleCodePage() ==
+
== getConsoleCodePage ==
 
'''number system.getConsoleCodePage()'''
 
'''number system.getConsoleCodePage()'''
  
Line 36: Line 47:
  
  
== setPriority() ==
+
== setPriority ==
 
'''system.setPriority(string priority)'''
 
'''system.setPriority(string priority)'''
  
 
Change the process's priority. 'priority' should be "high", "low", or "normal" (default)
 
Change the process's priority. 'priority' should be "high", "low", or "normal" (default)
 
 
== getConsoleAttributes() ==
 
'''number winWidth, number winHeight, number buffWidth, number buffHeight, number cursorX, number cursorY system.getConsoleAttributes()'''
 
 
Returns a set of console attributes. Values are in characters, not pixels!
 
 
 
== setConsoleAttributes() ==
 
'''system.setConsoleAttributes(number windowWidth, number windowHeight, number bufferWidth, number bufferHeight)'''
 
 
Modify the console's attributes. Values should be in characters, not pixels.
 

Latest revision as of 03:44, 18 February 2015

rest

system.rest(number msec)

Put the process to sleep for 'msec' milliseconds.


exec

string system.exec(string cmd)

Run the given command and return its output as a string.


shellExec

number system.shellExec(table execInfo)

Execute a system command or process when given a SHELLEXECUTEINFO structure [1]. Returns the process ID to the newly started process.

'execInfo' should be a table of key/value pairs of only the values which you want to set. For example:

local data = {lpVerb = 'open', lpFile = 'cmd', lpDirectory = 'C:\\'};
local procId = system.shellExec(data);

getClipboard

string system.getClipboard()

Returns the system clipboard data as a string.


setClipboard

boolean system.setClipboard(string data)

Sets the system's clipboard to 'data'. Returns true on success, false on failure.


getActiveCodePage

number system.getActiveCodePage()

Returns the system's current code page as an integer.


getConsoleCodePage

number system.getConsoleCodePage()

Returns the console's current code page as an integer.


setPriority

system.setPriority(string priority)

Change the process's priority. 'priority' should be "high", "low", or "normal" (default)