04-21-2023, 08:11 PM
Have you ever wished you had a desktop background that would tell you random Chuck Norris facts? Haven't we all?
Well now your wish has become a reality:
View in QBJS
Well now your wish has become a reality:
Code: (Select All)
Dim img
img = _LoadImage("https://images01.military.com/sites/default/files/styles/full/public/2021-04/chucknorris.jpeg.jpg?itok=2b4A6n29")
_PutImage , img
_Fullscreen
Do
_Delay 2
Dim result As Object
result = Fetch("https://api.chucknorris.io/jokes/random")
If result.ok Then
Dim obj As Object
obj = JSON.parse(result.text)
Say obj.value
End If
Loop
Sub Say (text As String)
$If Javascript Then
var synth = window.speechSynthesis;
if (synth) {
var utterance = new SpeechSynthesisUtterance(text);
synth.speak(utterance);
while (synth.speaking) {
await QB.sub__Delay(.5);
}
success = -1;
}
$End If
End Sub
View in QBJS