Jump to content

Launch IE as "pop-up"


Hooch
 Share

Recommended Posts

I want to fire up IE and send it to a URL. ok, no prob, however I want it to come up like a js popup with no scroll bars, certain size, and centered etc.

I can't see a way to do it with AutoIt so I tried js but I can only figure out how to do it with a body onload.

This gives me my popup but the parent window stays up and I can't seem to kill it with winclose or winkill.

Can anyone suggest a better way to accomplish this?

Link to comment
Share on other sites

You should be able to add in your java script:

window.close()

after you open the popup. Please do not use autoit to create adware!

*** Matt @ MPCS

<{POST_SNAPBACK}>

Hah, no man, I am working on an internal app for my department, I want a quick way to input a reminder into the DB via webpage, launching it with a hotkey.
Link to comment
Share on other sites

That's good, we don't need AutoIt to be classified as malware again. Did that code help? I am not real familiar with Javascript so I was just going off a hunch.

*** Matt @ MPCS

<{POST_SNAPBACK}>

ah yes that works except for the irritating "someone evil is trying to close this window" prompt.
Link to comment
Share on other sites

If you have control over the popup page's source, I believe you could also use:

javascript:resizeTo(1024,400)

Instead of popping up a window to open a smaller window, just resize the parent with the contents of the child.

*** Matt @ MPCS

Link to comment
Share on other sites

If you have control over the popup page's source, I believe you could also use:

javascript:resizeTo(1024,400)

Instead of popping up a window to open a smaller window, just resize the parent with the contents of the child.

*** Matt @ MPCS

<{POST_SNAPBACK}>

I can do that but then I have to keep all the ugly toobars and scroll bars etc. As well the window wouldn't be centered. I am trying to make this a quick, sexy input form... what would be sooo nice is if you could create an autoit window with the browser display embedded in it. With that type of functionality + web script language of your choice you could really do some sexy stuff.
Link to comment
Share on other sites

Quite simple, have autoit write a page with javascript to open your popup. You can do it minimised if you like, or hidden for that matter. Then once the popup apears, close it.

I have a few posts in Scraps forum to show how to make HTML with autoit, and before we had a good GUI, I used to use HTML for a lot.

Kiosk mode is quite nice for most uses as well.

That link is cool and all Matt@MPCS, but I don't feel like paying just to see how he removed the bars, the code shown is only a resize.

Edited by scriptkitty

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Hooch, I'm not sure if this will help at all.  But if you can rename the page as .hta it will open with no toolbars.

Ian

<{POST_SNAPBACK}>

Heh very cool, unfortunately I need to load a .cfm for the database access.
Link to comment
Share on other sites

@scriptkitty

I don't know what you are talking about because I haven't had to pay anything and I use that site all the time. I know they have pay services but they are not required to read the forum.

*** Matt @ MPCS

<{POST_SNAPBACK}>

Yea I get the same thing as scriptkitty, that resource went pay-to-play awhile ago. I can look at the question but to view the solution I have to "Sign-up"
Link to comment
Share on other sites

Quite simple, have autoit write a page with javascript to open your popup.  You can do it minimised if you like, or hidden for that matter.  Then once the popup apears, close it.

I have a few posts in Scraps forum to show how to make HTML with autoit, and before we had a good GUI, I used to use HTML for a lot.

Kiosk mode is quite nice for most uses as well.

That link is cool and all Matt@MPCS, but I don't feel like paying just to see how he removed the bars, the code shown is only a resize.

<{POST_SNAPBACK}>

Ok, well I tried to play with some of your code from Scraps, trying this but getting errors, its not liking the quotes in the js, I tried to escape them by doubling but no joy...

AutoItSetOption("WinTitleMatchMode", 2)

$title="CloseMe"

dim $x[13]
$x[1]='<HTML><HEAD><title="closeMe"><script>'
$x[2]='<!--'
$x[3]='function popUp(URL) {'
$x[4]='day = new Date();'
$x[5]='id = day.getTime();'
$x[6]='eval("page" + id + " = window.open(URL, '" + id + "', ''toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 440,top = 312'');");'
$x[7]='}'
$x[8]='// End -->'
$x[9]='</script>'
$x[10]='</HEAD>'
$x[11]='<BODY onload="javascript:popUp(''http://opsweb/datacenter/index.cfm?fa=reminders.quickInput'')">'
$x[12]='</body>'
$x[13]='</html>'

$file="popup2.htm"
for $i= 1 to 13
   filewriteline($file,$x[$i])
next

Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE -k '& @ScriptDir &'\'&$file,'',@SW_HIDE)
winclose($title)
FileDelete($file)
Edited by Hooch
Link to comment
Share on other sites

yea, Javascript is really perticular, what I do, is find some character that you never have in your JS, I will use # for now, but many times I use an alt combo, like hold down alt and press 0157 (makes a little square.)

in your editor, change all your quotes into that character.

Then use stringreplace

ex:

$x="bob said #hi there.# 'funny huh?' "
$x=StringReplace($x,"#",'"')
msgbox(1,"result",$x)

See how this helps?

Hell I have done this in all one line.

Post up your JS you like, and I will post how to do it.

here is yours; oh yea, dim $x[13] is $x[0]~$x[12] so use dim $x[14], and I put a delay on, since my computer would delete the file before it loaded it.

AutoItSetOption("WinTitleMatchMode", 2)

$title="CloseMe"

dim $x[14]
$x[1]='<HTML><HEAD><title="closeMe"><script>'
$x[2]='<!--'
$x[3]='function popUp(URL) {'
$x[4]='day = new Date();'
$x[5]='id = day.getTime();'
$x[6]='eval("page" + id + " = window.open(URL, #" + id + "#, #toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 440,top = 312#);");'
$x[6]=StringReplace($x[6],"#","'")
$x[7]='}'
$x[8]='// End -->'
$x[9]='</script>'
$x[10]='</HEAD>'
$x[11]='<BODY onload="javascript:popUp(#http://opsweb/datacenter/index.cfm?fa=reminders.quickInput#)">'
$x[11]=StringReplace($x[11],"#","'")
$x[12]='</body>'
$x[13]='</html>'

$file="popup2.htm"
for $i= 1 to 13
  filewriteline($file,$x[$i])
next

Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE -k '& @ScriptDir &'\'&$file,'',@SW_HIDE)
sleep(1000)
winclose($title)
FileDelete($file)

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

This is the popup js...

<script LANGUAGE="Javascript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 440,top = 312');");
}
// End -->
</script>
Link to comment
Share on other sites

oh yea forgot, you can do this in one variable instead of an array if you like as well.

AutoItSetOption("WinTitleMatchMode", 2)

$title="CloseMe"

dim $x
$x='<HTML><HEAD><title="closeMe"><script>[CRLF]<!--[CRLF]function popUp(URL) {[CRLF]day = new Date();[CRLF]id = day.getTime();[CRLF]eval("page" + id + " = window.open(URL, #" + id + "#, #toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=400,left = 440,top = 312#);");[CRLF]}[CRLF]// End -->[CRLF]</script>[CRLF]</HEAD>[CRLF]<BODY onload="javascript:popUp(#http://opsweb/datacenter/index.cfm?fa=reminders.quickInput#)">[CRLF]</body>[CRLF]</html>[CRLF]'
$x=StringReplace($x,"[CRLF]",@CRLF)
$x=StringReplace($x,"#","'")

$file="popup2.htm"
 FileWriteLine($file,$x)

Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE -k '& @ScriptDir &'\'&$file,'',@SW_HIDE)
sleep(1000)
winclose($title)
FileDelete($file)

StringReplace can do a lot more than a single character. :)

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

ok, here is a script to make your script. :)

; change quotes to #q# and @CRlf to #CR#
; and spit out code
$x=clipget()
$x=StringReplace(StringReplace($x,@CRLF,"#cr#"),'"','#q#')
$out=StringReplace("$x=StringReplace(StringReplace($x,*#cr#*,@CRLF),'#q#','*')",'*','"')
clipput('$x="' & $x & '"' & @CRLF & $out)
msgbox(1,"this will go into memory",'$x="' & $x & '"' & @CRLF & $out)

copy that poppup JS, and run this, and it will put your code into memory

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Yea I get the same thing as scriptkitty, that resource went pay-to-play awhile ago. I can look at the question but to view the solution I have to "Sign-up"

<{POST_SNAPBACK}>

I thought the same at first when I was looking stuff up, but to read the solution just keep scrolling down it has everyones answers below. It has helped me many times.

JS

AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...