Page 1 of 1

Read IE favorites

Posted: Fri Jan 28, 2005 1:19 pm
by mhgschmidt
Code updated For 5.20+

Hi !

Here is a code snippet for reading IE favorites. Have phun ! :D

Code: Select all

; GetFavoriteURL.pb
; Date: 28.01.2005
;
; - reads an URL from favorites Folder
; - opens a Website with IE
;
; Michael H.G. Schmidt, michael@schmidt2.de
;

Procedure.s GetSystemFolder (folder)
  
  ; Get system folder location...
  ;
  ; this routine modified by me.
  ; Original from http://www.purearea.net/pb/CodeArchiv
  ;
  #CSIDL_FAVORITES = $6
  
  Structure EMID
    cb.b
    abID.b[1]
  EndStructure
  
  
  *itemid.ITEMIDLIST = #Null
  If SHGetSpecialFolderLocation_ (0, folder, @*itemid) = #NOERROR
    location$ = Space (#MAX_PATH)
    If SHGetPathFromIDList_ (*itemid, @location$)
      ProcedureReturn location$
    EndIf
  EndIf
  
EndProcedure


; MAIN

favorites$ = GetSystemFolder (#CSIDL_FAVORITES) + "\*.url"
URLFile$ = OpenFileRequester("Choose the hyperlink file:", favorites$, "Internet URL's (*.url)|*.url|All Files (*.*)|*.*", 0)


If OpenPreferences(URLFile$)
  
  PreferenceGroup("InternetShortcut")
  URL$=ReadPreferenceString("URL","")
  
Else
  
  MessageRequester("URL !", "Error opening the File !", 0)
  End
  
EndIf

result = MessageRequester("URL", "This file contains the URL:"+Chr(10)+Chr(10)+URL$+Chr(10)+Chr(10)+"Open ?", #PB_MessageRequester_YesNo)

If result = 6
  RunProgram("iexplore.exe",URL$,"")
EndIf

End

; ExecutableFormat=Windows
; EOF


Posted: Fri Jan 28, 2005 3:11 pm
by dracflamloc
Cool. =)

Posted: Sat Jan 29, 2005 1:36 am
by GeoTrail
Pretty nice piece of code there :)