![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Document.parentWindow.Screen.availHeight Hi A friend of my has a picure on his website, which isn't resized on small monitors less 1920 x 1080 px. We tried to avoid the problem in IE8, with this code: <script language="vbScript"> Dim A: A= Document.parentWindow.Screen.availHeight MsgBox A, 4096, " "</script> (Java Script maybe is better, and there should also be some "if then" syntax.) The VBS code work okay, but a new problem is now this one: To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Clik here for options... In other words, Java and vbScript in HTML is not an option in the year 2009! Is the only way to solve our problem, that we use PHP instead of using Java or vbScript code? ? Benny Pedersen, www.fineraw.com/wacky_signs.html |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight hmm, I forgot that the message "To help protect your security, Internet Explorer has restricted"... is not a problem when the HTML page is uploaded. The warning message only pop up when we are running the HTML off-line on our computer. Microsoft should make an Internet settings button: "Turn off warnings about HTML pages, which are viewed off-line"! I figured out the following HTML. The only problem now is that the image is shown twice. When it do the document.write('<IMG SRC="photo/large/f008_large.jpg" height="' + H + '">'); the first image won't go away ![]() I think I can use the <span id="photo"> but I can't remember how to do this. <html> <head> <title>test</title> <script> var H= 700; if (document.parentWindow.screen.height < 802) H= 540; if (document.parentWindow.screen.height < 770) H= 500; document.write('<IMG SRC="photo/large/f008_large.jpg" height="' + H + '">'); </script> </head> <body> <p align="center"> <span id="photo"><img src="photo/large/f007_large.jpg"></span> </p> </body> </html> On 7 Maj, 04:23, Benny Pedersen <b.peder...@xxxxxx> wrote: Quote: > Hi > > A friend of my has a picure on his website, which > isn't resized on small monitors less 1920 x 1080 px. > > We tried to avoid the problem in IE8, with this code: > > <script language="vbScript"> > * Dim A: A= Document.parentWindow.Screen.availHeight > * MsgBox A, 4096, " "> </script> > > (Java Script maybe is better, and there should also be some "if then" > syntax.) > > The VBS code work okay, but a new problem is now this one: > To help protect your security, Internet Explorer has restricted this > webpage from running scripts or ActiveX controls that could access > your computer. Clik here for options... > > In other words, Java and vbScript in HTML is not an option in the year > 2009! > > Is the only way to solve our problem, that we use PHP instead of using > Java or vbScript code? > ? > > Benny Pedersen,www.fineraw.com/wacky_signs.html |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight > The warning message Quote: > only pop up when we > are running the HTML off-line on our computer. > Microsoft should make > an Internet settings button: "Turn off warnings > about HTML pages, > which are viewed off-line"! ![]() www.jsware.net/jsware/iewacky.php5#scrinfo See the download for the IE Local Zone security script in the "Help for the WinXP SP2 IE Problems" section. |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight Thanks Mayayana ![]() Before I can use it, I first have to rewrite it for my personal use. (hope thats ok). I already rewrote some lines. Ehm, why didn't you included the 4096 in the msgBox ? Boo = MsgBox("YES to enable unrestricted scripting in local HTML." & vbLf _ & "NO: Set default IE security.", 4096 +vbQuestion + vbYesNoCancel, "IE local zone restrictions for webpages") if Boo = vbCancel then Set SH = Nothing: WScript.quit else ' Yes and No goes here. On Error Resume Next if Boo = vbYes then SH.RegWrite sPathU & "1200", 0, "REG_DWORD" else SH.RegWrite sPathU & "1200", 0, "REG_DWORD" end if ....SNIP... I think I also will export all the settings (checking and testing) - maybe something was changed in IE8 and Vista... See you later, and thanks for your help ![]() ![]() Benny Pedersen, http://www.fineraw.com/wacky_signs.html On 8 Maj, 04:55, "mayayana" <mayaXXy...@xxxxxx> wrote: Quote: Quote: > > The warning message > > only pop up when we > > are running the HTML off-line on our computer. > > Microsoft should make > > an Internet settings button: "Turn off warnings > > about HTML pages, > > which are viewed off-line"! > They did, but as usual they didn't tell anyone. ![]() > > www.jsware.net/jsware/iewacky.php5#scrinfo > > * See the download for the IE Local Zone security > script in the "Help for the WinXP SP2 IE Problems" > section. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight > Before I can use it, I first have to rewrite it Quote: > for my personal use. (hope thats ok). found it hard to read other people's code until I "translate" it into my own style of formatting and variable naming. For instance, I detest underscores and like "hungarian notation". But I don't doubt that many people probably see my code and want to add underscores to every variable so that *they* can read it. ![]() Quote: > why didn't you included the 4096 in > the msgBox ? I didn't think that it even worked anymore. I guess it's a matter of taste. To my mind setting any window modal is very bad manners. Microsoft does it with their software and applets, apparently because they can't be bothered to code for flexibility. For instance, if I open the "Message Source" window for a given email I can't do anything in OE until I close that window, which means I often have to copy the source into Notepad just so that OE won't block my activities. And that's only app.-modal. If it were possible to make a msgbox truly system modal then you would be unable to, say, refer to a .TXT file before deciding which button to click. I can't see any reason for that. What trouble could someone possibly get into? Even if they stupidly have the Internet Options window open while running your script, that wouldn't affect the script's operation, and, in any case, they couldn't possibly change settings in Internet Options in the time it takes for the script to run. I would be inclined to grant maybe one exception to the system modal msgbox rule, though: Msgbox "Mr. Presdient, my apologies for interrupting Grand Theft Auto. I just wanted to tell you that the attack has begun.", 4144, "From the VP" |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight On 8 Maj, 14:52, "mayayana" <mayaXXy...@xxxxxx> wrote: Quote: Quote: > > Before I can use it, I first have to rewrite it > > for my personal use. (hope thats ok). > * *By all means. I usually do that too. I've always > found it hard to read other people's code until I > "translate" it into my own style of formatting and > variable naming. For instance, I detest underscores > and like "hungarian notation". But I don't doubt that > many people probably see my code and want to add > underscores to every variable so that *they* can > read it. * ![]() > Quote: > > why didn't you included the 4096 in > > the msgBox ? > * *That never occurred to me. I've never used 4096. > I didn't think that it even worked anymore. > > * *I guess > it's a matter of taste. To my mind setting any window > modal is very bad manners. Microsoft does it with > their software and applets, apparently because they > can't be bothered to code for flexibility. For instance, > if I open the "Message Source" window for a given > email I can't do anything in OE until I close that window, > which means I often have to copy the source into Notepad > just so that OE won't block my activities. And that's only > app.-modal. If it were possible to make a msgbox truly > system modal then you would be unable to, say, refer > to a .TXT file before deciding which button to click. I > can't see any reason for that. What trouble could someone > possibly get into? Even if they stupidly have the Internet > Options window open while running your script, that > wouldn't affect the script's operation, and, in any case, they > couldn't possibly change settings in Internet Options in > the time it takes for the script to run. > > * *I would be inclined to grant maybe one exception to > the system modal msgbox rule, though: > > Msgbox "Mr. Presdient, my apologies for interrupting > Grand Theft Auto. I just wanted to tell you that > the attack has begun.", 4144, "From the VP" ![]() Hmm, To reply better on your explanation, I would like that my english was better! Anyway: I use the 4096 to get the msgbox on top of any other windows that could hide the msgbox. I think it was WinXPSP2 that long ago installed an IE while it was hidden by a HTML page. The installation hang until one figured out the "hide a window"-Microsoft "bug"... Anyhow; I found some bugs in your script, which I think you made because of your knowlede about vb applications instead of vbscript (not sure why). I think the "On Error resume next" was the reason that it maybe worked anyway. The following Script will read the Registry keys before modified. You should get his: Current level: Default IE security OK to continue .... Then it is prompting about the two profiles it can set, something like this Yes: to enable unrestricted scripting No: Default IE security If the current profile did not match any of the two profiles that it can write, then a message: Unknown local profile match! is shown in the first message about Current level. The Cancel button can be used to abort the script, so you can read the profile without making system modifications. Like this, you will know if other has changed something. And you will always know that the script can be used to go back as before you executed the script. If the message "Unknown local profile match!" is shown, it will show the unknown profile that it found, (so you can copy it). Benny Pedersen. Tested on Vista, IE8. Works fine! (I used a HTML page and javascript for testing) The script was later used to restore everything back to as before the script was executed. PS: To avoid problems about broken lines, just count to 65 option explicit' "Allow local scripting.vbs", 65 lines, less 4096 bytes ' by Benny Pedersen, www.fineraw.com - The following script is based on work by Mayayana. dim WSO, HKCUZ, HKCUL, RRP, A set WSO= wScript.createObject("wScript.shell") HKCUZ= "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0\" HKCUL= "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Lockdown_Zones\0\" RRP= RegReadProfile(): A= string(2,vbLf) & "OK to continue:" select case RRP case "00000000" A= msgBox("Current level: Unrestricted scripting" _ & A, 4096 +vbInformation +vbOkCancel, "Profile") case "03130100" A= msgBox("Current level: Default IE security " _ & A, 4096 +vbInformation +vbOkCancel, "Profile") case else A= inputBox("Current level: Unknown local profile match!" _ & A, "Info", "' """ & V & """"): if (A = vbEmpty) then A= vbCancel end select if (not A = vbCancel) then A= msgBox("YES to enable unrestricted scripting in local HTML." & vbLf _ & "NO: Set default IE security." _ , 4096 +vbQuestion +vbYesNoCancel +vbDefaultButton3 _ , "IE local zone restrictions for webpages" _ ) select case A case vbYes WSO.regWrite HKCUZ & "1200", 0, "REG_DWORD" WSO.regWrite HKCUL & "1200", 0, "REG_DWORD" WSO.regWrite HKCUZ & "1201", 0, "REG_DWORD" WSO.regWrite HKCUL & "1201", 0, "REG_DWORD" WSO.regWrite HKCUZ & "1400", 0, "REG_DWORD" WSO.regWrite HKCUL & "1400", 0, "REG_DWORD" WSO.regWrite HKCUZ & "CurrentLevel", 0, "REG_DWORD" WSO.regWrite HKCUL & "CurrentLevel", 0, "REG_DWORD" case vbNo WSO.regWrite HKCUZ & "1200", 0, "REG_DWORD" WSO.regWrite HKCUL & "1200", 3, "REG_DWORD" WSO.regWrite HKCUZ & "1201", 1, "REG_DWORD" WSO.regWrite HKCUL & "1201", 3, "REG_DWORD" WSO.regWrite HKCUZ & "1400", 0, "REG_DWORD" WSO.regWrite HKCUL & "1400", 1, "REG_DWORD" WSO.regWrite HKCUZ & "CurrentLevel", 0, "REG_DWORD" WSO.regWrite HKCUL & "CurrentLevel", 0, "REG_DWORD" end select end if set WSO= nothing ' The following 4 lines of information is not verified: ' 1200, Run ActiveX controls and plug-ins. ' 1201, Initialize and script ActiveX controls not ' marked as safe for scripting. ' 1400, Active scripting. function RegReadProfile() dim Ret: Ret= "" Ret= Ret & WSO.regRead(HKCUZ & "1200") Ret= Ret & WSO.regRead(HKCUL & "1200") Ret= Ret & WSO.regRead(HKCUZ & "1201") Ret= Ret & WSO.regRead(HKCUL & "1201") Ret= Ret & WSO.regRead(HKCUZ & "1400") Ret= Ret & WSO.regRead(HKCUL & "1400") Ret= Ret & WSO.regRead(HKCUZ & "CurrentLevel") Ret= Ret & WSO.regRead(HKCUL & "CurrentLevel") RegReadProfile= Ret end function |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight > Anyway: I use the 4096 to get the msgbox on top of any other windows that could hide the msgbox. I think it was WinXPSP2 that long ago installed an IE while it was hidden by a HTML page. The installation hang until one figured out the "hide a window"-Microsoft "bug"... Quote: > My understanding was that Microsoft began blocking system modal functionality in Win98, but I didn't realize that it had an "on top" aspect. Quote: > because of your knowlede about vb applications instead of vbscript (not sure why). I think the "On Error resume next" was the reason that it maybe worked anyway. The following Script will read the Registry keys before modified. You should get his: Current level: Default IE security OK to continue Quote: > the script should warn or quit if the current settings are not either the unrestricted settings or the default? I suppose that's not a bad idea. I was just intending the script to undo all of the restrictions or not. Under normal circumstances none of those settings is visible or accessible, so I didn't see any reason to worry about overwriting custom settings. Quote: > a HTML page and javascript for testing) The script was later used to restore everything back to as before the script was executed. Quote: > Vista. |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight On 10 Maj, 04:05, "mayayana" <mayaXXy...@xxxxxx> wrote: Quote: > Anyway: I use the 4096 to get the msgbox on top of any other windows > that could > hide the msgbox. I think it was WinXPSP2 that long ago installed an IE > while it was hidden > by a HTML page. The installation hang until one figured out the "hide > a window"-Microsoft "bug"... > > > > * *Interesting. Thanks. I didn't know about that. > My understanding was that Microsoft began blocking > system modal functionality in Win98, but I didn't > realize that it had an "on top" aspect. > > > > Anyhow; I found some bugs in your script, which I think you made > because of your knowlede about vb applications instead of vbscript > (not sure why). > I think the "On Error resume next" was the reason that it maybe worked > anyway. > > The following Script will read the Registry keys before modified. You > should get his: > > Current level: Default IE security > OK to continue > > > > * *If I understand you correctly, you're saying that > the script should warn or quit if the current settings > are not either the unrestricted settings or the default? > I suppose that's not a bad idea. I was just intending > the script to undo all of the restrictions or not. Under > normal circumstances none of those settings is visible > or accessible, so I didn't see any reason to worry about > overwriting custom settings. ![]() The script just warn if the current settings are not either the unrestricted settings or the default. It doesn't quit. Since the restrictions or not, under normal circumstances both settings are not visible or accessible, I can understand your script . What I didn'tunderstand most was the IF EXISTS(HKCU\etc...), which I use about files. Vista said Bad Command or filename (or something like that). Also all the keys under HKLM was not accessible in Vista. I don't think WinXP had such a problem. It seems that Microsoft like to change a lot of things... The only new modification to my version of the script, could be "On Error Resume Next" in the function RegReadProfile(), so it should work good the next 30 year, or so ![]() Benny |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight > What I didn't understand most was the IF EXISTS(HKCU\etc...), which I use about files. Vista said Bad Command or filename (or something like that). Quote: > from another script. There should have been this function at the bottom: Function Exists(RegPath) Dim r On Error Resume Next Err.clear r = SH.RegRead(RegPath) If hex(Err.number) = NOEXIST Then Exists = False Else Exists = True End If End Function I had the variable NOEXIST for that function, but neglected to paste in the function itself. Sorry about that. Somehow I read over your post and my script twice, and still missed that error! Quote: > think WinXP had such a problem. It seems that Microsoft like to change a lot of things... Quote: > who wants Vista to be usable for things like VBScript applets really has to be running as Admin. Even then, as I understand it, there's no write/delete access to the System32 folder. I guess that presents a problem if one wants to normally run in "lackey mode" for Internet security purposes. One would need to add the DWORD value: HKLM\SOFTWARE\Policies\Microsoft\Windows\ CurrentVersion\Internet Settings\Security_HKLM_only (Data: 1) That's a hidden setting that was apparently added for corporate admins, as a way to override employee changes without blatantly hiding the Internet Options settings tabs (like AOL does). It causes everyone to have the same settings, coming from the HKLM security keys, so that employees can fiddle as much as they like and yet have no effect on anything! That's why I write these scripts to change 4 different settings...in order not to have to deal with the possibility of Security_HKLM_only being set. The Security_HKLM_only setting, and now the redundant set of lockdown security keys, make IE settings very confusing. I decided that the best way to clarify them [as much as possible] would be to just consider all IE security settings to involve 4 Registry values. (normal and lockdown, HKLM and HKCU.) The alternative on Vista with limited rights would be to only set the HKCU settings (assuming that Vista will let you at the lockdown keys) and just confirm that Security_HKLM_only is not set. The security situation is not much different in XP, but XP doesn't push you to set up a "lackey account", so most people are running as admin. anyway. Also, PCHealth can be removed from XP, and all the restrictions around file access, including Windows File Protection, go with it. (One can then, finally, delete Windows Media Player, Windows Update files, or anything else desired.) I don't know whether the same is possible with Vista. My only experience with Vista so far has been in setting up my elderly father's new PC recently....and I was too busy swatting nonsensical message boxes to think about anything else at the time. ![]() |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Document.parentWindow.Screen.availHeight AHA ![]() Thanks for replying. All problems is now solved. Mayayana: I keep a link to our thread, here: http://www.elementsvillage.com/galle...imageuser=5192 Anyone: Free to grab, and publish the final version: Option Explicit ' Allow local scripting.vbs, 51 lines. ' Script is based on info by Mayayana. ' May 11, 2009. Tested; OS Vista, IE8. ' Benny Pedersen, Web: www.fineraw.com Dim WSO, A, HKCUZ, HKCUL, RRP Set WSO= CreateObject("WScript.Shell") A= "Software\Microsoft\Windows\CurrentVersion\Internet Settings\" HKCUZ= "HKCU\" & A & "Zones\0\" HKCUL= "HKCU\" & A & "Lockdown_Zones\0\" A= vbLf & "OK to continue:" RRP= RegReadProfile() Select Case RRP Case "000" A= MsgBox("Current level: Unrestricted scripting" _ & A, 4096 +vbExclamation +vbOkCancel, "Local Profile") Case "131" A= MsgBox("Current level: Default IE security" _ & A, 4096 +vbInformation +vbOkCancel, "Local Profile") Case Else: A= InputBox("Unknown profile!" _ & A, "Info", "' """ & RRP & """") If (Not A = vbEmpty) Then A= vbOk End Select If A = vbOk Then A= MsgBox("YES enables unrestricted scripting in local HTML" _ & vbLf & "NO: Set default IE security" _ , +4096 +vbQuestion +vbYesNoCancel +vbDefaultButton3 _ , "IE local zone restrictions for webpages") Select Case A Case vbYes RegWriteProfile "000" Case vbNo: RegWriteProfile "131" End Select End If Set WSO= Nothing Sub RegWriteProfile(byVal D) WSO.RegWrite HKCUZ & "1201", cInt(mid(D,1,1)), "REG_DWORD" WSO.RegWrite HKCUL & "1201", cInt(mid(D,2,1)), "REG_DWORD" WSO.RegWrite HKCUL & "1400", cInt(mid(D,3,1)), "REG_DWORD" End Sub Function RegReadProfile() Dim Ret: Ret= "": On Error Resume Next Ret= Ret & WSO.RegRead(HKCUZ & "1201") Ret= Ret & WSO.RegRead(HKCUL & "1201") Ret= Ret & WSO.RegRead(HKCUL & "1400") RegReadProfile= Ret End Function On 10 Maj, 15:06, "mayayana" <mayaXXy...@xxxxxx> wrote: Quote: > What I didn't > understand most was the IF EXISTS(HKCU\etc...), > which I use about files. Vista said Bad Command or filename (or > something like that). > > > > * Woops. I missed that. I must have been copying/pasting > from another script. There should have been this function > at the bottom: > > * Function Exists(RegPath) > * * Dim r > * * *On Error Resume Next > * * * * Err.clear > * * * * r = SH.RegRead(RegPath) > * * *If hex(Err.number) = NOEXIST Then > * * * * Exists = False > * * *Else > * * * * Exists = True > * * *End If > * End Function > > *I had the variable NOEXIST for that function, > but neglected to paste in the function itself. > Sorry about that. Somehow I read over your post > and my script twice, and still missed that error! > > > > Also all the keys under HKLM was not accessible in Vista. I don't > think WinXP had such a problem. > It seems that Microsoft like to change a lot of things... > > > > * Yes. Not much we can do about that. Anyone > who wants Vista to be usable for things like > VBScript applets really has to be running as > Admin. Even then, as I understand it, there's no > write/delete access to the System32 folder. > > * I guess that presents a problem if one wants to > normally run in "lackey mode" for Internet security > purposes. One would need to add the DWORD value: > > HKLM\SOFTWARE\Policies\Microsoft\Windows\ > CurrentVersion\Internet Settings\Security_HKLM_only > (Data: 1) > > * That's a hidden setting that was apparently added > for corporate admins, as a way to override *employee > changes without blatantly hiding the Internet Options > settings tabs (like AOL does). It causes everyone to > have the same settings, coming from the HKLM security > keys, so that employees can fiddle as much as they like > and yet have no effect on anything! > > * *That's why I write > these scripts to change 4 different settings...in order not > to have to deal with the possibility of Security_HKLM_only > being set. The Security_HKLM_only setting, and now > the redundant set of lockdown security keys, make IE > settings very confusing. I decided that the best way to > clarify them [as much as possible] would be to just consider > all IE security settings to involve 4 Registry values. (normal > and lockdown, HKLM and HKCU.) > > * The alternative on Vista with limited rights would be > to only set the HKCU settings (assuming that Vista will > let you at the lockdown keys) and just confirm that > Security_HKLM_only is not set. > > * *The security situation is not much different in XP, > but XP doesn't push you to set up a "lackey account", > so most people are running as admin. anyway. > Also, PCHealth can be removed from XP, and all > the restrictions around file access, including > Windows File Protection, go with it. (One can then, > finally, delete Windows Media Player, Windows > Update files, or anything else desired.) I don't know > whether the same is possible with Vista. My only > experience with Vista so far has been in setting up > my elderly father's new PC recently....and I was too > busy swatting nonsensical message boxes to think > about anything else at the time. ![]() |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| accidentally moved a MS Word document,now it dissapears everytime i open any word document | Vista performance & maintenance | |||
| accidentally moved a MS Word document,now it dissapears everytime i open any word document | Vista General | |||
| View and copy document content without opening the document | Vista General | |||
| View and copy document content without opening the document | Vista performance & maintenance | |||
| document | Vista mail | |||