2014-05-09 60 views
0

我想添加代碼並將其追加到運行時。如何在運行時添加和追加代碼? - livecode

例子: 此代碼是在運行時添加代碼

on opencard 
     emptyvariable 
     ------------------------- 
     put "test" into TestV << This line 
    end opencard 

    command selectvdofile 
     answer file "Select Video file" 
     put it into fld "txt_namefile" 
     put it into namefile 
    end selectvdofile 

誰能告訴exmple代碼爲我後添加代碼在運行時

on opencard 
    emptyvariable 
end opencard 

command selectvdofile 
    answer file "Select Video file" 
    put it into fld "txt_namefile" 
    put it into namefile 
end selectvdofile 

此代碼之前?

回答

0

下面是一個例子。測試前最好保存你的堆棧!

on mouseUp 
    local tScript, tLine 

    put the script of card "MyCard" into tScript 
    put lineOffset("end opencard", tScript) into tLine 

    if tLine > 0 then 
    put format("put \"test\" into TestV") & LF before line tLine of tScript 
    set the script of card "MyCard" to tScript 
    end if 
end mouseUp 
+0

非常感謝! – KemChat