How to remove defalult text when using RAF eg(Ad 1 of 1) - scene

I am working on RAF(Roku Advertising Framework) using bright script.
On above image we seeing (Ad 1 of 1) when playing ads.
Please give me suggestions to solve this issue, Any help much appreciated.

In the current version of RAF (1.9.6) there is no way of doing this.

Nas is correct to a certain limit. The Roku checklist will want to have the "Feedback UI" enabled if you're watching ads (this is the "Ad 1 of 1")
Now, it is possible to create your own roVideoPlayer to play the ads. It requires more work to do...
'handle this else where (like the construct):
function main
'm._raf = Roku_Ads()
'm._raf.setDebugOutput(true)
'm._raf.setAdPrefs(false, 2)
'm._raf.setAdUrl(url)
'playAds()
end function
function playAds()
' sleep for half a second
sleep(500)
' setup some variables we'll be using
canvas = createObject("roImageCanvas")
' get the ads from the url
adPods = m._raf.getAds()
if adPods <> invalid and adPods.Count() > 0 then
' quick display for us to know how many ads we're playing
print "playing " adPods.Count() " ads"
' loop through each ad pod
for each adPod in adPods
' handle any top level logic here
' loop through each ad within the adPod now
for each ad in adPod.ads
' default ad rendering by raf: m._raf.showAds(adPods)
' start playing the ad
adVideoPlayer = playVideoContent(ad.streams)
playingAd = true
' custom event loop for the ad video player
while playingAd
videoMsg = wait(500, adVideoPlayer.getMessagePort())
if type(videoMsg) = "roVideoPlayerEvent" then
if videoMsg.isStreamStarted() then
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else if videoMsg.isPlaybackPosition() then
' loop through all trackers to see if we need to trigger any of them
for each tracker in ad.tracking
' make sure its not triggered first and that the tracker has a "time" property
if not tracker.triggered and tracker.time <> invalid then
print "* ad position: " videoMsg.getIndex() " / " adVideoPlayer.getPlaybackDuration()
if (int(videoMsg.getIndex()) + 1) >= int(tracker.time) then
print "triggering ad event " tracker.event ", triggered at position " tracker.time
m._raf.fireTrackingEvents(ad, {type: tracker.event})
tracker.triggered = true
end if
end if
end for
end if
if videoMsg.isStatusMessage() then
status = videoMsg.getMessage()
if status = "startup progress" then
' handle loading bar or anything else here
else if status = "start of play" then
' we should be playing the video, nuke the buffering layer and set layer 1 to a black background
canvas.clearLayer(2) ' clear buffering layer
canvas.setLayer(1, [{ color: "#00000000", CompositionMode: "Source" }])
canvas.show()
else
print "ad status: " status
end if
' roVideoPlayer sends "end of stream" last for all exit conditions
if status = "playback stopped" or status = "end of playlist" or status = "end of stream" then
print "done playing ads"
playingAd = false
end if ' end status check
end if ' end isStatusMessage
end if ' end type(videoMsg)
end while
if type(adVideoPlayer) = "roVideoPlayer" then
print "stop the ad video player"
adVideoPlayer.stop()
end if
end for
end for
else
print "no ads to play"
end if
end function

Related

VB6 Debug Version works fine, compiled version wont start

