Mira aqui te paso
lo que tenes de declarar
un scrip. (uso una funcion)
la funcion.. con los parametros
espero te ayude te comento que no se por que
pero en algunos sos por alli no sabe andar bien o algunos errores
Prueba si tienes problemas podemos probar otras alternativas
//Apagar Pc
function boolean InitiateSystemShutdownA(string lpMachineName, &
string lpMessage, long dwTimeout, boolean bForceAppsClosed, &
boolean bRebootAfterShutdown) library 'advapi32.dll' Alias for "InitiateSystemShutdownA;Ansi"
function long FormatMessageA(ulong dwflags, long lpsource, long dwmessageid, &
long dwlanguageid, ref string lpbuffer, long nsize, long lparguments) &
library 'kernel32.dll' alias for "FormatMessageA;Ansi"
//Error
function ulong GetLastError() library 'kernel32.dll'
Scrip
// Argumentos utilizados
//maquina
//mensage
//tiempo
//forceapp
//reboot
String PC
String Msg
Long Timer
Boolean Reboot
Boolean Kill
n_ja_infosys Sysinfo
Sysinfo = Create using "n_ja_infosys"
//Nombre del Equipo
If sysinfo.nombreequipo() = Maquina Then
SetNull(Pc)
Else
Pc = "\"+Maquina
End If
Msg = "Apagando"
If cbx_1.Checked = True Then
Kill = True
Else
Kill = False
End If
If cbx_2.Checked = True Then
Reboot = True
Else
Reboot = False
End If
If cbx_3.Checked = True Then
Sle_1.Visible = True
em_1.Visible = True
Msg = Trim(sle_1.Text)
Timer= Long(em_1.Text)
Else
Timer = 0
SetNull(Msg)
End If
Sysinfo.Shutdown(PC,Msg,Timer,Kill,Reboot)
Destroy SysInfo
Funcion
long ll_errorid
string ls_errortext
string ls_null
string ls_restart_message
//SetNull(ls_null) //null si es local, o "\MYPC"
//ls_restart_message='Su PC será reiniciado'
InitiateSystemShutdownA(f_pc,f_msg,f_timer,f_kill,f_reboot)
ll_errorid=GetLastError()
ls_errortext=Space(2000)
FormatMessageA(4096,0,ll_errorid,0,ls_errortext,Len(ls_errortext),0)
MessageBox('',ls_errortext)
f_pc f_msg String
f_timer Long
f_kill f_reboot Boolean