级别: 工作组
- 注册时间:
- 2005-05-03
- 在线时间:
- 0小时
- 发帖:
- 2914
|
试试看这段代码 拿去编译,自动获取剪贴板里面的时间信息并粘贴到窗口中的程序 我这里现在发文件不够方便,自己拿去编译 PureBasic 4.00源代码: - Enumeration
- #Win
- #file
- #file2
- #menu
- #msave
- #mopen
- #mexport
- #mimport
- #mrun
- #mtop
- #list
- EndEnumeration
- Procedure gettime(aa.l)
- While 1=1
- If GetMenuItemState(#menu,#mrun)=1
- ct.s=GetClipboardText()
- If Not(ct.s="") And GetMenuItemState(#menu,#mrun)=1
- SetClipboardText("")
- ln=GetGadgetState(#list)
- ctp.s="0:"+Trim(Mid(ct.s,1,Len(ct.s)-1))
- If Not (ln=-1)
- SetGadgetItemText(#list,ln,ctp.s,0)
- EndIf
- If Not (GetGadgetState(#list)=CountGadgetItems(#list)-1)
- SetGadgetState(#list,ln+1)
- EndIf
- EndIf
- EndIf
- Delay(10)
- Wend
- EndProcedure
- OpenWindow(#win,0,0,530,150,"Audition Sub")
- CreateMenu(#menu,WindowID(#win))
- MenuTitle("Main")
- MenuItem(#mopen,"Open Project")
- MenuItem(#msave,"Save Project")
- MenuItem(#mimport,"Import Text")
- MenuItem(#mexport,"Save as SSA...")
- MenuItem(#mrun,"Get")
- MenuItem(#mtop,"On top")
- SetMenuItemState(#menu,#mtop,1)
- StickyWindow(#win,1)
- CreateGadgetList(WindowID(#win))
- ListIconGadget(#list,0,0,530,130,"Start",100)
- AddGadgetColumn(#list,1,"Text",425)
-
- CreateThread(@gettime(),1)
- Repeat
- wid=WaitWindowEvent()
- If wid=#PB_Event_Menu
- Select EventMenu()
- Case #mopen
- fn.s=OpenFileRequester("Open","","*.csp|*.csp",0)
- If Not (fn.s="")
- OpenFile(#file,fn.s)
- While Not Eof(#file)
- AddGadgetItem(#list,-1,ReadString(#file)+Chr(10)+ReadString(#file))
- Wend
- CloseFile(#file)
- EndIf
- Case #msave
- fn.s=SaveFileRequester("Save","","*.csp|*.csp",0)
- If Not(fn.s="")
- CreateFile(#file,fn.s)
- For i=0 To CountGadgetItems(#list)-1
- WriteStringN(#file,GetGadgetItemText(#list,i,0)+Chr(10)+GetGadgetItemText(#list,i,1))
- Next
- CloseFile(#file)
- EndIf
- Case #mtop
- SetMenuItemState(#menu,#mtop,1-GetMenuItemState(#menu,#mtop))
- If GetMenuItemState(#menu,#mtop)=1
- StickyWindow(#win,1)
- Else
- StickyWindow(#win,0)
- EndIf
- Case #mrun
- SetMenuItemState(#menu,#mrun,1-GetMenuItemState(#menu,#mrun))
- Case #mimport
- fn.s=OpenFileRequester("Open","","*.txt|*.txt",0)
- If Not (fn.s="")
- OpenFile(#file,fn.s)
- ClearGadgetItemList(#list)
- While Not (Eof(#file))
- AddGadgetItem(#list,-1,Chr(10)+ReadString(#file))
- Wend
- SetGadgetState(#list,0)
- CloseFile(#file)
- EndIf
- Case #mexport
- fn.s=OpenFileRequester("Save As","","*.SSA|*.SSA",0)
- If Not(fn.s="")
- CreateFile(#file,fn.s)
- OpenFile(#file2,"head.txt")
- While Not (Eof(#file2))
- WriteStringN(#file,ReadString(#file2))
- Wend
- CloseFile(#file2)
- starttime.s=GetGadgetItemText(#list,i,0)
- text.s=GetGadgetItemText(#list,i,1)
- For i=1 To CountGadgetItems(#list)-1
- starttime2.s=GetGadgetItemText(#list,i,0)
- text2.s=GetGadgetItemText(#list,i,1)
- If Not (text.s="")
- prew.s="Dialogue: Marked=0,"+starttime.s+","+starttime2.s+",Default,,0000,0000,0000,,"+text.s
- EndIf
- WriteStringN(#file,prew.s)
- text.s=text2.s
- starttime.s=starttime2.s
- Next
- CloseFile(#file)
- EndIf
- EndSelect
- EndIf
- Until wid=#PB_Event_CloseWindow
还有一个文件,文件名叫做"head.txt",文件内容: - [Script Info]
- ScriptType: v4.00
- Collisions: Normal
- PlayResX: 640
- PlayResY: 480
- Timer: 100.0000
- [V4 Styles]
- Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
- Style: Default,simhei,24,&Hffffff,&H00ffff,&H444444,&H444444,-1,0,1,1,0,2,5,5,10,15,1
- [Events]
- Format: Marked, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
原理全部模仿MR大的某物……本程序适合配合按键精灵类似软件使用 顺便借这块地方问一下MR大,为什么我对CoolEdit的那个显示时间的框框进行sendmessage它不返回东西?对记事本等物(甚至开始菜单)都有返回东西……
|