I compile VB6 programs on Windows 10 regularly. I currently have a project which has worked on an old machine but I want to migrate this to new hardware and therefore a new windows install.
I have the code working fine when I run it in debug but as soon as I compile (and run as admin which is what I normally do to make sure registry values are retrieved correctly) it seems to get stuck. CPU usage goes up to 25% which is about double what is normal and the form never loads.
I have gone through the code and started commenting out lines to see what starts to make it work. Looking at the sub below this code works however if I uncomment any of the commented lines then it fails. I could understand this if maybe there was a loop or something which it gets stuck in but one of the lines is on;y changing the caption of the form!
As I mentioned earlier I think I have probably compiled projects on hardware and the windows install image 40-50 times never with this problem. What I don't understand for instance is why the frmlogin.show line is ok when me.show isnt?
The double commented lines are actual comments by the way.
Public Sub StartMainForm()
Dim x As Integer
FirstUpdate = True
' ' Lees de trek iconen in de imagelist in
'
' For x = 1 To 15
' imageListIcon.ListImages.Add x, "Icon" & Format(x, "00"), LoadResPicture(22000 + x, vbResIcon)
' Next x
'
' ' Scherm opbouw
'
' InitAssenControles
' Form_Resize
' ClearSelectie
'
' ' Form_Resize
' Me.Show
' Me.WindowState = vbMaximized
' DataBaseNaam = G.SDataFile
' Me.Caption = Replace(DataBaseNaam, ".MDB", "")
'
' ' start Update
'
' timStatusUpdate.Interval = gUpdateTime
' timStatusUpdate.Enabled = True
DoEvents
gCurrentUser = True
G.LoginName = "Supervisor"
G.Auth1 = True
G.Auth2 = True
G.Auth3 = True
G.Auth4 = True
G.Auth5 = True
G.Auth6 = True
G.Auth7 = True
G.Auth8 = True
G.Auth9 = True
G.Auth10 = True
frmLogin.Show vbModal
InitAssenControles
gAssenServer.SetNetwerkKast gNetwerkNummer
Exit Sub
End Sub

Ruby is there a way to stop the user from calling a function/procedure through case before they have accessed a different function/procedure?

I have a text file that I want to open first for reading or writing, but want the user to manually enter the text_file name (which opens the file for reading) first like so:
def read_in_albums
puts "Enter file name: "
begin
file_name = gets().chomp
if (file_name == "albums.txt")
puts "File is open"
a_file = File.new("#{file_name}", "r")
puts a_file.gets
finished = true
else
puts "Please re-enter file name: "
end
end until finished
end
From this unfinished code below, selecting 1 would go to the above procedure. I want the user to select 1 first, and if they choose 2 without having gone through read_in_albums they just get some sort of message like "no file selected and sent back to menu screen.
def main()
finished = false
begin
puts("Main Menu:")
puts("1- Read in Album")
puts("2- Display Album Info")
puts("3- Play Album")
puts("4- Update Album")
puts("5- Exit")
choice = read_integer_in_range("Please enter your choice:", 1, 5)
case choice
when 1
read_in_albums
when 2
display_album_info
when 5
finished = true
end
end until finished
end
main()
The only thing I can think of is something like
when 2
if(read_in_albums == true)
display_album_info
and have it return true from read_in_albums.
which I don't want to do as it just goes through read_in_albums again, when I only want it to do that if the user pressed 1.
All of your application's functionality depends on whether the album data has been read. You are no doubt storing this data as an object in memory referenced by some variable.
$album_data = File.read 'album.txt'
You can test whether this data is present in order to determine whether the file data has been read:
if $album_data.nil?
# ask user for album file
else
# show album user interface
end
There is no need for a separate flag. The mere presence of the data in memory serves as a flag already.
You could either set a flag when option 1 was selcted
has_been_read = false
...
when 1
read_in_albums
has_been_read = true
when 2
if has_been_read
display_album_info
else
puts "Select Option 1 first"
end
Or just test if your file name is a valid string.

QTP 10 - A function return deifferent results for same data in run and debug modes

