NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums General General Discussion v
« Previous 1 … 18 19 20 21 22 … 159 Next »
Running a javascript command from Windows Address Bar FOLLOWING the Web address?

 
  • 0 Vote(s) - 0 Average
Running a javascript command from Windows Address Bar FOLLOWING the Web address?
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#11
2011-02-21, 11:33 PM
pBS Wrote:yea, those forums are kinda snobby, makes one appreciate the helpfulness here..Smile
Absolutely...

Quote:hmm, add a ",0" to end of ienavigate lines to not wait for page reload,[cuz it isn't reloading actually,just using javascript to alter what shows up]
[just javascript navigations, not the first one..]
and can go straight to page with first nav, http://www.setanta.com/HongKong/TV-Listings/
That was the magic catalyst! Wow, THANK YOU pBS! I added that to my script to test. It worked (with one thing that I need to delve deeper into wrt Dates**)

Quote:if you waited about 5 mins your script would continue after page timed out..Smile that's why nowait works..

Code:
_IENavigate($oIE,"javascript:__doPostBack('ctl00$cphForm$AllCols$tvlHeader$rptDays$ctl03$btnDay','')",0)
SaveTVxBhtml()
this also saves html, but not as nicely re-formatted as ie saves..
Code:
Func SaveTVxBhtml()
sleep(3000)
$SaveDate = @YEAR&@MON&$MDAYALT
$sHTML = _IEDocReadHTML ($oIE)
filewriteline($savedate & ".html",$sHTML)
endfunc
I'll need to look at that code after work today....

Quote:aha! needed instance 3 not 2 for type, and some other typos etc..uploading working script..Big Grin
I need to check that too, beacuse I found that at work (XP) the Instance for the buttons CHANGED. I am using Vista32 at home and you ",0)" addition alone worked magic.

Be interested in what the other typos are, is there a way to compare scripts where changes are highlighted? Magic ! Made my day, thanks again!

** I need to find a way to harvest the date from the webpage, atthe moment I save using todays date, but Setanta don't change the default page so on the Webpage it says 21st, but I'm saving that date as the 22nd. More to work on, but it's a great start.

Cheers

k.
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#12
2011-02-22, 01:49 AM (This post was last modified: 2011-02-22, 02:20 AM by pBS.)
may be differences based on IE version..probably why the instance changed [or may be os related,saveas dialog is os generated]
you'll run into problems at end of month with manual increments..31 + 1 maybe just use day of week? [monday,tuesday,etc]
i guess just fix it for the os/browser ver. you plan on using it with..i'm on xp here..[but old v6 IE]

here's a file comparison program...i can't find it, so maybe it was my own typo...lol Big Grin
http://www.grigsoft.com/wincmp4.zip

ahh,fixed date issue, by adding a day to current date..
should be date-proof..Big Grin
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#13
2011-02-22, 02:11 AM
yup XP and IE6, that instance is different.
Wrt dates, unfortunately the first page in the site (at least at 7am today) said 21st but here in HK it's already the 22nd. I guess I could wait to run it until they update their pages but it would be more robust to pick off the date in the header.
I also deleted the iecreate line with http://www.setanta.com it was a suggestion on the autoit forum... Not needed at all.

K
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#14
2011-02-22, 02:39 AM (This post was last modified: 2011-02-22, 06:54 AM by pBS.)
i uploaded date-fixed one in post above...Big Grin

i would manually adjust for the timezone difference from today's local date...i don't think it changes but i'm not totally sure..[daylight savings time?]
but for most part it is only way i can see to get the dates..
just add the timezone difference to the current date:
Code:
$savedate = StringLeft(_DateAdd( 'h',6, _NowCalc()),10)
[adds 6 hours] to subtract i think jsut add negative number..Smile
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#15
2011-02-22, 06:57 AM (This post was last modified: 2011-02-22, 07:16 AM by jksmurf.)
pBS Wrote:i uploaded date-fixed one in post above...Big Grin

Hi pBS, cheers again, appreciate your input.

I looked at the code, which looks infinitely more elegant than mine, and I think I can see how it wouldn't go over the 28th or 30th or 31st, but I am still a bit puzzled (call me thick..) how it would fix the issue of the default page on the website http://www.setanta.com/HongKong/TV-Listings/ reporting a day that is 1 day earlier than today's actual date (because they haven't updated it yet)???

Code:
#include <Date.au3>
.
.
$save = _NowCalcDate()
.
.
ControlSend($hSave, "", "[CLASS:Edit; INSTANCE:1]", "TVxb-setanta.hk-" & stringreplace($savedate,"/","-"))
.
.
$savedate = _DateAdd("d",1,$savedate)
.
.

Looking at the HTML source, there is a date next to the button reference which I might be able to harvest (if I can work out how in Autoit) and reference that back to the first $savedate variable.

Code:
href="javascript:__doPostBack('ctl00$cphForm$AllCols$tvlHeader$rptDays$ctl01$btnDay','')">Tue, 22 Feb</a>
This is all on the premise that Setanta get the default page wrong ... in the meantime, I guess I can work out when they update it ... and schedule it to run after that time.

k.
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#16
2011-02-22, 11:28 AM
if you can work out a regex to find the list item [li] that has class="selected" will have the date of the loaded page later in that line Smile
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
jksmurf
Offline

Posting Freak

HK (DMBTH)
Posts: 3,590
Threads: 410
Joined: Jul 2005
#17
2011-02-23, 09:33 AM (This post was last modified: 2011-02-23, 11:11 AM by jksmurf.)
Hi pBS, sorry to bother you again, but noticed something odd with the scripts, all the downloaded files are the same (as the first page).

(I thought) my original script went to each page and did the Javascript operation, in turn and downloaded that - now it seems that is not happening?

Code:
$oIE = _IECreate()
;
_IENavigate($oIE,"http://www.setanta.com/HongKong/TV-Listings/"); _IE that navigates to the first page and waits until "done". ; Opens Setanta Website ...
_IELoadWait($oIE); _IE  loads page and waits until REALLY "Done" to avoid "The Requested Resource Is in Use" Error Messages ...
$hIE = _IEPropertyGet($oIE, "hwnd"); get the 'handle' (hwnd) for the IE window opened.

;
SaveTVxBhtml(); Save the page by calling the Save Routine; InetGet is no good for Javascript pages as for urls only
;
_IENavigate($oIE,"javascript:__doPostBack('ctl00$cphForm$AllCols$tvlHeader$rptDays$ctl02$btnDay','')",0); Return from Save routine and move onto the next day using Javascript command
SaveTVxBhtml() ; Call Save Subroutine again, to save it and then Move onto the next day using Javascript command; Save it; etc etc

Your amended Code:

Code:
$oIE = _IECreate("http://www.setanta.com/HongKong/TV-Listings/",0,0); Open WebPage (Was just $oIE = _IECreate())
;
;
;
_IELoadWait($oIE); _IE  loads page and waits until REALLY "Done" to avoid "The Requested Resource Is in Use" Error Messages ...
_IENavigate($oIE,"http://www.setanta.com/HongKong/TV-Listings/"); _IE that navigates to the first page and waits until "done". ; Opens Setanta Website ...
$hIE = _IEPropertyGet($oIE, "hwnd"); get the 'handle' (hwnd) for the IE window opened.
;
SaveTVxBhtml(); Save the page by calling the Save Routine; InetGet is no good for Javascript pages as for urls only
;
_IENavigate($oIE,"javascript:__doPostBack('ctl00$cphForm$AllCols$tvlHeader$rptDays$ctl02$btnDay','')",0); Return from Save routine and move onto the next day using Javascript command
SaveTVxBhtml() ; Call Save Subroutine again, to save it and then Move onto the next day using Javascript command; Save it; etc etc

Any ideas ??
ASUS STRIX X470-F AMD 2700x 4GHz | Win10Prox64 | 32GB | NVIDIA GEforce GT1030 Fanless | WinTV DMB-TH | WinTV HVR-1280 | Hauppauge Colossus | AC86U/AC68U | USB-UIRT | RPi4 Libreelec | Sony Bravia LCD X9000F Android TV |
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#18
2011-02-23, 04:08 PM (This post was last modified: 2011-02-23, 04:20 PM by pBS.)
hmmm,well i'm getting same thing... maybe add more sleep beginning and end of save func to let it finish loading page..[may just be too fast]
well, i tried adding time but it didn't help...
i do get diff pages with this as save procedure:
Code:
Func SaveTVxBhtml()
sleep(3000)
$sHTML = _IEDocReadHTML($oIE)
filewrite(stringreplace($savedate,"/","-") & ".html",$sHTML)
$savedate = _DateAdd("d",1,$savedate)
sleep(2000)
EndFunc
tho the formatting looks a little different, all the text is there so i'd think it wouldn't care..[all it's grabbing is text,so pics/layout shouldn't matter much]
if the format is ok with TVxB then i'd go with it..

maybe the page saveas dialog only gets what the address shows...[which never changes for this]
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
pBS
Offline

Posting Freak

Posts: 4,829
Threads: 182
Joined: Aug 2005
#19
2011-02-24, 11:05 AM (This post was last modified: 2011-02-24, 11:36 AM by pBS.)
this gets currently loaded page's date [just ## day] Smile
Code:
sleep(3000)
$sHTML = _IEdocReadHTML ($oIE)
$html = StringSplit($sHTML, @CRLF)

for $line in $html
if Stringinstr($line, 'class=selected id=',0,1) then
  $odates = StringRight( StringTrimRight($line, 13), 3)
  msgbox(0,"", $odates)
  exitloop
endif
NEXT
Hardware: HDHR Prime, HDPVR 1212, Raspberry pi2, VFD display w/LCDSmartie
Reddwarf
Offline

Posting Freak

Posts: 6,629
Threads: 230
Joined: Mar 2007
#20
2011-02-24, 11:44 AM
jksmurf: Can your script be modified to harvest data from another webpage that uses javascript to display different days of tv listings? I struggeled with this about a year ago but gave up...

"I'd rather have a bottle in front of me than a frontal lobotomy"
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)

Pages (4): « Previous 1 2 3 4 Next »


Possibly Related Threads…
Thread Author Replies Views Last Post
  Multiple PIP windows in Firefox Graham 0 1,748 2020-09-25, 11:45 AM
Last Post: Graham
  Why Do People Upgrade to Windows 10? ga_mueller 12 8,191 2019-08-11, 01:21 PM
Last Post: Ludron
  Windows 10 Ramdrive for buffer PaulW 1 1,756 2018-10-16, 10:45 PM
Last Post: gEd
  Downgrade Windows Reddwarf 9 4,475 2017-05-26, 07:12 PM
Last Post: tonyjohn29
  Windows 10 Preview removes command prompt p37307 13 5,683 2016-12-10, 03:49 AM
Last Post: johnsonx42
  Windows 10 Update September 29, 2016 — KB3194496 p37307 0 2,647 2016-09-30, 09:32 AM
Last Post: p37307
  Windows 10 Anniversary NPVR fullscreen flicker and freeze fix p37307 1 3,206 2016-08-11, 02:59 AM
Last Post: sub
  windows 10 jrhcom 3 3,308 2015-10-07, 10:43 PM
Last Post: jrhcom
  Windows 10 DVD Player app craigrs84 10 6,752 2015-09-10, 11:06 PM
Last Post: sub
  NPVR getting some props now that Windows Media Center is going away pcostanza 6 4,103 2015-08-24, 10:20 PM
Last Post: johnsonx42

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode