Create new tab with specified url and new tab with sound when new email

Well, yes, a 1 meg file for just a simple sound? Way too big! You should try to make it smaller.
Most ALL audio editors allow you to set the waves per second. Most likely, yours is set to CD quality.
You do not need that for this project. Try to get it down to about 200k… Or send it to me and I can
do it for you. Try setting it to time out at 20 seconds and see if it closes… My guess is the size…

Go to your “C” drive, Windows folder, Media folder and look at the sound file that is named
“Windows Notify Email” and play it. (right-click and select PLAY) It sounds okay but, it is only 165k…
It would load 8 times faster than your file. And, you can set it to loop five times and it should sound good
enough, I would think… There are a lot of sounds there to try, some are huge like yours, but a lot are much
smaller…

If your sound is special, you can just drop it’s quality to drop the size of it. Also, once the beep windows
goes away correctly, it does not matter if it is on top or not as it will go away after the beep. You just need
to get that timing correct. But, there is another way. You can add a “FOCUS” to your code to make the
current page, IE the page that opens the second pages to focus on itself. That puts the other pages behind
the current one. Now, you could add a pointer variable to the URL page and give it focus instead. Did that
make sense? To bring focus to the current page you add “self.focus();” after you open the two pages. To
add focus to your URL page, you would have to keep a pointer to it with code something like:
Replace:
[php]
window.open(’<?PHP echo $link; ?>’);
[/php]
With something like:
[php]
urlWindow=window.open(’<?PHP echo $link; ?>’);
urlWindow.focus();
[/php]
You most likely will have to move the urlWindow.focus() to after you open both pages, so it might have to
go after you open the beep page…
Hope that helps…

Yes. The focus issue worked instantly. Thanks!

However, I have compressed the sound wav file down to 200kb and changed the timer to 20 secs, but no change. What’s the next step here? If I am to use the loop function, please tell me how and I will cut down the sound file.

Also, on the url opened in the new tab there is a verification code to input. You click the input field and enter the code. However, it takes some time to move the cursor and click the input field. Is it possible to auto-focus on the input field and activate the cursor once the tab is opened?

Thank you very much.

Well, since JS is CLIENT-SIDE only, it runs inside of the browser. That means that if you have a webpage
that is opened by it using a pointer to it, you should be able to set the focus to a certain field in the page.
I have never needed to do that. But, I remember there is a couple of ways to handle it. One would be to
make the opened page use JS to set the focus. That would mean that the URL that you use to open the
page would need to be able to add a JS lfunction to it. The other way would be to use the pointer to the
URL page and set it there. Here is a way that is supposed to work. Something like:
urlWindow.document.getElementById(“TextBoxName”).focus();
BUT, not really sure of the structure of the URL page. It should have an ID for the field, but, it may not!
In that case, you can use a tag name for fields which is “input”. Something like:
urlWindow.document.getElementsByTagName(“input”)[0].focus();
This is supposed to force the new URL window to set it’s focus to the first input field. Seems that either
way should work, by the ID of the input text field or by the first input one. You can always RIGHT-CLICK
on the URL page when it is open and VIEW-SOURCE to look at what the ID of the field is. NOTE: Some
programmers do not always place an ID field into an input field if they are not using Javascript. Therefore,
you would have to use the “bytagname” instead.
I think either way might work for you…

Oh, 200k should be just fine for the sound. Especially if your browser caches it as it will not change going
from one page to the next…

Back to the sound issue… Was your file a WAV or MP3 or what? Either is supposed to work well. But, I was
using a Windows file. Can you test it with the ALARM.WAV file from Windows or the “Windows Notify Email”
one inside the media folder? If you test with that we can be using the same data for testing to figure out
why yours does not work good and mine works great…

I am wondering if it might be a delay when it opens up the two pages. Maybe you need to open the sound
(BEEP) page first and then the URL page? There might be some odd delay while it is loading the remote URL
page and then loads the sound file. Maybe opening the sound file first might speed up the process enough
so it work correctly. Not sure…

Thank you for the input field focus advice. I will give feedback as soon as possible, but I put it here (hope it’s correct):

[php] [/php]

Regarding the sound issue: I am now using the Windows Notify sound of 222kb, and the body tag was already set to open the sound window first, actually (but it does not open the sound window when it is set to open the sound window last - don’t know if this means anything), but it does not close down after 5 secs (I changed the timer from 20 to 5 secs):

[php] [/php]

Heading out on a big job, so will be awhile before I can reply again…
No time for testing right now, sorry.

My guess is that you may need to not switch the focus until after the sound plays.
You might have to place a delay to make the sound page open first, then open the second one.