I would extremely appreciate if anyone can suggest a solution for this.
I have a simple function that is is expecting for a browser to be opened on a page containing a web list that each value of it represents an account. When an account is selected it's products (if any) are displayed.
The functions goal is to retrieve an index of an account with products (the first to be found) or -1 if there are none.
The problem, which I can't figure out what is causing it, is that the function will return the correct result when I'm debugging it - meaning running the code step by step using F10, but will return a wrong result if I'll run regularly (F5). This behavior is consistent and the function retrieves the same result each time for each type of runs, meaning it's not a bug that just makes the function return a random answer.
This is the function:
' #return: a random account index with products if one exists
' otherwise returns -1
Public Function getRandomAccountWithProducts()
On Error Resume Next
Set Page1 = Browser("micclass:=browser").Page("micclass:=Page")
Set br = Browser("micclass:=Browser")
originalURL = br.GetROProperty("URL")
br.Navigate Environment.Value("SOME URL") & "REST OF URL"
br.Sync
Page1.WebList("name:=accountId").Select "#1"
br.Sync
' Display only products
Page1.WebRadioGroup("name:=name0").Click
Page1.WebList("name:=name1").Select "Display None"
Page1.WebList("name:=name2").Select "Display None"
Page1.WebButton("value:=Apply","visible:=True").Click
' Init
numOfAccounts = Page1.WebList("name:=accountId").GetROProperty("items count") - 1
If numOfAccounts < 1 Then
getRandomAccountWithProducts = -1
Reporter.ReportEvent micFail, "Number of accounts","There are no accounts. No account with products exists"
Exit Function
End If
hasProducts = false
accountIndex = 1
' Get account with products
While ((Not hasProducts) AND (accountIndex =< numOfAccounts))
' Return account if has products
If Page1.WebList("name:=webListName","index:=0","micclass:=WebList","visible:=True").Exist(5) Then
hasProducts = true
End If
If (Not hasProducts) Then
accountIndex = accountIndex + 1
Page1.WebList("name:=accountId").Select "#" & accountIndex
End If
Wend
br.Navigate originalURL
Set Page1= Nothing
Set br = Nothing
' If no account has products, report and exit, else return selected account index
If Not hasProducts Then
Reporter.ReportEvent micFail,"Accounts","No account has products."
getRandomAccountWithProducts = -1
Else
getRandomAccountWithProducts = accountIndex
End If
If Err<>0 Then
errorMessage = "Error number: " & Err.Number & vbNewLine & "Error description: " & Err.Description & vbNewLine & "Error source: " & Err.Source
Reporter.ReportEvent micFail,"Run Time Error",errorMessage
Err.Clear
End If
On Error GoTo 0
End Function
I'm running on Pentium 4, 3.2 GHZ, 2 GB RAM, Win XP, SP 3,IE 7, QTP 10.0 Build 513
Thanks!
Have you considered using the all items property?
AllItems = Page1.WebList("name:=accountId").GetROProperty("all items")
SplitItems = Split(AllItems, ";")
Found = False
For i = 0 To UBound(AllItems)
If AllItems(i) = "<product>" Then
Found = True
Exit For
End If
Next
Solution was found thanks to Jonty,
The problem was in the following section:
' Get account with products
While ((Not hasProducts) AND (accountIndex =< numOfAccounts))
' Return account if has products
If Page1.WebList("name:=webListName","index:=0","micclass:=WebList","visible:=True").Exist(5) Then
hasProducts = true
End If
If (Not hasProducts) Then
accountIndex = accountIndex + 1
Page1.WebList("name:=accountId").Select "#" & accountIndex
End If
Wend
The first time entered to the loop, the account really didn't have any products, so obviously none was recognized. So accountIndex was increased by one and the corresponding account was selected in the web list.
No here lies the problem. The select method caused a refresh in the page and the condition Page1.WebList("name:=webListName","index:=0","micclass:=WebList","visible:=True").Exist(5)
was evaluated before the web list was loaded thus, returning false.
I considered that option, but I thought (wrongly apparently) that the Exist(5) should do the trick, but it seems that it works differently than expected.
Thanks,
Alon

I want AutoIt to activate a particular tab in Firefox. How can this be done?

