Old 13th February 2004, 17:12   #1
delmardale
Junior Member
 
Join Date: Feb 2004
Location: Alexandria, VA
Posts: 10
Send a message via AIM to delmardale
Question Need to get URL from all open Browser Windows

I am trying to configure a setup that will figured out where it was downloaded from, so it can then go out and download files based on your setup selections. This will be installed at various servers around the world, so URL's can't be hardcoded. The webpage automatically downloads and launches the setup when you go to the page. So I plan to look at URL's of open browser windows to get the server. Anyway I've got the code so far using the System plugin to get the URL from an IE window. However I need a way to loop through all open IE windows. It appears there is a windows API function called EnumWindows which should then callback to the application function. However I can't figure out how to do this in NSIS. Below is code go get the URL from an IE window.

Could someone show me or point me to some examples of how to perform this callback. Or tell me another way I can get the window handles of open IE windows.

Once I tackle IE, then I'll work on Mozilla/Netscape.

FindWindow $hWndIE "IEFrame"
IntCmp $hWndIE 0 done
MessageBox MB_OK "found IE window"
FindWindow $hWndIEChild "WorkerW" "" $hWndIE
FindWindow $hWndIEChild "ReBarWindow32" "" $hWndIEChild
FindWindow $hWndIEChild "ComboBoxEx32" "" $hWndIEChild
System::Call 'user32::SendMessage(i,i,i,t) i($hWndIEChild, ${WM_GETTEXT},255,.r0)'
StrCpy $URLString "$0"
MessageBox MB_OK "$URLString"
delmardale is offline   Reply With Quote
Old 13th February 2004, 17:23   #2
Joost Verburg
NSIS MUI Dev
 
Join Date: Nov 2001
Posts: 3,717
This is really an unreliable method. I recommend you to let it send a command line parameter.
Joost Verburg is offline   Reply With Quote
Old 13th February 2004, 17:44   #3
delmardale
Junior Member
 
Join Date: Feb 2004
Location: Alexandria, VA
Posts: 10
Send a message via AIM to delmardale
Can not do command line, because somehow the URL to download from must be passed. End user can not be expected to know it. Also this setup launches automatically when downloaded from the site. So it's a pretty safe bet that the browser window is still open to the URL. My plan is if it can't find it, it will then prompt the end user for URL
delmardale is offline   Reply With Quote
Old 13th February 2004, 17:47   #4
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You can never be sure what is open and what is not open. You can also not be sure Internet Explorer will be used. I sugggest you append the URL to the installer on the server side, read it from the end of the file on the client side and use it or prompt if not found.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 13th February 2004, 17:55   #5
delmardale
Junior Member
 
Join Date: Feb 2004
Location: Alexandria, VA
Posts: 10
Send a message via AIM to delmardale
Not a bad idea. That will just require appending the server name to the end of the file at each of our 130 sites, annoying but doable. Won't the exe get corrupted though. also have any sample code?

Regarding the browser issue. As of right now we only support IE.
delmardale is offline   Reply With Quote
Old 13th February 2004, 17:58   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You don't have to manually append the URL. Use a PHP script which will output the EXE and then the server's address. It won't corrupt the installer as long as you don't use NSIS_CONFIG_CRC_ANAL.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 14th February 2004, 03:03   #7
rainwater
Senior Member
 
Join Date: Aug 2000
Posts: 397
Send a message via ICQ to rainwater
If you want the open browser windows in Internet Explorer you will have to use DDE. If you don't know what DDE is, then I wouldn't even try it. Its not too bad, but would probably require a plugin. It works on any browsers that support the DDE calls. Probably IE and Opera and maybe a few others.

You would make these DDE requests:
WWW_ListWindows (to get the window)
WWW_GetWindowInfo (to get the window url)
rainwater is offline   Reply With Quote
Old 18th February 2004, 20:04   #8
delmardale
Junior Member
 
Join Date: Feb 2004
Location: Alexandria, VA
Posts: 10
Send a message via AIM to delmardale
Appending data to end of setup and reading it

I've decided to go with kichik's approach of appending server information to the end of the setup dynamically with some sort of CGI script. Anybody got a code sample of how to get my NSIS setup to read this data off the end of the file?
delmardale is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump