int net(computer password macro [retval] [a1 ...])
computer - name or IP address (e.g. "22.214.171.124") of the remote computer.
password - password that is required to run macros on the remote computer.
macro - name of a macro or function on remote computer.
retval - str variable that receives the return value of the macro. The macro can return a numeric or string value.
a1 ... - arguments for macro. It receives them through function statement.
Launches a macro or function on other computer in network. If retval is used, waits until the macro ends.
The return value is 0 or an error code:
|0||The macro was started successfully. If retval is used, the macro ran successfully, unless it was terminated by the user, in which case the retval variable is empty or "0".|
|1||Computer not found.|
|2||Could not connect. Possible reasons: The remote computer is not running; not connected to the network; QM is not running; QM does not allow to run macros from other computers (Options -> Network -> Allow ... is unchecked on remote computer); Firewall problems; Different port is specified; The port is in use; Problems with network connection (try to disable/enable or repair).|
|3||Password incorrect, or, if password is "", this macro is not allowed to run without a password.|
|4||Macro not found.|
|5||Could not start the macro. For example, it contains errors, or other macro is running.|
|6||Could not send arguments. The macro did not run.|
|7||Could not retrieve the return value. The macro ran successfully.|
|8||Run-time error in the macro.|
The _command variable of the macro that runs on the remote computer contains caller computer's IP address.
Initially, accessing QM from other computers is disabled. You can enable it in Options -> Network. You don't have to enable it on your computer if you only want to run macros on other computers (to use net).
You can see your computer's name and IP addresses in Options -> Network. You can change computer name in My Computer's Properties.
Both computers must use the same port. QM port number is displayed and can be changed in Options -> Network. Initially it is 8177. If it conflicts with other applications, etc, you can change it. Recommended values are between 5000 and 65000. If QM on remote computer uses different port, you can specify the port number in computer, using syntax computer:port, like "126.96.36.199:8178".
Although net normally is used in local network, it also can work on the Internet. But several problems exist, such as firewall and unknown IP.
If your Internet connection uses a firewall or other security features, QM may be inaccessible from the Internet or even from your network. You would have to configure a firewall to allow incoming connections on QM port. To configure Windows XP (prior to SP2) Internet Connection Firewall, right-click your connection in Control Panel -> Network Connections, click Properties, Advanced, Settings, Add, type QM as service description, enter your computer name or 127.0.0.1, and enter QM port. If you have Windows XP SP2 or later, it is done automatically if you click Unblock in the Windows Security Alert dialog when QM network features are enabled first time. If you click Keep Blocking, QM cannot be accessed from network too. You can configure firewall to allow accessing QM only from your network.
To identify a computer on the Internet, is used different IP address than in local network. You can see IP addresses in Options -> Network -> Computer Info. An IP can be static (computer always have the same IP) or dynamic (computer's IP changes).
To send a local macro to a remote computer, you can use the NetSendMacro function, which runs the NewItem function (same as newitem) on the remote computer. You can also send and receive files. See the examples.
net may be slow when using computer name. If you call it repeatedly, better use IP. To get IP of a computer, you can use function GetIpAddress (it is also slow but you call it only 1 time, and then multiple times call net with IP).
To control a remote computer visually, use Windows XP Remote Desktop or other remote control software.
See also: network setup, shared files, mac, sharing files and text between computers
run function NetworkMessage on computer John, and pass "Hello!" as argument net "John" "passw555" "NetworkMessage" 0 "Hello!" function NetworkMessage (on computer John) function $message mes message ______________________________________ get file from another computer int r str s r=net("188.8.131.52" "pppassw" "net_GetFile" s "$personal$\test.txt") if(r or !s.len) end "failed" ;;the remote macro net_GetFile did not run or did not return the requested file s.setfile("$personal$\test.txt") ;;save it on this computer function net_GetFile function'str $file_ str s.getfile(file_) ret s ______________________________________ send file to another computer int r str data.getfile("$personal$\test.txt") str sr r=net("184.108.40.206" "pppassw" "net_SetFile" sr "$personal$\test.txt" data) if(r or sr!="1") end "failed" ;;the remote macro net_SetFile did not run or did not return 1 function net_SetFile function# $file_ str'data data.setfile(file_) ret 1 ______________________________________ send and run function Function7 on Computer3 str c("Computer3") p("p765") m("Function7") if(NetSendMacro(c p m)) end "could not send" if(net(c p m)) end "could not launch" ______________________________________ This macro upgrades QM on several computers. str setupfile="$desktop$\quickmac.exe" ;;QM setup program. Macro will send and run it on each computer. str computers="computer1computer2computer3" ;;list of computers str password="passw" ;;assume, all computers use same password (Options -> Network) str cmdline="/silent" ;;install without the setup wizard, using the same settings as when installing last time str c sd.getfile(setupfile) int r str sm= function str'filedata $cmdline str temp="$temp qm$\quickmac.exe" filedata.setfile(temp) run temp cmdline foreach c computers r=net(c password "NewItem" 0 "NetUpgradeQm" sm "Function" "" "\User\Temp" 17) ;;send macro that receives and runs setup file if(!r) r=net(c password "NetUpgradeQm" 0 sd cmdline) ;;if ok, run the macro if(r) out "Cannot upgrade QM on %s (error %i)" c r else out "QM upgraded on %s" c