Page 1 of 1
Browser Widget
Posted: Sun Jul 08, 2018 9:02 am
by Quinton B.
Currently, I'm using a browser widget. Is their a command in which I could execute that would allow the stack to place an object over the browser. Capture contains the full object in which I would like to display over the browser. Capture1 shows what currently is displayed.
Re: Browser Widget
Posted: Sun Jul 08, 2018 11:06 am
by mrcoollion
You could place a group of buttons on top of the browser?
Regards,
Paul
Re: Browser Widget
Posted: Mon Jul 09, 2018 1:26 am
by Quinton B.
No, the first picture shows when the stack is live, the second shows when the stack is being edited.
Re: Browser Widget
Posted: Mon Jul 09, 2018 9:09 am
by jmburnod
Hi,
place an object over the browser
As far i know that is not possible
Best regards
Jean-Marc
Re: Browser Widget
Posted: Mon Jul 09, 2018 2:45 pm
by mrcoollion
Correct I forgot that a browser widget is always on top
However, because you can set the browser widget visible to false it might be an idea to capture (import snapshot) the browser part of the screen, then set the Browser widget to invisible and show the capture with on top your group of buttons and visa versa.
Code: Select all
import snapshot from rectangle (the rect of widget tWidgetName) of window windowId of this stack
Regards,
Paul
Re: Browser Widget
Posted: Mon Jul 09, 2018 4:25 pm
by Quinton B.
Thanks, when I get back, I'll see if it works out.
Re: Browser Widget
Posted: Mon Jul 09, 2018 8:16 pm
by Quinton B.
So that works. But another problem just arose when going back through my code.
Basically, I have 8 URL encodes (separate URLs) for CNN 5 things you need to know today. They periodically change, that is why I have 8 separate URLs so that if one fails it will throw an error (this is where it goes wrong). In my due diligence of researching an error that would throw if the browser fails to load the URL due to an invalid error, it would then cause some of my code to switch between the other URLs unit 1 of which is satisfied. I even went as far as to have a redundancy measure in case none of the URL's were working, it would use the last working one that was saved when the widget was last successfully connected to a working URL.
The error portion of my code that causes it to switch between URLs is quite simple. But I have no idea where I screwed up.
Bellow is all the code that pertains to my problem:
Code: Select all
put tCurrentDate4 into tNewDate
put char 1 to 4 of tNewDate into CurYear
set the itemdelimiter to ","
put item 2 of tNewDate into CurMonth
put item 3 of tNewDate into CurDay
--Month Names
if CurMonth = 1 then
put "01" into CurMonthNum
put "january" into CurMonthName
end if
if CurMonth = 2 then
put "02" into CurMonthNum
put "february" into CurMonthName
end if
if CurMonth = 3 then
put "03" into CurMonthNum
put "march" into CurMonthName
end if
if CurMonth = 4 then
put "04" into CurMonthNum
put "april" into CurMonthName
end if
if CurMonth = 5 then
put "05" into CurMonthNum
put "may" into CurMonthName
end if
if CurMonth = 6 then
put "06" into CurMonthNum
put "june" into CurMonthName
end if
if CurMonth = 7 then
put "07" into CurMonthNum
put "july" into CurMonthName
end if
if CurMonth = 8 then
put "08" into CurMonthNum
put "august" into CurMonthName
end if
if CurMonth = 9 then
put "09" into CurMonthNum
put "september" into CurMonthName
end if
if CurMonth = 10 then
put "10" into CurMonthNum
put "october" into CurMonthName
end if
if CurMonth = 11 then
put "11" into CurMonthNum
put "november" into CurMonthName
end if
if CurMonth = 12 then
put "12" into CurMonthNum
put "december" into CurMonthName
end if
--Day Name
if CurDay = 0 then
put true into OneMonthBack
end if
if CurDay = 1 then
put "01" into CurDayNum
put "1st" into CurDayName
end if
if CurDay = 2 then
put "02" into CurDayNum
put "2nd" into CurDayName
end if
if CurDay = 3 then
put "03" into CurDayNum
put "3rd" into CurDayName
end if
if CurDay = 4 then
put "04" into CurDayNum
put "4th" into CurDayName
end if
if CurDay = 5 then
put "05" into CurDayNum
put "5th" into CurDayName
end if
if CurDay = 6 then
put "06" into CurDayNum
put "6th" into CurDayName
end if
if CurDay = 7 then
put "07" into CurDayNum
put "7th" into CurDayName
end if
if CurDay = 8 then
put "08" into CurDayNum
put "8th" into CurDayName
end if
if CurDay = 9 then
put "09" into CurDayNum
put "9th" into CurDayName
end if
if CurDay = 10 then
put CurDay into CurDayNum
put "10th" into CurDayName
end if
if CurDay = 11 then
put CurDay into CurDayNum
put "11th" into CurDayName
end if
if CurDay = 12 then
put CurDay into CurDayNum
put "12th" into CurDayName
end if
if CurDay = 13 then
put CurDay into CurDayNum
put "13th" into CurDayName
end if
if CurDay = 14 then
put CurDay into CurDayNum
put "14th" into CurDayName
end if
if CurDay = 15 then
put CurDay into CurDayNum
put "15th" into CurDayName
end if
if CurDay = 16 then
put CurDay into CurDayNum
put "16th" into CurDayName
end if
if CurDay = 17 then
put CurDay into CurDayNum
put "17th" into CurDayName
end if
if CurDay = 18 then
put CurDay into CurDayNum
put "18th" into CurDayName
end if
if CurDay = 19 then
put CurDay into CurDayNum
put "19th" into CurDayName
end if
if CurDay = 20 then
put CurDay into CurDayNum
put "20th" into CurDayName
end if
if CurDay = 21 then
put CurDay into CurDayNum
put "21st" into CurDayName
end if
if CurDay = 22 then
put CurDay into CurDayNum
put "22nd" into CurDayName
end if
if CurDay = 23 then
put CurDay into CurDayNum
put "23rd" into CurDayName
end if
if CurDay = 24 then
put CurDay into CurDayNum
put "24th" into CurDayName
end if
if CurDay = 25 then
put CurDay into CurDayNum
put "25th" into CurDayName
end if
if CurDay = 26 then
put CurDay into CurDayNum
put "26th" into CurDayName
end if
if CurDay = 27 then
put CurDay into CurDayNum
put "27th" into CurDayName
end if
if CurDay = 28 then
put CurDay into CurDayNum
put "28th" into CurDayName
end if
if CurDay = 29 then
put CurDay into CurDayNum
put "29th" into CurDayName
end if
if CurDay = 30 then
put CurDay into CurDayNum
put "30th" into CurDayName
end if
if CurDay = 31 then
put CurDay into CurDayNum
put "31st" into CurDayName
end if
readyNews
end currentWeather
--LAUNCHES CURRENT NEWS
on readyNews
----us
--us name index
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/us/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDayName) & "/index.html" into nNews
put url (nNews) into widget "browser"
put 0 into URLTry
end readyNews
--Other News URLS
on otherNews
--us cur index
if URLTry = 1 then
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/us/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDay) & "/index.html" into nNews
put url (nNews) into widget "Browser"
end if
if URLTry = 2 then
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/us/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDay) & "-trnd/index.html" into nNews
put url (nNews) into widget "Browser"
end if
if URLTry = 3 then
--us name trendindex
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/us/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDayName) & "-trnd/index.html" into nNews
put url (nNews) into widget "Browser"
end if
--world
if URLTry = 4 then
--world name index
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/world/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDayName) & "/index.html" into nNews
put url (nNews) into widget "Browser"
end if
if URLTry = 5 then
--world cur index
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/world/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDay) & "/index.html" into nNews
put url (nNews) into widget "Browser"
end if
if URLTry = 6 then
--world cur trendindex
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/world/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDay) & "-trnd/index.html" into nNews
put url (nNews) into widget "Browser"
end if
if URLTry = 7 then
--world name trendindex
put "https://www.cnn.com/" & URLEncode(CurYear) & "/" & URLEncode(CurMonthNum) & "/" & URLEncode(CurDayNum) & "/world/five-things-" & URLEncode(CurMonthName) & "-" & URLEncode(CurDayName) & "-trnd/index.html" into nNews
put url (nNews) into widget "Browser"
end if
-----No news for that day yet
if URLTry = 8 then
put UrlBackUp into url widget "Browser"
end if
if URLTry = 9 then
answer "No new news yet today, try again later." & "ERROR 05"
end if
end otherNews
-- if the URL failed it would execute this
on browserLoadFailed
put URLTry + 1 into URLTry
otherNews
end browserLoadFailed
--- saves the last working url
on browserDocumentComplete pUrl
put pUrl into UrlBackUp
put 0 into URLTry
end browserDocumentComplete
Re: Browser Widget
Posted: Tue Jul 10, 2018 11:22 am
by [-hh]
Quinton wrote:... place an object over the browser ..
How to do that on top of a video running in a browser widget:
http://forums.livecode.com/viewtopic.ph ... 73#p152773
If the video doesn't load then replace "hh.on-rev.com" with "hyperhh.de" in the htmltext of the widget or use any URL in the browser widget. These are LC objects in a floating window that is draggable and visible also over the browser widget.This possibly doesn't work on linux (due to the browser widget).
For the second problem:
minor: you could use simple switches
major: instead of
put url (nNews) into widget "Browser"
write
set URL of widget Browser to nNews
Re: Browser Widget
Posted: Wed Jul 11, 2018 7:45 pm
by Quinton B.
Slight Problem, I can't seem to see the imageData within an image widget getting the image from the browser widget.
This is the code that I'm using:
Code: Select all
set the imageData of widget "Browser" to image "BrowserSnap"
put the imageData of widget "Browser" into image "BrowserSnap"
Whats wrong?
Youtube videos load fine, but CNN video so far don't.
I also can't seem to play the videos within the browser:
Re: Browser Widget
Posted: Wed Jul 11, 2018 7:56 pm
by Klaus
IMAGEDATA is a property of IMAGES, widgets do not have this property, so this will never work.
If in doubt, a look into the dictionary will always help!