Advertisement
xerpi

autorun and bookmarks

Jul 16th, 2011
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.46 KB | None | 0 0
  1. function get_bookmarks()
  2. local tab = {}
  3. local posi = 0
  4. local posf =0
  5. local pos2i = 0
  6. local pos2f =0
  7. local url = ""
  8. local name = ""
  9. local i =0
  10.     if files.exists("ms0:/PSP/SYSTEM/BROWSER/bookmarks.html") then
  11.             for linea in io.lines("ms0:/PSP/SYSTEM/BROWSER/bookmarks.html") do
  12.                 i = i+1
  13.                 a,b = string.find(linea,'HREF="')
  14.                 if a and b then
  15.                     posi=b+1
  16.                     c,d = string.find(linea,'"',posi+1)
  17.                     if c and d then
  18.                         posf =d-1
  19.                         url = string.sub(linea,posi,posf)
  20.                         e,f = string.find(linea,'>',posf+1)
  21.                             if e and f then
  22.                                 pos2i = f+1
  23.                                 g,h = string.find(linea,'</A>',pos2i)
  24.                                     if g and h then
  25.                                         pos2f = g-1
  26.                                         name = string.sub(linea,pos2i,pos2f)                                   
  27.                                     end
  28.                             end
  29.                            
  30.                            
  31.                         table.insert(tab,{url=url,name=name})
  32.                     end        
  33.                 end                
  34.             end
  35.         return tab
  36.     end
  37. return false
  38. end
  39.  
  40.  
  41. function edit_autorun()
  42.     os.message("Escribe el label")
  43. --Leemos el inf, si existe devuelve al label, si no devuelve ""
  44.     local label = ini.read("ms0:/autorun.inf","autorun","label","")
  45. --Escribimos un nuevo label
  46.     label = os.osk("Escribe el label:",label,20,10,10)
  47. --Escribimos el label al inf
  48.     ini.write("ms0:/autorun.inf","autorun","label",label )
  49.     os.message("Elige una imagen")
  50. --Copiamos la imagen a la raiz con el nombre de icon.png
  51.     files.copy("","ms0:/icon.png")
  52. --Escribimos que el icon es el icon.png
  53.     ini.write("ms0:/autorun.inf","autorun","icon","icon.png")
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement