Tried everything i could think of and researched but i cannot get it working.
Code works fine with jpg files but not with an ico file.
I use the code below and I have also attached a test stack for those interested.
Any idea's ?
Code: Select all
on mouseUp
--- reset all ---
put empty into field "Result"
set the text of img "WebSiteIcon" to empty
set the icon of button "ShowIconOnButton" to 0
--- end reset ---
if the icon of button "ShowIconOnButton" is 0 then
put field"TheWebsiteURL" into TheWebsiteURL
if TheWebsiteURL is not empty then
put TheWebsiteURL & "/favicon.ico" into TheWebsiteIconURL // if you place /favicon.ico behind a site 9base) urel then you should get the site icon.
--------------------------------------------------------------------------------------
--import from file TheWebsiteIconURL
--put last image into img "WebSiteIcon"
--DELETE last image
--------------------------------------------------------------------------------------
--put URL TheWebsiteIconURL into img "WebSiteIcon"
--------------------------------------------------------------------------------------
load URL TheWebsiteIconURL with message "FileIsDoneDownloading"
--------------------------------------------------------------------------------------
--set the filename of img "WebSiteIcon" to TheWebsiteIconURL
---------------------------------------------------------------------------------------
if img "WebSiteIcon" is not empty then // because it does not work the image stay empty and therefor i need this.
set the width of image img "WebSiteIcon" to the width of button "ShowIconOnButton"
set the height of image img "WebSiteIcon" to the height of button "ShowIconOnButton"
set the icon of button "ShowIconOnButton" to the id of img "WebSiteIcon"
end if
end if
end if
end mouseUp
on FileIsDoneDownloading pURL, pURLStatus
if pURLStatus is "cached" then
## Revolution has cached URL content. Accessing the url uses the cache.
set the text of img "WebSiteIcon" to URL pURL
--put URL pURL into img "WebSiteIcon"
## Remove URL from cache if you are all done with it.
unload url pURL
else
put libURLErrorData(pURL) into theError
set the text of field "Result" to "An error occurred:" && theError & "."
end if
end FileIsDoneDownloading