回复:SMTP看https://community.jmp.com/t5/Discussions/Bug-or-Feature/mp/673679#M86115 。
当它工作时,您会一直打开一个脚本窗口。 当失败时,不会打开任何窗口,并且 JMP 使用临时 eval 上下文,该上下文会在脚本结束时消失。
您也可以在脚本末尾使用一个循环来解决该问题,该循环等待运行程序完成,然后再允许脚本完成。 如果您希望在 runprogram 在后台运行时运行其他 JSL 或平台,那么这将不起作用,但大致如下:
RP=runprogram(...);
while(1,
// check the message names, there might be another one you need too
if(RP<<CANREAD></CANREAD>
这样,eval 上下文将持续存在,直到 runprogram 完成。
RunProgram 上下文已关闭 - SMTP大家好,
我尝试从 SMTP 服务器将附件发送给不同的人。
该脚本工作正常。
唯一的问题是,当我在脚本开头添加“!//”以便直接执行时,出现以下错误:

这是我使用的脚本:
//!
Names Default To Here( 1 );
// modifier le type de codage dans le PowerShell (windows)
stringCommand = "$OutputEncoding = [System.Text.Encoding]::UTF8";
// paramètres du mail à envoyer
commands = {
"Send-MailMessage -From '... -To '...' -Subject 'test' -Body 'test' -SmtpServer... -Attachment 'test...'",
"exit\!n"
};
// script exécution PowerShell
icommand = 0;
RP = Run Program(
Executable( "PowerShell.exe", stringCommand, ShowWindow("Hide") ),
ReadFunction( Function( {this}, Write( this << Read ) ) ),
WriteFunction(
Function( {this},
icommand++;
If( icommand <= N Items( commands ),
this << Write( commands[icommand] );
,
this << WriteEOF;
);
)
)
);
感谢您的帮助 !
自动化和脚本编写