Guest User

Untitled

a guest
Sep 18th, 2014
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.41 KB | None | 0 0
  1. SetBatchLines, -1
  2. FileSelectFolder, SelectedFolder
  3. if SelectedFolder =
  4. ExitApp
  5. Loop, %SelectedFolder%\*.XML, , 1
  6. {
  7. n = 0
  8. marker := ""
  9. Fileread, Memo, %A_LoopFileFullPath%
  10. SplitPath, A_LoopFileFullPath,, dir,, name_no_ext
  11. loop
  12. {
  13. if RegExMatch(Memo, "MemoID=""" n """>\s+<Offset>(.*?)</Offset>\s+.*?\s+(?:<Text>)?(.*?)(?:\s+)?</?Text/?>", found)
  14. {
  15. timecode := found1
  16. name := found2
  17. id := GenerateRandomString(8) "-" GenerateRandomString(4) "-" GenerateRandomString(4) "-" GenerateRandomString(4) "-" GenerateRandomString(12)
  18. marker%n% =
  19. (
  20. <rdf:li>
  21. <rdf:Description
  22. xmpDM:startTime="%timecode%"
  23. xmpDM:name="%name%">
  24. <xmpDM:cuePointParams>
  25. <rdf:Seq>
  26. <rdf:li
  27. xmpDM:key="marker_guid"
  28. xmpDM:value="%id%"/>
  29. </rdf:Seq>
  30. </xmpDM:cuePointParams>
  31. </rdf:Description>
  32. </rdf:li>
  33.  
  34. )
  35. marker .= marker%n%
  36. n++
  37. }
  38. else
  39. break
  40. }
  41. if n != 0
  42. {
  43. Filedelete, %dir%\%name_no_ext%.XMP
  44. Fileappend,
  45. (
  46. <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.5-c021 79.155241, 2013/11/25-21:10:40 ">
  47. <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
  48. <rdf:Description rdf:about=""
  49. xmlns:dc="http://purl.org/dc/elements/1.1/"
  50. xmlns:xmpDM="http://ns.adobe.com/xmp/1.0/DynamicMedia/"
  51. xmlns:stDim="http://ns.adobe.com/xap/1.0/sType/Dimensions#"
  52. xmlns:xmp="http://ns.adobe.com/xap/1.0/"
  53. xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/"
  54. xmlns:stEvt="http://ns.adobe.com/xap/1.0/sType/ResourceEvent#"
  55. xmlns:stRef="http://ns.adobe.com/xap/1.0/sType/ResourceRef#">
  56. <xmpDM:Tracks>
  57. <rdf:Bag>
  58. <rdf:li>
  59. <rdf:Description
  60. xmpDM:trackName="Comment"
  61. xmpDM:trackType="Comment"
  62. xmpDM:frameRate="f30000s1001">
  63. <xmpDM:markers>
  64. <rdf:Seq>%marker% </rdf:Seq>
  65. </xmpDM:markers>
  66. </rdf:Description>
  67. </rdf:li>
  68. </rdf:Bag>
  69. </xmpDM:Tracks>
  70. </rdf:Description>
  71. </rdf:RDF>
  72. </x:xmpmeta>
  73. ), %dir%\%name_no_ext%.XMP
  74. }
  75. }
  76. Msgbox, Done
  77.  
  78.  
  79. GenerateRandomString(length)
  80. {
  81. characters := "abcdefghijklmnopqurstuvwxyz0123456789"
  82. StringSplit, chars, characters
  83. Loop, %length%
  84. {
  85. Random, rand, 1, 36
  86. id .= chars%rand%
  87. }
  88. return id
  89. }
Advertisement
Add Comment
Please, Sign In to add comment