I have several tabs open in Firefox. I want AutoIt to activate a particular tab in Firefox. How can this be done?
Give the whole browser window focus, then use the send command to repeatedly send it cntl-tab until the window's title is the name of the tab you want (with - Mozilla Firefox at the end).
There's a UDF (User Defined Functions -include file) called FF.au3. Looks like the function you want is _FFTabSetSelected(), good luck!
Below is an example of Jeanne Pindar's method. This is the way I would do it.
#include <array.au3>
Opt("WinTitleMatchMode", 2)
activateTab("Gmail")
Func activateTab($targetWindowKeyphrase)
WinActivate("- Mozilla Firefox")
For $i = 0 To 100
If StringInStr(WinGetTitle(WinActive("")),$targetWindowKeyphrase) Then
MsgBox(0,"Found It", "The tab with the key phrase " & $targetWindowKeyphrase & " is now active.")
Return
EndIf
Send("^{TAB}")
Sleep(200)
Next
EndFunc
Here you go...
AutoItSetOption("WinTitleMatchMode", 2)
$searchString = "amazon"
WinActivate("Mozilla Firefox")
For $i = 0 To 100
Send("^" & $i)
Sleep(250)
If Not(StringInStr(WinGetTitle("[ACTIVE]"), $searchString) = 0) Then
MsgBox(0, "Done", "Found it!")
ExitLoop
EndIf
Next
Just delete the MsgBox and you're all set!
As Copas said, use FF.au3. Function _FFTabSetSelected($regex,"label") will select first tab with name matching given $regex.
Nop... The script is buggy ^^'... no need to count to 100, and there is a problem with the "send" after it:
If you send ctrl + number
=>the number can't be bigger than 9... Because ten is a number with 2 caracters, Firefox can't activate tab 10 with shortcut.
And by the way when the script is working there is a moment he release the ctrl key.. It don't send ten, but ctrl and 1 end zero ... and splash !!! It just send the number in the window.
So we need to learn to the script that the second time he's back to $i = 0 or one, all the tabs was seen, no need to continue, even if the text you're searching for was not found.
So I made my own script based on the old one:
##
AutoItSetOption("WinTitleMatchMode", 2)
$searchString = "The string you're looking for"
Local $o = 0
WinActivate("The Name of the process where you're searching")
For $i = 0 To 9
Send("^" & $i)
Sleep(250)
if ($i = 9) Then
$o += 1
EndIf
If not (StringInStr(WinGetTitle("[ACTIVE]"), $searchString) = 0) Then
MsgBox("","","Found it !") ;your action, the text was found.
ExitLoop
ElseIf ($o = 1) Then
MsgBox("","","All tab seen, not found...") ;your action, the text was not found, even after looking all title.
ExitLoop
EndIf
Next
##
I haven't touched AutoIt in years, but IIRC it will be:
setMousePos(x, y) // tab position
click("left")

Using multiple Message Boxes in "if then" statement with VB

I am very new with programming and I have come across an issue in Visual Basic that I cannot figure out. Many forums and YouTube videos later I still do not have an answer.
I am using a nested selection structure and within it is two Message boxes. I cannot figure out how to get the second dialog result to trigger the elseif statement. It just skips over it. I believe since I have one variable declared for a dialog result it is checking both of them, but in this case I don't know how to declare only the second dialog result.
Here is the code so far.
Dim dblTotal As Double = 12
Dim strResponse As DialogResult
' Dialog box asking about a coupon and $2 coupon.
If MessageBox.Show("Does customer have a coupon?", "Coupon", MessageBoxButtons.YesNo) = vbYes AndAlso
MessageBox.Show("Does customer have a $2 coupon?", "Coupon", MessageBoxButtons.YesNo) = vbNo Then
lblTotal.Text = Convert.ToString(dblTotal - 4)
' Meant to be ran if statement is false. I dont Understand
' why it is skipping over and not executing.
' Is "dlgResult" reading the first one as well? How do I correct?
ElseIf strResponse = vbYes Then
lblTotal.Text = Convert.ToString(dblTotal - 2)
Else
lblTotal.Text = Convert.ToString(dblTotal)
End If
End Sub
I understand it would be easier to to code if the first message = vbNo, but I was trying to see if this way would work.
Thank you!!
Is this how you wanted it?
Dim dialog1 As DialogResult
Dim dialog2 As DialogResult
Dim dblTotal As Double = 12
dialog1 = MessageBox.Show("Does customer have a coupon?", "Coupon", MessageBoxButtons.YesNo)
dialog2 = MessageBox.Show("Does customer have a $2 coupon?", "Coupon", MessageBoxButtons.YesNo)
If dialog1 = DialogResult.OK Then
dblTotal = dblTotal - 2
End If
If dialog2 = DialogResult.OK Then
dblTotal = dblTotal - 2
End If
lblTotal.Text = Convert.ToString(dblTotal - 2)

Resources