opera = "\Windows\Opera9\opera6.adr"
Copy(opera, "\Windows\Opera9\opera6.txt",TRUE)
data = ReadFile("\Windows\Opera9\opera6.txt")
Message("Please wait, your Opera bookmarks are being imported.")

Split(data, "#URL",0,links)
pages = ""
number = MaxIndex(links)
For i = 2 to number step 1
	ii = i - 1
	#Get Name
	pos = Find(links[i],"NAME")
	If (pos)
		pos = pos + 6
		len = Find(links[i], "CREATED",pos) - 19
		name[i] = SubStr(links[i],pos,len)
	EndIf

	#Get URL
	pos = Find(links[i],"URL")
	If (pos)
		pos = pos + 5
		pos2 = pos + 8
		len = Length(links[i]) - pos
		urls[i] = SubStr(links[i],pos,len)
	EndIf

	#Write Registry
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"Name",name[i])
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"URL",urls[i])
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"ACTIONURL","\Windows\Operal.exe;"&urls[i])
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"Icon","\Windows\Opera9\opera.png")
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"SK2TEXT","Import")
	RegWriteString("HKLM","Software\Microsoft\CHome\Opera\Page"&ii,"SK2URL","\Windows\Opera9\opera9.mscr")
	pages = pages&"Page"&ii&";"
Next

RegWriteString("HKLM","Software\Microsoft\CHome\Opera","Pages",pages)

i = ii
oldExists = 1
While (oldExists)
	i = i + 1
	If (RegKeyExists("HKLM","Software\Microsoft\CHome\Opera\Page"&i))
		RegDeleteKey("HKLM","Software\Microsoft\CHome\Opera\Page"&i,TRUE,TRUE)
	Else
		oldExists = 0
	EndIf
EndWhile

update = RegRead("HKLM","Software\Microsoft\CHome\Opera","Updated")
If (update)
	RegWriteDWord("HKLM","Software\Microsoft\CHome\Opera","Updated",0)
Else
	RegWriteDWord("HKLM","Software\Microsoft\CHome\Opera","Updated",1)
EndIf

Message(ii&" Opera bookmarks have been imported.")
exit