View Full Version : Another tough one... Interaction between Web and AMS
Agent Jones
08-09-2005, 02:22 PM
Hi!
My project interacts with online wizards (which make it easier for me to update certain parts of it). Imagine I load a certain page setup.asp, which retrieves a certain amount of fields from a database and then prints them in a page.
I've seen schemes that allow offline/online component interaction. One of them is the Windows Digital Rights Management. Whenever you are playing protected content, Windows Media Player pops up a window with an embed browser and goes to a license download page.
Here the producer can - for example - authenticate, bla bla. When all that is done, a Javascript system stores a variable X with the license key and then calls a WMP function StoreLicense().
I would like to know if we can have an offline function embed in Autoplay Media Studio, which can be called from a webpage.
Thanks again... I know my questions always involve external components, but they do increase potential in AMS :)
If the web object is inside AMS, then no problem.
Agent Jones
08-09-2005, 04:13 PM
Hm... You really can't stop surprising me :yes
But can you use functions? For example, if I want to pass a variable from the ASP script...
In DRM, I'd use StoreLicense(x)... In here I can't do that, can I?
Thanks again
There are a several ways to go about it, but it's still the same concept. Get the information in the URL so you can detect it in the On Navigate.
Type something in the textbox and click the button. The javascript navigates to a bookmark which lets AMS detect the navigation. The by checking the URL we can pass the info needed into AMS.
Agent Jones
08-10-2005, 04:37 AM
OK... That's good. It only allows me to pass one variable (or I think so, but I should've learned that nothing's impossible with AMS :P ), but that's all I need.
Thanks
Corey
08-10-2005, 04:43 AM
Depending one what you're doing you can pass several pieces of information in a URL. Using that data you can easliy "trigger" any sort of ASP/PHP functions, etc. Using a switch function in PHP is a great way to route functions, I'm not sure what the ASP equivalent is though...
Agent Jones
08-10-2005, 06:30 AM
Depending one what you're doing you can pass several pieces of information in a URL. Using that data you can easliy "trigger" any sort of ASP/PHP functions, etc. Using a switch function in PHP is a great way to route functions, I'm not sure what the ASP equivalent is though...
Thanks for replying.
I know both ASP and PHP, but I'm using ASP because fewer people know it - making exploits harder to find :D
If I understood you well, your suggestion refers to sending data from AMS to the online script... That's the easy part :) What I was asking for was a way to trigger functions embed in the AMS project from the web script...
<body onload="AMSFunction()">
Worm has presented a very nice solution, which I am now exploring... I think I can work with it :)
Again, thanks to you both.
Corey
08-10-2005, 06:40 AM
You can also do that without javascript. Using a refresh meta-tag or named anchor link one can also trigger functions, i.e. index.html#video or index.html#audio and so forth. :yes
It only allows me to pass one variable
The example I did does only sent one variable, but I did that to make it a bit easier. To send more than one variable, use a delimiter in the URL (i.e. test2.htm#variable1:variable2:variable3:variable4)
You could use the existing code in the AMS app I uploaded to get the string of variables, then use the DelimitedStringToTable function (found in your Gallery) to load them into a table for easy processing.
Here's another thread that has been developing into an interesting Web/AMS interaction project.
http://www.indigorose.com/forums/showthread.php?t=12414
Agent Jones
08-18-2005, 10:48 AM
Sorry to "bump" this thread again, but I have a question:
You probably have noticed that I created two threads: one of them asked about the "animated popups" and the other one asked about "interaction between web objects and AMS". Well, it happens that I need to combine both: I need one of those oIE (InternetExplorer.Application Object) to interact with AMS.
I tried to follow the same scheme, but I can't trigger the onNavigate... I know oIE has a simmillar trigger, but I can't use it... Have a look:
if oIE then
blnWait=true;
blnAnimatePopupUp=false;
blnAnumatePopupDown = false;
nWait = 0;
oIE.Quit(nil)
end
--Create an Instance of IE
oIE=luacom.CreateObject("InternetExplorer.Application.1")
if oIE.NavigateComplete then
e_URL = oIE.LocationURL;
nPos = String.Find(e_URL, "#VISIT", 1, false)
if nPos > -1 then
Dialog.Message("Test","Good");
end
end
--Navigate to this Website
oIE:Navigate("http://gsantos.santanhosting.com/assistant/operations/remind.php?days="..dias)
while oIE.Busy do
--wait for navigation to complete
end
--set the menu, adddres, and toolbar to off
oIE.Menubar = false;
oIE.AddressBar = false;
oIE.ToolBar = false;
oIE.StatusBar = false;
oIE.TitleBar = false;
nWidth = 255
nHeight = 338
oIE.Width = nWidth
oIE.Height = nHeight
oIE.FullScreen = false;
oIE.Resizable = false;
--Remove the title bar
n = DLL.CallFunction(_SystemFolder.."\\User32.dll", "SetWindowLongA", oIE.hWnd..",-16,109314048", DLL_RETURN_TYPE_LONG, DLL_CALL_STDCALL)
oIE.Top = tblDisplay.Height
oIE.Left = tblDisplay.Width - nWidth
--Put the window on top
Window.SetOrder(oIE.hWnd, HWND_TOPMOST)
--show IE
oIE.Title = ".................................................. ..."
oIE.Visible = true
blnAnimatePopupUp=true;
I really don't know how to trigger that event...
Thanks for reading.
If you haven't look at the thread I posted earlier, you should. It opens new ways of interacting with the web object.
In your code...
Add the following to your Global Functions:
IE_Events={}
function IE_Events:BeforeNavigate2(pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel)
end
function IE_Events:ClientToHostWindow(CX, CY)
end
function IE_Events:CommandStateChange(Command, Enable)
end
function IE_Events:DocumentComplete(pDisp, URL)
end
function IE_Events:DownloadBegin()
end
function IE_Events:DragDrop(Source, X, Y)
end
function IE_Events:FileDownload(Cancel)
end
function IE_Events:GotFocus()
end
function IE_Events:LostFocus()
end
function IE_Events:NavigateComplete2(pDisp, e_URL)
nPos = String.Find(e_URL, "#VISIT", 1, false)
if nPos > -1 then
Dialog.Message("Test","Good");
end
end
function IE_Events:NavigateError(pDisp, URL, Frame, StatusCode, Cancel)
end
function IE_Events:NewWindow2(ppDisp, Cancel)
end
function IE_Events:OnFullScreen(FullScreen)
end
function IE_Events:OnMenuBar(MenuBar)
end
function IE_Events:OnQuit()
end
function IE_Events:OnStatusBar(StatusBar)
end
function IE_Events:OnTheaterMode(TheaterMode)
end
function IE_Events:OnToolBar(ToolBar)
end
function IE_Events:OnVisible(Visible)
end
function IE_Events:PrintTemplateInstantiation(pDisp)
end
function IE_Events:PrintTemplateTeardown(pDisp)
end
function IE_Events:PrivacyImpactedStateChange(bImpacted)
end
function IE_Events:ProgressChange(Progress, ProgressMax)
end
function IE_Events:PropertyChange(szProperty)
end
function IE_Events:SetSecureLockIcon(SecureLockIcon)
end
function IE_Events:StatusTextChange(Text)
end
function IE_Events:TitleChange(Text)
end
function IE_Events:UpdatePageStatus(pDisp, nPage, fDone)
end
function IE_Events:Validate(Cancel)
end
function IE_Events:WindowClosing(IsChildWindow, Cancel)
end
function IE_Events:WindowSetHeight(Height)
end
function IE_Events:WindowSetLeft(Left)
end
function IE_Events:WindowSetResizable(Resizable)
end
function IE_Events:WindowSetTop(Top)
end
function IE_Events:WindowSetWidth(Width)
end
Then in your main code where you create the IE object, connect to the table of events.
oIE=luacom.CreateObject("InternetExplorer.Application")
luacom.Connect(oIE, IE_Events)
Agent Jones
08-18-2005, 02:36 PM
Thanks for replying... You really can't stop :yes
One final question: do you know the property to hide the window from the taskbar? Here's a screenshot for you to see what I mean.
http://img198.imageshack.us/img198/5717/screenshot7qn.th.jpg (http://img198.imageshack.us/my.php?image=screenshot7qn.jpg)
Thanks again
This uses a DLL I wrote a while back to change the Windows Style to a tool window which removes it from the taskbar :yes
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.