这个操作上更省时间 把很是直接进行转换 到我的库中 主要是用了打开文件进行储存,
--我现在的这种读取方式,难免有时候有些东西加入两边,
macroScript gt_10_weiku
--enabledIn:#("max", "viz") --pfb: 2003.12.12 added product switch
category:"盖天工具"
--internalCategory: "UVW Unwrap" --do not localize
toolTip:"转函数库"
--silentErrors:TRUE
buttontext:"转函数库"
(
---进行了省时间的操作
try (DestroyDialog zhuan_text)catch ()
rollout zhuan_text "转字符为库"
(
button btn1 "转为我用" width:137 height:50
spinner ui "最大行数" range:[0,99999999,2] type:#integer fieldWidth:80
local kl
on btn1 pressed do
(
try(
--while not eof std_oo do
for o = 1 to ui.value do
(
local opo = readLine std_oo
coun= filterString opo " "
if coun.count>1 then
(
kl= ""
for i in coun do
(
kl+=i
kl+="*"
)
format "%\n" kl to:li
--print kl
)else if coun.count==1 then
(
format "%\n" coun[1] to:li
)
)
)catch (messageBox "你给的行数不够 或太多。")
)
on zhuan_text open do
(
try (
global filePath,std_oo
filePath = getDir #maxRoot + @"\ce.api"
std_oo=openFile filePath
----输到新文件中。
global lingshi ,li
lingshi = getDir #maxRoot + @"\mytools.api"
if not doesFileExist lingshi then
(
createFile lingshi
)
if getFileAttribute lingshi #readOnly then
(
setFileAttribute lingshi #readOnly false
)
li = openFile lingshi mode:"a+" ---现在的问题是卡开后不能网上面加加入啊
--li= fopen lingshi "w+"
--li = createfile lingshi
)catch (messageBox "配置文件不全")
)
on zhuan_text close do
(
try (
close std_oo
close li
)catch ()
)
)
CreateDialog zhuan_text 162 80 mouse.screenpos.x (mouse.screenpos.y+20)
--SetDialogPos zhuan_text mouse.screenpos
--filePath = getDir #maxRoot + @"\maxscript.api"
)
----
-----下面这个加入了同类进行操作 很好的解决了 要是加入多了 有重复的。
macroScript gt_10_weiku
--enabledIn:#("max", "viz") --pfb: 2003.12.12 added product switch
category:"盖天工具"
--internalCategory: "UVW Unwrap" --do not localize
toolTip:"转函数库"
--silentErrors:TRUE
buttontext:"转函数库"
(
---进行了省时间的操作
global zhuan_text , gt_10_ku_shouji = #()
try (DestroyDialog zhuan_text)catch ()
rollout zhuan_text "转字符为库"
(
button btn1 "转为我用" width:137 height:50
--spinner ui "最大行数" range:[0,99999999,2] type:#integer fieldWidth:80
local kl
on btn1 pressed do
(
try(
---先收集东西 mytools 里面的因素便于比较。
for i in 1 to 99999999999 do
(
try ( opoo = readLine li) catch (opoo="bbb")
if opoo !="bbb" then
(
append gt_10_ku_shouji opoo
)else
(
close li
exit
)
)
li = openFile lingshi mode:"a+"
--while not eof std_oo do
for o in 1 to 9999999 do
(
try (opo = readLine std_oo) catch (opo="cuoru")
--print "111111111111111"
if opo=="cuoru" then (gt_10_ku_shouji=#();exit ;)
coun= filterString opo " "
if coun.count>1 then
(
kl= ""
for i in coun do
(
kl+=i
kl+="*"
)
if findItem gt_10_ku_shouji kl ==0 then
(
format "%\n" kl to:li
)
--print kl
)else if coun.count==1 then
(
if findItem gt_10_ku_shouji kl ==0 then
(
format "%\n" coun[1] to:li
)
)
)
--
)catch (messageBox "你给的行数不够 或太多。")
)
on zhuan_text open do
(
try (
close std_oo
close li
)catch ()
try (
global filePath,std_oo
filePath = getDir #maxRoot + @"\ce.api"
std_oo=openFile filePath
----输到新文件中。
global lingshi ,li
lingshi = getDir #maxRoot + @"\mytools.api" --mytools
if not doesFileExist lingshi then
(
createFile lingshi
)
if getFileAttribute lingshi #readOnly then
(
setFileAttribute lingshi #readOnly false
)
li = openFile lingshi mode:"a+" ---现在的问题是卡开后不能网上面加加入啊
--li= fopen lingshi "w+"
--li = createfile lingshi
)catch (messageBox "配置文件不全")
)
on zhuan_text close do
(
try (
close std_oo
close li
)catch ()
)
)
CreateDialog zhuan_text 162 80 mouse.screenpos.x (mouse.screenpos.y+20)
--SetDialogPos zhuan_text mouse.screenpos
--filePath = getDir #maxRoot + @"\maxscript.api"
)
----加入了按钮隐藏功能 这个直角你做一此
macroScript gt_10_weiku
--enabledIn:#("max", "viz") --pfb: 2003.12.12 added product switch
category:"盖天工具"
--internalCategory: "UVW Unwrap" --do not localize
toolTip:"转函数库"
--silentErrors:TRUE
buttontext:"转函数库"
(
---后来检查出来问题 有用执行一次后 可能就清空我的数组来,这个时候可能家入第二次 所以我做成就点一次。
---进行了省时间的操作
global zhuan_text , gt_10_ku_shouji = #() ,gt_jiu_yicijiuguiling=0
try (DestroyDialog zhuan_text)catch ()
rollout zhuan_text "转字符为库"
(
button btn1 "转为我用" width:137 height:50
--spinner ui "最大行数" range:[0,99999999,2] type:#integer fieldWidth:80
local kl
on btn1 pressed do
(
gt_jiu_yicijiuguiling+=1
try(
---先收集东西 mytools 里面的因素便于比较。
for i in 1 to 99999999999 do
(
try ( opoo = readLine li) catch (opoo="bbb")
if opoo !="bbb" then
(
append gt_10_ku_shouji opoo
)else
(
close li
exit
)
)
li = openFile lingshi mode:"a+"
--while not eof std_oo do
for o in 1 to 9999999 do
(
try (opo = readLine std_oo) catch (opo="cuoru")
--print "111111111111111"
if opo=="cuoru" then (gt_10_ku_shouji=#();exit ;)
coun= filterString opo " "
if coun.count>1 then
(
kl= ""
for i in coun do
(
kl+=i
kl+="*"
)
if findItem gt_10_ku_shouji kl ==0 then
(
format "%\n" kl to:li
)
--print kl
)else if coun.count==1 then
(
if findItem gt_10_ku_shouji coun[1] ==0 then
(
format "%\n" coun[1] to:li
)
)
)
--
)catch (messageBox "你给的行数不够 或太多。")
if gt_jiu_yicijiuguiling ==1 then
(
zhuan_text.btn1.visible =false
)
)
on zhuan_text open do
(
try (
close std_oo
close li
)catch ()
try (
global filePath,std_oo
filePath = getDir #maxRoot + @"\ce.api"
std_oo=openFile filePath
----输到新文件中。
global lingshi ,li
lingshi = getDir #maxRoot + @"\mytools.api" --mytools
if not doesFileExist lingshi then
(
createFile lingshi
)
if getFileAttribute lingshi #readOnly then
(
setFileAttribute lingshi #readOnly false
)
li = openFile lingshi mode:"a+" ---现在的问题是卡开后不能网上面加加入啊
--li= fopen lingshi "w+"
--li = createfile lingshi
)catch (messageBox "配置文件不全")
)
on zhuan_text close do
(
try (
close std_oo
close li
)catch ()
)
)
CreateDialog zhuan_text 162 80 mouse.screenpos.x (mouse.screenpos.y+20)
--SetDialogPos zhuan_text mouse.screenpos
--filePath = getDir #maxRoot + @"\maxscript.api"
)
-----又进行了修改明白了 要是在界面中的汗水, 在打开事件中总是不好用, 这个要注意了
---- 如皋要是全局时间久方法哦最顶上, 如果2要是单击时间久写成函数 放到 单击中就好‘
macroScript gt_10_weiku
--enabledIn:#("max", "viz") --pfb: 2003.12.12 added product switch
category:"盖天工具"
--internalCategory: "UVW Unwrap" --do not localize
toolTip:"转函数库"
--silentErrors:TRUE
buttontext:"转函数库"
(
---后来检查出来问题 有用执行一次后 可能就清空我的数组来,这个时候可能家入第二次 所以我做成就点一次。
---进行了省时间的操作
global zhuan_text , gt_10_ku_shouji = #() ,gt_jiu_yicijiuguiling=0
global filePath,std_oo
try (DestroyDialog zhuan_text)catch ()
rollout zhuan_text "转字符为库"
(
button btn1 "转为我用" width:137 height:50
--spinner ui "最大行数" range:[0,99999999,2] type:#integer fieldWidth:80
local kl
fn linshi_nei =
(
try (
global filePath,std_oo
filePath = getDir #maxRoot + @"\ce.api"
std_oo=openFile filePath
----输到新文件中。
global lingshi ,li
lingshi = getDir #maxRoot + @"\mytools.api" --mytools
if not doesFileExist lingshi then
(
createFile lingshi
)
if getFileAttribute lingshi #readOnly then
(
setFileAttribute lingshi #readOnly false
)
li = openFile lingshi mode:"a+" ---现在的问题是卡开后不能网上面加加入啊
--li= fopen lingshi "w+"
--li = createfile lingshi
)catch (messageBox "配置文件不全")
)
on btn1 pressed do
( linshi_nei()
gt_jiu_yicijiuguiling=0
gt_jiu_yicijiuguiling+=1
try(
---先收集东西 mytools 里面的因素便于比较。
for i in 1 to 99999999999 do
(
try ( opoo = readLine li) catch (opoo="bbb")
if opoo !="bbb" then
(
append gt_10_ku_shouji opoo
)else
(
try ( close li ) catch()
exit
)
)
li = openFile lingshi mode:"a+"
--while not eof std_oo do
for o in 1 to 9999999 do
(
try (opo = readLine std_oo) catch (opo="cuoru")
--print "111111111111111"
if opo=="cuoru" then (gt_10_ku_shouji=#();exit ;)
coun= filterString opo " "
if coun.count>1 then
(
kl= ""
for i in coun do
(
kl+=i
kl+="*"
)
if findItem gt_10_ku_shouji kl ==0 then
(
format "%\n" kl to:li
)
--print kl
)else if coun.count==1 then
(
if findItem gt_10_ku_shouji coun[1] ==0 then
(
format "%\n" coun[1] to:li
)
)
)
--
)catch (messageBox "你给的行数不够 或太多。")
if gt_jiu_yicijiuguiling ==1 then
(
zhuan_text.btn1.visible =false
try (
close std_oo
close li
)catch ()
try (DestroyDialog zhuan_text)catch ()
)
)
on zhuan_text open do
(
try (
close std_oo
close li
)catch ()
try (
global filePath,std_oo
filePath = getDir #maxRoot + @"\ce.api"
std_oo=openFile filePath
----输到新文件中。
global lingshi ,li
lingshi = getDir #maxRoot + @"\mytools.api" --mytools
if not doesFileExist lingshi then
(
createFile lingshi
)
if getFileAttribute lingshi #readOnly then
(
setFileAttribute lingshi #readOnly false
)
li = openFile lingshi mode:"a+" ---现在的问题是卡开后不能网上面加加入啊
--li= fopen lingshi "w+"
--li = createfile lingshi
)catch (messageBox "配置文件不全")
)
on zhuan_text close do
(
try (
close std_oo
close li
)catch ()
)
)
CreateDialog zhuan_text 162 80 mouse.screenpos.x (mouse.screenpos.y+20)
--SetDialogPos zhuan_text mouse.screenpos
--filePath = getDir #maxRoot + @"\maxscript.api"
)