use the "Timer" action instead of "Delay" ?
Moderator: Neosoft Support
use the "Timer" action instead of "Delay" ?
If for example I manually load the following urls in Neobook, each will display with no problem:
http://www.salon.com/
http://time.com/
http://www.newsweek.com/
----
But if I load them with a "Delay" action, I often get script errors and Neobook freezes :
BrowserGoTo "WebBrowser1" "http://www.salon.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://time.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://www.newsweek.com/"
----
If I use the "Timer" action instead of "Delay" will I get better results? How would I do that?
.
http://www.salon.com/
http://time.com/
http://www.newsweek.com/
----
But if I load them with a "Delay" action, I often get script errors and Neobook freezes :
BrowserGoTo "WebBrowser1" "http://www.salon.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://time.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://www.newsweek.com/"
----
If I use the "Timer" action instead of "Delay" will I get better results? How would I do that?
.
Re: use the "Timer" action instead of "Delay" ?
fkapnist:
Not sure what you are trying to achieve with the 3 second delay ... but ...
1) the time it takes to service a http request can vary from time to time (depending on Internet traffic at the time)
2) Delay would pause the servicing of script commands (NeoBook does not wait for the BrowserGoTo command to return the requested html document before servicing the next command)
3) Timer tasks are performed in an independant task ... so when they are serviced depends only on ...
- when the Timer object is started
- the Timer Interval
You might try and invoke your "Pause" (Delay/Timer) in the Navigate Complete event section of the Web Browser object e.g. ...
- If the Variable to store current address (URL) is http://www.salon.com/, then do "Pause" ... followed by a request for http://time.com/
- If the Variable to store current address (URL) is http://time.com/, then do the "Pause" ... followed by a request for http://www.newsweek.com/
Not sure what you are trying to achieve with the 3 second delay ... but ...
1) the time it takes to service a http request can vary from time to time (depending on Internet traffic at the time)
2) Delay would pause the servicing of script commands (NeoBook does not wait for the BrowserGoTo command to return the requested html document before servicing the next command)
3) Timer tasks are performed in an independant task ... so when they are serviced depends only on ...
- when the Timer object is started
- the Timer Interval
You might try and invoke your "Pause" (Delay/Timer) in the Navigate Complete event section of the Web Browser object e.g. ...
- If the Variable to store current address (URL) is http://www.salon.com/, then do "Pause" ... followed by a request for http://time.com/
- If the Variable to store current address (URL) is http://time.com/, then do the "Pause" ... followed by a request for http://www.newsweek.com/
Re: use the "Timer" action instead of "Delay" ?
30000 is a half minute, not three seconds.... I don't understand what you mean by "Delay would pause the servicing of script commands." Do you think if I add a "Pause" it will prevent script errors? I often get a message about a script error but I don't know if it is a script from the page I loaded, or if it is a script in my Neobook Functions....
.
.
Re: use the "Timer" action instead of "Delay" ?
fkapnist:
Probably a better option would be to use a Timer object ...
- store URLs in arrayed variable e.g. [myURL1], [myURL2], [myURL3]
- setup a variable for number of URLs e.g. [maxURLCount] = 3
- setup a counter e.g. [thisURLCount] = 1
- start the Timer
- in the Interval code, request to navigate to [myURL[thisURLCount]] ... then increment [thisURLCount]
- depending on your requirement, when [thisURLCount] exceeds [maxURLCount], reset [thisURLCount] to 1 ... or stop the Timer
b) just (temporarily) load a different page e.g. home page of this forum ... if the error message goes away, it is the script in your loaded page.
Oops, my bad (eyes) ... please ignore my previous post.30000 is a half minute, not three seconds....
Probably a better option would be to use a Timer object ...
- store URLs in arrayed variable e.g. [myURL1], [myURL2], [myURL3]
- setup a variable for number of URLs e.g. [maxURLCount] = 3
- setup a counter e.g. [thisURLCount] = 1
- start the Timer
- in the Interval code, request to navigate to [myURL[thisURLCount]] ... then increment [thisURLCount]
- depending on your requirement, when [thisURLCount] exceeds [maxURLCount], reset [thisURLCount] to 1 ... or stop the Timer
In the single-threaded environment, NeoBook just waits for the specified period before "servicing the next NeoBook command within your event section.I don't understand what you mean by "Delay would pause the servicing of script commands."
Not sure what you are referring to ... I don't see any such command within NeoBook.Do you think if I add a "Pause" it will prevent script errors?
a) what is the exact text of the error message ?I often get a message about a script error but I don't know if it is a script from the page I loaded, or if it is a script in my Neobook Functions....
b) just (temporarily) load a different page e.g. home page of this forum ... if the error message goes away, it is the script in your loaded page.
Re: use the "Timer" action instead of "Delay" ?
Try this, its a button
Tkx for ReadMe
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=PushButton1
X=161
Y=28
W=274
H=50
Anchor=0
Text=Next [Next]¶View [view]
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=if "[Next]" "=" ""¶ setvar "[view]" "www.salon.com"¶ setvar "[Next]" "2"¶ BrowserGoTo "WebBrowser1" "http://www.salon.com/"¶else¶ if "[Next]" "=" "2"¶ setvar "[view]" "time.com"¶ setvar "[Next]" "3"¶ BrowserGoTo "WebBrowser1" "http://time.com/"¶ else¶ setvar "[view]" "www.newsweek.com"¶ setvar "[Next]" ""¶ BrowserGoTo "WebBrowser1" "http://www.newsweek.com/"¶ endif¶endif
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
COSTA RICA
PURA VIDA
PURA VIDA
Re: use the "Timer" action instead of "Delay" ?
virger wrote:Try this, its a button
Tkx for ReadMeCode: Select all
{NeoBook 5 Objects} NeoBookVer=5,80 ObjectType=3 Name=PushButton1 X=161 Y=28 W=274 H=50 Anchor=0 Text=Next [Next]¶View [view] Align=2 ImageStyle=0 XPTheme=Yes ObjAction=if "[Next]" "=" ""¶ setvar "[view]" "www.salon.com"¶ setvar "[Next]" "2"¶ BrowserGoTo "WebBrowser1" "http://www.salon.com/"¶else¶ if "[Next]" "=" "2"¶ setvar "[view]" "time.com"¶ setvar "[Next]" "3"¶ BrowserGoTo "WebBrowser1" "http://time.com/"¶ else¶ setvar "[view]" "www.newsweek.com"¶ setvar "[Next]" ""¶ BrowserGoTo "WebBrowser1" "http://www.newsweek.com/"¶ endif¶endif LineColor=0 LineWidth=1 LineStyle=0 FillColor=12632256 FillPattern=0 Font=Arial FontSize=10 FontStyle=0 FontCharset=1 TextColor=0 TabOrder=3
Thanks for the manual button... but I would like an automated rotate
Re: use the "Timer" action instead of "Delay" ?
the error message is about a script taking too long.... even if I cancel the script the damage is done and Neobook crashes... the error only comes up if I automate the page loading (using Delay).... if I load the page manually I don't get an error message. That's why I wanty to replace Delay with a Timer action... I will study the tips you gave me:Gaev wrote:fkapnist:
Oops, my bad (eyes) ... please ignore my previous post.30000 is a half minute, not three seconds....
Probably a better option would be to use a Timer object ...
- store URLs in arrayed variable e.g. [myURL1], [myURL2], [myURL3]
- setup a variable for number of URLs e.g. [maxURLCount] = 3
- setup a counter e.g. [thisURLCount] = 1
- start the Timer
- in the Interval code, request to navigate to [myURL[thisURLCount]] ... then increment [thisURLCount]
- depending on your requirement, when [thisURLCount] exceeds [maxURLCount], reset [thisURLCount] to 1 ... or stop the Timer
In the single-threaded environment, NeoBook just waits for the specified period before "servicing the next NeoBook command within your event section.I don't understand what you mean by "Delay would pause the servicing of script commands."
Not sure what you are referring to ... I don't see any such command within NeoBook.Do you think if I add a "Pause" it will prevent script errors?
a) what is the exact text of the error message ?I often get a message about a script error but I don't know if it is a script from the page I loaded, or if it is a script in my Neobook Functions....
b) just (temporarily) load a different page e.g. home page of this forum ... if the error message goes away, it is the script in your loaded page.
store URLs in arrayed variable e.g. [myURL1], [myURL2], [myURL3]
- setup a variable for number of URLs e.g. [maxURLCount] = 3
- setup a counter e.g. [thisURLCount] = 1
- start the Timer
- in the Interval code, request to navigate to [myURL[thisURLCount]] ... then increment [thisURLCount]
- depending on your requirement, when [thisURLCount] exceeds [maxURLCount], reset [thisURLCount] to 1 ... or stop the Timer
Thanks,
Re: use the "Timer" action instead of "Delay" ?
Try this.
In "WebBrowser1", Acction "Download Complete" this code:
Create 2 Buttons
Button1
And Button2
And test, select do you like/need
Tkx For ReadMe
In "WebBrowser1", Acction "Download Complete" this code:
Code: Select all
if "[Type]" "=" "2"
ifex "[u]<4 AND [WebBrowser1Status]=Finalizado"
delay "5000"
setvar "[WebBrowser1Status]" ""
Math "[U]+1" "" "[U]"
BrowserGoTo "WebBrowser1" "http://[Url[U]]/"
endif
endif
Button1
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=BtType1
X=338
Y=8
W=224
H=38
Anchor=0
Text=Type 1¶[Url[U]]
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=setvar "[Type]" "1"¶strparse "www.salon.com;time.com;www.newsweek.com" ";" "[Url]" "[NumUrl]"¶loop "1" "[NumUrl]" "[U]"¶ setvar "[WebBrowser1Status]" ""¶ BrowserGoTo "WebBrowser1" "http://[Url[U]]/"¶ while "[WebBrowser1Status]" "<>" "Finalizado"¶ endwhile¶endloop¶setvar "[Url[u]]" "Finish"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
Code: Select all
{NeoBook 5 Objects}
NeoBookVer=5,80
ObjectType=3
Name=BtType2
X=336
Y=47
W=224
H=38
Anchor=0
Text=Type 2¶[Url[U]]
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=setvar "[Type]" "2"¶¶strparse "www.salon.com;time.com;www.newsweek.com" ";" "[Url]" "[NumUrl]"¶SetVar "[U]" "1"¶BrowserGoTo "WebBrowser1" "http://[Url[U]]/"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=1
Tkx For ReadMe
COSTA RICA
PURA VIDA
PURA VIDA
Re: use the "Timer" action instead of "Delay" ?
I tried this code. Only the first link opens. Then the application freezes and the second button does nothing.virger wrote:Try this.
In "WebBrowser1", Acction "Download Complete" this code:Create 2 ButtonsCode: Select all
if "[Type]" "=" "2" ifex "[u]<4 AND [WebBrowser1Status]=Finalizado" delay "5000" setvar "[WebBrowser1Status]" "" Math "[U]+1" "" "[U]" BrowserGoTo "WebBrowser1" "http://[Url[U]]/" endif endif
Button1And Button2Code: Select all
{NeoBook 5 Objects} NeoBookVer=5,80 ObjectType=3 Name=BtType1 X=338 Y=8 W=224 H=38 Anchor=0 Text=Type 1¶[Url[U]] Align=2 ImageStyle=0 XPTheme=Yes ObjAction=setvar "[Type]" "1"¶strparse "www.salon.com;time.com;www.newsweek.com" ";" "[Url]" "[NumUrl]"¶loop "1" "[NumUrl]" "[U]"¶ setvar "[WebBrowser1Status]" ""¶ BrowserGoTo "WebBrowser1" "http://[Url[U]]/"¶ while "[WebBrowser1Status]" "<>" "Finalizado"¶ endwhile¶endloop¶setvar "[Url[u]]" "Finish" LineColor=0 LineWidth=1 LineStyle=0 FillColor=12632256 FillPattern=0 Font=Arial FontSize=10 FontStyle=0 FontCharset=1 TextColor=0 TabOrder=2
And test, select do you like/needCode: Select all
{NeoBook 5 Objects} NeoBookVer=5,80 ObjectType=3 Name=BtType2 X=336 Y=47 W=224 H=38 Anchor=0 Text=Type 2¶[Url[U]] Align=2 ImageStyle=0 XPTheme=Yes ObjAction=setvar "[Type]" "2"¶¶strparse "www.salon.com;time.com;www.newsweek.com" ";" "[Url]" "[NumUrl]"¶SetVar "[U]" "1"¶BrowserGoTo "WebBrowser1" "http://[Url[U]]/" LineColor=0 LineWidth=1 LineStyle=0 FillColor=12632256 FillPattern=0 Font=Arial FontSize=10 FontStyle=0 FontCharset=1 TextColor=0 TabOrder=1
Tkx For ReadMe
Re: use the "Timer" action instead of "Delay" ?
My main question is if I should use the Delay action or the Timer...
I am currently using this simple action:
Delay "[RotatorDelay]"
(The user selects the duration of the delay)
Below is a (3 link) sample Neobook code I am using for a 36 link slide show type of URL rotator:
[syntax=neobook] FocusObject "WebBrowser1"
GoSub "ScrollHome"
SetVar "[ScrollStatus]" ""
EndIf
Else
GotoLine "EndSurf"
EndIf
If "[SurfState]" "=" "ON"
Delay "[RotatorDelay]"
SetVar "[SlideNum]" "3"
EndIf
:SurfSlot03
SetVar "[SlotFilter]" "[Slot03]"
GoSub "AutoSurfSlotFilter"
If "[GotoNextSlot]" "=" "Yes"
GotoLine "SurfSlot04"
EndIf
If "[SurfState]" "=" "ON"
ShowObject "WebBrowser1" "[ExitEffect]" "[ExitFb]"
BrowserGoTo "WebBrowser1" "[Slot03]"
SetVar "[TextEntry1]" "[Slot03]"
SetVar "[PausePoint]" "Slot03"
Call "ThumbVideo"
GoSub "AutoRefresh"
GoSub "ScrollDown"
Call "SliderPanel"
If "[ScrollStatus]" "=" "BeforeHome"
FocusObject "WebBrowser1"
GoSub "ScrollHome"
SetVar "[ScrollStatus]" ""
EndIf
Else
GotoLine "EndSurf"
EndIf
If "[SurfState]" "=" "ON"
Delay "[RotatorDelay]"
SetVar "[SlideNum]" "4"
EndIf[/syntax]
I am currently using this simple action:
Delay "[RotatorDelay]"
(The user selects the duration of the delay)
Below is a (3 link) sample Neobook code I am using for a 36 link slide show type of URL rotator:
[syntax=neobook] FocusObject "WebBrowser1"
GoSub "ScrollHome"
SetVar "[ScrollStatus]" ""
EndIf
Else
GotoLine "EndSurf"
EndIf
If "[SurfState]" "=" "ON"
Delay "[RotatorDelay]"
SetVar "[SlideNum]" "3"
EndIf
:SurfSlot03
SetVar "[SlotFilter]" "[Slot03]"
GoSub "AutoSurfSlotFilter"
If "[GotoNextSlot]" "=" "Yes"
GotoLine "SurfSlot04"
EndIf
If "[SurfState]" "=" "ON"
ShowObject "WebBrowser1" "[ExitEffect]" "[ExitFb]"
BrowserGoTo "WebBrowser1" "[Slot03]"
SetVar "[TextEntry1]" "[Slot03]"
SetVar "[PausePoint]" "Slot03"
Call "ThumbVideo"
GoSub "AutoRefresh"
GoSub "ScrollDown"
Call "SliderPanel"
If "[ScrollStatus]" "=" "BeforeHome"
FocusObject "WebBrowser1"
GoSub "ScrollHome"
SetVar "[ScrollStatus]" ""
EndIf
Else
GotoLine "EndSurf"
EndIf
If "[SurfState]" "=" "ON"
Delay "[RotatorDelay]"
SetVar "[SlideNum]" "4"
EndIf[/syntax]
Re: use the "Timer" action instead of "Delay" ?
The simple solution:
Long story short, If I run the code below, "time.com" freezes and Neobook crashes. I think Time may have an adware script that prevents url redirect or automatic loading of another page...
But if I use any of the codes below, the Time script stops long enough to load another page...
------------
.
Long story short, If I run the code below, "time.com" freezes and Neobook crashes. I think Time may have an adware script that prevents url redirect or automatic loading of another page...
Code: Select all
BrowserGoTo "WebBrowser1" "http://www.newyorker.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://time.com/"
Delay "30000"
BrowserGoTo "WebBrowser1" "http://www.villagevoice.com/"
But if I use any of the codes below, the Time script stops long enough to load another page...
Code: Select all
BrowserGoTo "WebBrowser1" "http://www.newyorker.com/"
Delay "30000"
BrowserStop "WebBrowser1"
BrowserGoTo "WebBrowser1" "http://time.com/"
Delay "30000"
BrowserStop "WebBrowser1"
BrowserGoTo "WebBrowser1" "http://www.villagevoice.com/"
Code: Select all
BrowserGoTo "WebBrowser1" "http://www.newyorker.com/"
Delay "30000"
RefreshObject "WebBrowser1"
BrowserGoTo "WebBrowser1" "http://time.com/"
Delay "30000"
RefreshObject "WebBrowser1"
BrowserGoTo "WebBrowser1" "http://www.villagevoice.com/"
.