View Full Version : Context menu scripting for Internet Explorer

09-15-2004, 04:49 PM
Hey there,

I'm looking for a solution to my following problem.

I make Advanced Flash Player (see www.afpsupport.r8.org), and I have recently added to it the option to stream SWF files from the internet. However, I need to find a way to add an item to the context menu of internet explorer (I can do this, its a registry key), and then to make that context menu item scan the current webpage for all instances of filenames ending in .SWF.

I hope it's not impossible, this would make my flash player considerably more useful. I can code in VB.NET & Web scripting, but I really need help here.

cr3ative :o

ed: 100th post! :)

09-16-2004, 01:34 PM
Coldfusion, anyone?
I need to know how to implement this so it works. It parses websites for SWF filenames - absoutely perfect for the job. But how do I implement it into a website?

<!--- Find SWF files in cut and pasted source --->

<CFSET OutputMsg = ''>

<!--- Show form if no URL has been put in --->
<CFIF FORM.sourceurl IS ''>

<title>Find link to Flash file in Source Code</title>


<p><b>Find link to Flash files</b></p>

<p>Cut and paste URL of page with Flash file.</p>

<p>To find the URL of a pop-up, right click around the page outside the Flash animation until you get 'Properties' on the bottom of the pop-up menu, then select and copy the URL and paste it below.</p>

<form method="post" action="">
<p>URL: <input type="text" name="sourceurl" size="100" maxlength="200"></p>

<p><input type="Submit" name="Submit" value="Submit"></p>

<p>NB: May not find files which are loaded via Javascript links, but it should do.</p>

<p>If you have the source code of the page, you need the <a href="findinsource.cfm">find in source</a> page.</p>



<!--- Download the source code of the page you're interested in --->
<!--- Imitate Internet Explorer 6 for nefarious reasons --->
<CFHTTP URL="#FORM.sourceurl#"
ResolveURL = "Yes"
TIMEOUT = "120">

<!--- Process HTML code --->
<CFSET ProcessedCode = CFHTTP.FileContent>

<CFIF FindNoCase('.swf', ProcessedCode, 1) GT 0>

<CFSET ProcessStart = 1>

<!--- Look for SWFs ten times --->
<CFLOOP FROM="1" TO="10" INDEX="OverLoop">
<CFSET ThisURL = ''>

<CFIF FindNoCase('.swf', ProcessedCode, ProcessStart) GT 0>

<!--- Take where the .swf is and go back 116 characters --->
<CFSET StartURL = FindNoCase('.swf', ProcessedCode, ProcessStart) - 116>
<CFIF StartURL LT 1>
<CFSET StartURL = 1>

<!--- Cut out 120 character long chunk of HTML, ending in .swf --->
<CFSET ChunkCode = Mid(ProcessedCode, StartURL, 120)>

<!--- Reverse the characters in that code, so fws. is at the start --->
<CFSET ChunkCode = Reverse(ChunkCode)>

<!--- Search for ' and " - the start of the links - first one come across will be start of link --->
<CFSET findthese = "'" & '"'>

<CFIF FindOneOf(findthese, ChunkCode, 1) GT 0>
<CFSET ThisURL = Mid(ChunkCode, 1, FindOneOf(findthese, ChunkCode, 1)-1)>

<!--- Turn URL back around the right way --->
<CFSET ThisURL = Reverse(ThisURL)>

<!--- If it's a relative URL, put right path in front of it --->
<CFIF Mid(ThisURL, 1, 7) IS NOT 'http://'>

<!--- If starts from root directory, put site domain in front of it --->
<CFIF Mid(ThisURL, 1, 1) IS '/'>
<CFSET SitePath = ListGetAt(FORM.sourceurl, 1, "/")>
<CFSET SitePath = SitePath & "//" & ListGetAt(FORM.sourceurl, 2, "/")>

<!--- If is in same directory, put domain and path in --->
<CFSET SitePath = Reverse(FORM.sourceurl)>
<CFSET SitePath = ListRest(SitePath, "/")>
<CFSET SitePath = Reverse(SitePath) & '/'>

<CFSET ThisURL = SitePath & ThisURL>

</CFIF><!--- End of relative URL IF --->

<CFSET OutputMsg = OutputMsg & '<p><a href="#ThisURL#">#ThisURL#</a></p>'>


<!--- Set the place to start looking as just past where a .swf was last found --->
<CFSET ProcessStart = FindNoCase('.swf', ProcessedCode, ProcessStart) + 4>

<!--- If can't find any '.swf' set a different message --->
<CFSET OutputMsg = 'No .swf files listed in source. Bad luck.'>

<title>Discovered links to Flash file in Source Code</title>


<p>Found Flash (.swf) files. Right-click and 'Save Target As...' to save it to your hard drive.</p>


<p><a href="?">Reset</a></p>



I do own Dreamweaver MX 2004, not a clue how to use it, just bought it for school project.


09-21-2004, 02:02 AM
Sorry, I can't open Your website, i got a DNS error.. :(

To use it, You just simply upload that script to Your server. But you have to check whether Your server supports Coldfusion or not. If it doesn't support Coldfusion, then you'll have to find another server side script that is supported by Your server.

By tracing that CF script I can tell that it requests a URL input. Then it returns a list of swf filenames that are used in that URL. Is this really what You want? Sorry if I asked this, but I'm a bit confused with your problem :p

09-21-2004, 01:23 PM
Then it returns a list of swf filenames that are used in that URL. <==-- excellent beautiful excellent.

So do I just upload, and then open the file in my browser, or do I need to HTMLarise it first?


clicky here to view website without DNS error (www.gerryhyh.f2s.com/paul/content)

09-21-2004, 10:13 PM
So do I just upload, and then open the file in my browser, or do I need to HTMLarise it first?

Yup! Just upload and open it in Your browser.
If you get a plain text showing the source code of the script instead of a html, it means that Your server does not support Coldfusion scripting.
If this happens, check Your web hosting package, does it includes support for any server side scripting? If yes, what is it (php, asp, jsp, etc.)?
If it does not support any... well maybe You should get an upgrade... :p

09-22-2004, 01:20 PM

Ah well, looks like Freedom2Surf doesn't support the POST method. Blah.
I'll try to write a program with VB.NET to download an html file and then scan it.
System.Net.wcClient.DownloadFile(source,dest) format I believe.


edit: Lovely, its sorted. This plugin should feature in the next version of Advanced Flash Player (4.5 beta). Tabbed browsing could be a feature :)