Thanks Mozers. shell.dll seems promising but I have
some problem with it: shell.exec only accept double quoted string as its first
argument, however what I have (originally for os.execute) is a single quoted
string. When I pass this string into shell.exec, it simply tells me that the
file or command was not found.
To be more specific, let me assume that I wish to set some file as a master
file of a project, and tries to run compilation over the master file from any
buffer. I use the following script to do so:
require 'shell'
compiler='my_compiler_name'
props['master_file.set'] =
0
props['master_filename']=nil
props['master_dir']=nil
GTK = scite_GetProp('PLAT_GTK')
if GTK then slash = '/' else slash =
'\\' end
if GTK then cd_cmd = 'cd ' else cd_cmd = 'cd /D ' end
function toggle_masterfile()
if
tonumber(props['master_file.set'])==0
then
props['master_file.set'] =
1
props['master_filename']=props['FileNameExt']
props['master_dir']=props['FileDir']
output:append(props['master_dir']..slash..props['master_filename']..'
set as master file.\n')
else
props['master_file.set'] =
0
props['master_name']=nil
props['master_dir']=nil
output:append('Master
file unset successfully.\n')
end
end
function compile_masterfile()
if
tonumber(props['master_file.set'])==1
then
output:append('Compiling master file
'..props['master_filename']..'...please
wait\n')
cmd1=cd_cmd..props['master_dir']
cmd2=compiler..props['master_filename']
cmd=cmd1..'
&&
'..cmd2
os.execute(cmd)
-- print(shell.exec(cmd1,nil,true,true))
-- print(shell.exec(cmd2,nil,true,true))
output:append('Compilation
Finished')
end
end
The problem of using os.execute lies in that it pops a black cmd window and
prints all compilation messages in that window, so that when the compilation
process exits, no message is left for inspection. The problem with shell.exec is
simply that it cannot accept cmd1 and cmd2 as valid first argument. Wraping cmd1
and cmd2 with tostring doesn't help either. Any more help please?
2008-11-03
-----
Original Message -----
Sent:
2008-11-03, 01:41:48
Subject:
[scite] Re: Direct lua os.ececute output to output pane
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "scite-interest" group.
To post to this group, send email to scite-interest <at> googlegroups.com
To unsubscribe from this group, send email to scite-interest+unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/scite-interest?hl=en
-~----------~----~----~----~------~----~------~--~---