Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. open "Example" for text as #1
  2.  
  3. filedialog "Open manifest file", "manifest.json", fileName$
  4.  
  5. if fileName$ <> "" then
  6.     open fileName$ for input as #g
  7.     txt$ = input$(#g, lof(#g))
  8.     close #g
  9.     print #1, txt$
  10.     print #1, "Images/theme_frame : " + getPath$(fileName$) + replacePathSeperator$(getString$("theme_frame","images",txt$))
  11.     print #1, "Name : " + getString$("name","",txt$)
  12.     print #1, "Colors/frame : " + getArray$("frame","colors",txt$)
  13.     input "Press 'Return'"; r$
  14. end if
  15.  
  16. close #1
  17.  
  18. end
  19.  
  20.  
  21.  
  22. function getString$(value$,section$,string$)
  23.     getString$=""
  24.     start=0
  25.     stringend=LEN(string$)
  26.     if section$<>"" then
  27.         start = INSTR(string$,chr$(34)+section$+chr$(34),0)+LEN(section$)+2
  28.         if start>0 then stringend = INSTR(string$,"},",start)
  29.     end if
  30.     start=INSTR(string$,chr$(34)+value$+chr$(34),start)+LEN(value$)+2
  31.     if (start>0) AND (start<stringend) then
  32.         start=INSTR(string$,chr$(34),start)+1
  33.         stringend=INSTR(string$,chr$(34),start)
  34.         getString$=MID$(string$, start, stringend-start)
  35.     end if
  36. end function
  37.  
  38. function getArray$(value$,section$,string$)
  39.     getString$=""
  40.     start=0
  41.     stringend=LEN(string$)
  42.     if section$<>"" then
  43.         start = INSTR(string$,chr$(34)+section$+chr$(34),0)+LEN(section$)+2
  44.         if start>0 then stringend = INSTR(string$,"},",start)
  45.     end if
  46.     start=INSTR(string$,chr$(34)+value$+chr$(34),start)+LEN(value$)+2
  47.     if (start>0) AND (start<stringend) then
  48.         start=INSTR(string$,"[",start)+1
  49.         stringend=INSTR(string$,"]",start)
  50.         getArray$=TRIM$(MID$(string$, start, stringend-start))
  51.     end if
  52. end function
  53.  
  54. function getPath$(fullpath$)
  55. pathEnd=0
  56. location=1
  57. while location<>0
  58. location=INSTR(fullpath$,"\",location+1)
  59. if location<>0 then pathEnd=location
  60. wend
  61. getPath$=MID$(fullpath$, 1, pathEnd)
  62. end function
  63.  
  64. function replacePathSeperator$(fullpath$)
  65. pathEnd=0
  66. location=1
  67. finalstring$=""
  68. while location<>0
  69. location=INSTR(fullpath$,"/",location+1)
  70. if location<>0 then finalstring$=finalstring$+MID$(fullpath$, lastpos+1, location-1)+"\"
  71. if location<>0 then lastpos=location
  72. wend
  73. replacePathSeperator$ = finalstring$ + MID$(fullpath$, lastpos+1)
  74. end function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement