0

我在下面有这段代码可以完美运行。但是我想整合以下内容:

   if (marker_Type = "Comment")
                {marker_Type = "company 1"}
                else
                {marker_Type = "company 2"}

您可以在下面看到完整的部分

for(var current_marker = markers.getFirstMarker();
                current_marker !== undefined;
                current_marker = markers.getNextMarker(current_marker)){
                    count++;
                    var selectIn = current_marker.start.seconds;
                    mySeq.setInPoint(selectIn);
                    var getIn = mySeq.getInPoint();
                    var selectOut = current_marker.end.seconds;
                    mySeq.setOutPoint(selectOut);   
                    var getOut = mySeq.getOutPoint();
                    var marker_Name = current_marker.name;
                    var marker_Comments = current_marker.comments;


                    // marker_Type can either be "Comments" or "Chapter"
                    var marker_Type = current_marker.type;


                    logInfo((new Date).toString());
                    function logInfo(Txt){


                      if (marker_Type = "Comment")
                {marker_Type = "company 1"}
                else
                {marker_Type = "company 2"}


                    var file = new File(path1+sep1+"VID"+sequenceName+"MID"+count+"__"+marker_Name+"__"+marker_Type+".txt");
                    file.open("w");
                    file.writeln(marker_Comments+"|"+selectIn+"|"+selectOut);
                    file.close();
                    };

我试图让代码工作,但由于某种原因它不起作用?不太确定我做错了什么。

更新。

if
(marker_Type = "Comment")
{marker_Type = "company 1";}
else
(marker_Type = "Chapter")
{marker_Type = "company 2";}

我试过上面的代码只需要公司一,即使标记类型是章节。所以不是很短我在这里做错了。

你好,我也厌倦了这个:

如果

(marker_Type = "Comment")
{marker_Type = "company 1";}
else if
(marker_Type == "Chapter")
{marker_Type = "company 2";}
else
(marker_Type = "FLVCuePoint") 
{marker_Type = "company 3";}


alert(marker_Type);

但是,我总是得到相同的结果,即 Company 3

我也试过这个。

switch (marker_Type)
{
case "Comment":
marker_Type = "Company 1";
break;

case "Chapter":
marker_Type = "Company 2";
break;
}

我确定我做错了什么。

谢谢

4

1 回答 1

0

解决方案是使用有效的 switch 语句。

于 2020-06-11T19:04:22.600 回答