|
发表于 2014-9-23 11:19:02
|
显示全部楼层
本帖最后由 XYX365 于 2014-9-23 11:21 编辑
我已寫好一個skill,如下供參考
- axlCmdRegister( "cam clear" 'fnCamClear)
- procedure(fnCamClear()
- let((lDeleteFile tFile x tFileName)
- ;讀取目前工作目錄下的檔案為下列的檔案並刪除
- ;*.*,* *.log *.val *.tag *.tap *.art *.jrl *.out *.afa art_aper.txt art_param.txt nc_param.txt
- lDeleteFile = nil ;存放要刪除的檔案名稱
- foreach(tFile setof(x getDirFiles(getWorkingDir()) fnCheckFile(x))
- lDeleteFile = cons(tFile lDeleteFile)
- )
- when(lDeleteFile
- foreach(tFile lDeleteFile
- tFileName = strcat(getWorkingDir() "/" tFile)
- when(isFile(tFileName) && isReadable(tFileName)
- deleteFile(tFileName)
- )
- )
- )
- ;printf("\n###On current directory *,* *,log *.val *.tag *.tap *.art *.jrl \n")
- ;printf("###nc_param.txt art_param.txt art_aper.txt *.out *.afa\n###CLEAR is finished ====\n")
- )
- )
- ;此函數的功能是判斷檔案tFileName是否為下列 ,如果是就傳回 t 否則傳回 nil
- ;*.*,* *.log *.val *.tag *.tap *.art *.jrl *.out *.afa art_aper.txt art_param.txt nc_param.txt
- procedure(fnCheckFile(tFileName)
- prog((lCheckSuffix lCheckFile lString tSuffix lResult x)
-
- lCheckSuffix = list("afa" "art" "jrl" "log" "out" "tag" "tap" "val" "txt")
- lCheckFile = list("art_aper.txt" "art_param.txt" "nc_param.txt")
-
- if(stringp(tFileName) then
- tFileName = lowerCase(tFileName)
- ;判斷檔案名稱只要有 , 就傳回 t
- when(rexMatchp("," tFileName)
- return(t)
- )
- when(tFileName == "allegro.jrl" ;此檔案在Allegro執行中是不能刪除的,
- return(nil)
- )
- lString = parseString(tFileName ".")
- if(lString then
- tSuffix = cadr(lString)
- lResult = setof(x lCheckSuffix (x == tSuffix)) ;過濾後綴名稱有一樣
- if(lResult then
- when(car(lResult) == "txt"
- lResult = setof(x lCheckFile (x == tFileName)) ;過濾檔案名稱有一樣
- )
- if(lResult then
- return(t)
- else
- return(nil)
- )
- else
- return(nil)
- )
- else
- return(nil)
- )
- else
- return(nil)
- )
- )
- )
复制代码 |
评分
-
查看全部评分
|