Also, if the sound window closes at 20 seconds and not at 5 seconds, leave it higher. Since it is just a
notification sound, it does not matter if it takes a little longer to close. If it does not close after 20 seconds,
something else is wrong. My guess is that it is loosing focus and does not finish in time.

I will test it when I get back and see if I can figure it out… Maybe you will solve it before then…

Looking forward to hear from you again, because it still does not work.

I set the timer to 20 secs. I am using the Windows sound. I tried to remove both the tab focus and the input field focus code.

[php] <body <?php if ($ok=="1") echo "ONLOAD='openWindow();open2pages();'";?>>
Checking for new emails…

 <script>
   function open2pages() {

urlWindow=window.open(’<?PHP echo $link; ?>’);
};

[/php]

Sorry, Headfallingoff, for the delay… I recovered my system and the 800,000+ files on it! YIKES!

So, I took all of our previous tests and created this one file version. It is a PHP file as it is set up to test the
variables for your set up. It hard-codes the sound file name. It hard-codes a web site to open as the 2nd
tab. It hard-codes the $ok variable for this testing. It DOES use Javascript to handle opening the 2nd tab
and playing the sound. I tested it on my server and it appears to be working perfectly. All you need to do
to test it is make sure the sound wave file is in the same file as this code. Let us know how it works for you.

I would start with just placing this on your server and test with a wave file. Then, alter your live pages to use
this code. Let us know if this file works on your server and any trouble you have on the live code, too.

testbeep.php
[php]

Test Beep while opening other pages! <?PHP $ok = 1; $link = "http://www.google.com/"; ?> > BEEP test while opening other windows... [/php] When you test it, leave it as-is and you should see the second tab open and the wave-beep page shows up and then goes away after a few seconds. This works as it should. I will look at the tab focus next...

Wellllllllllllllllllll, Setting the focus to a field is NOT easy… It is a huge issue due to how browsers display it’s
pages. The current one showing has focus. So, the previous post which works as it should, will display a
second pop-up page and plays a sound along with opening the second tab. BUT, that means that the pop-up
sound / beep page has taken over focus. Since the second tab has no focus until the pop-up has lost it’s
focus, the second tab can not hold focus. Very complicated…

I have researched this on a hundred sites and nobody actually has solved it. So far, the only solution is to
create your own second tab with the embedded URL placed into an iFrame. In that way, you can set a JS
routine to set focus to the correct field. I do think this is a bit tricky. I will test it. But, I do not see any easy
fix for this part… But, at least the sound and tab works good…

Good to have you and your 800.000 files back!

Good news! This routine works super for me! Thanks a lot.

Please let me know about the focus issue. And embedded URL into an iFrame sounds like a fine plan to me.

Also a bit challenging question: Do you know if there is any way to automatically fill a verification form, you know, the kind where you see some numbers written a bit unclearly and then you type in these numbers to verify that you are not a robot…?

Are you looking for a way to trick a captcha form?

LOL, so, you want to create a robot to get around a non-robot control? LOL Funny !

Not possible as far as I know. Unless you or a friend wrote the code for it.

As far as the high-lighting of a field from a secondary-loaded page, I am not having much luck on it!
Seems that it can be done in Javascript which of course is client-side, but, the problem is knowing when
the page is loaded so the JS can place focus on it. I will try some tests with the iFrame idea. I found that
on a site while researching where someone mentioned it. But, so far, it is not working for me…

Okay, I guess it was a bit far-fetched.

Please let me know, if you solve the focus issue.

Anyway, I am making great use of your “product” so far. Earning important seconds on a daily basis. I am sure we could do serious business together with a more stream-lined product for users, since the Thunderbird email alert service suffers from several time consuming problems, even though its checking intervals are very short, not to mention the fact that it does not automatically click on the link and opens a new tab.

Well, we didn’t really create a product, but… You mentioned Thunderbird. It is a client-side email client.
Which means it is a full program that you install on your computer and it connects to email servers and deal
with it. A bit like web-email systems. There are hundreds of them out there similar to Thunderbird. Once
that is used a lot is Outlook. But, a hand-made app that can do special functions is not hard. But, again,
you didn’t need a desktop app, you needed the online website system. So, not sure if there is really any
money to be made… Not sure…

If you want to talk about this further, send me a private message as it really is not for this thread.

When looking online doing further research of how to automatically highlight a form field, I found hundreds
of ways to do that. But, I just have not got it to work yet. I will do some more research on that as I think
it might help others if I can get it to work correctly.

Sponsor our Newsletter | Privacy Policy | Terms of Service