Luacom load and centre a html page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Dean Pryzibilla
    Indigo Rose Customer
    • Apr 2005
    • 5

    Luacom load and centre a html page

    Does anyone know when using the Luacom plugin, if a new IE html window can be loaded not only with set dimensions but also automatically centred on the screen.

    Examples provided show how to load a html window with x,y co-ordinates, width and height, but i want to auto-sense screen size and centre the html window (as one could do with java script).

    Is this possible; if so does anyone have the code.
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6138

    #2
    Here is the raw code (no function yet) of what I came up with to center the I.E. created window. For this example I tested on a system that is running in 1280x1024 and it centered the Popup I.E. window dead center.

    Code:
    [color=#006600]--[[
    
    The code below in bold (aka. darker colored) is the code...
    that I injected into this project originally, I believe, that...
    was put out by forum user TJ-TIGGER. (thanks 'Tigg!)
    
    ]][/color]
    
    [B]tblDisplay = System.GetDisplayInfo()
    	nDisW = tblDisplay.Width/2 [COLOR=DarkGreen]-- ie. 1280x1024 = 640[/COLOR]
    	nDisH = tblDisplay.Height/2  [COLOR=DarkGreen]-- ie. 1280x1024 = 512[/COLOR]
    
    	nIEW = 300
    		nIEWhalf = nIEW/2
    	nIEH = 300
    		nIEHhalf = nIEW/2
    		
    nIEWpos = nDisW - nIEWhalf
    nIEHpos = nDisH - nIEHhalf[/B]
    
    --Create an Instance of IE 
    oIE=luacom.CreateObject("InternetExplorer.Application.1") 
    
    --Navigate to this Website 
    oIE:Navigate2("http://www.amsuser.com") 
    
    --set the menu, adddres, and toolbar to off 
    oIE.Menubar = false; 
    oIE.AddressBar = false; 
    oIE.ToolBar = false; 
    
    --[[ Some other settings to play with ]]-- 
    oIE.Top = [B]nIEHpos[/B]
    oIE.Left = [B]nIEWpos[/B]
    oIE.Width = [B]nIEW[/B]
    oIE.Height = [B]nIEH[/B]
    oIE.FullScreen = false; -- KIOSK MODE or not
    oIE.Resizable = true; --Can't resize the window or can
    -- oIE.StatusBar = true; --turn the statusbar on 
    -- oIE.StatusText = "This will be in the statusbar" --set the statusbar text 
    
    --show IE 
    oIE.Visible = true
    Intrigued

    Comment

    • Intrigued
      Indigo Rose Customer
      • Dec 2003
      • 6138

      #3
      Note: the project (Attachment, .apz) file utilizes the LUAcom plugin that is put out by www.icynorth.com (AMS 5's lead programmer, Brett, runs that Website). Per Brett's Website,
      Support

      There is no technical support provided for this free plugin. Please do not contact me for help with this plugin as I will not provide it.


      However, Brett has linked to a couple/three Websites to help get you started.

      SEE: Attachment
      Attached Files
      Intrigued

      Comment

      • Intrigued
        Indigo Rose Customer
        • Dec 2003
        • 6138

        #4
        One last note: I just uploaded a version to amsuser dot com that utilizes a function and I also took the liberty to clean up the "look" of the code in the project (SEE: Global Functions section). The actually function call (to use the function) is on the On Click event of the button on the project's sole page.

        The updated code base and an example function call (to use the function):

        Code:
        --[[
        
        Below is a function that takes three arguements.
        The first is the Width of the I.E. Object, the ...
        second is the Height of the I.E. Object, and ...
        the third is the Web Address (URL) for the I.E. Object.
        
        ]]
        
        function fnCenIEPopup(nIEW, nIEH, strURL)
        
        	tblDisplay = System.GetDisplayInfo()
        		nDisW = tblDisplay.Width/2 -- ie. 1280x1024 = 640
        		nDisH = tblDisplay.Height/2	-- id. 1280x1024 = 512
        	
        		--nIEW = 300
        			nIEWhalf = nIEW/2
        		--nIEH = 300
        			nIEHhalf = nIEW/2
        			
        	nIEWpos = nDisW - nIEWhalf
        	nIEHpos = nDisH - nIEHhalf
        	
        	--Create an Instance of IE 
        	oIE=luacom.CreateObject("InternetExplorer.Application.1") 
        	
        	--Navigate to this Website 
        	oIE:Navigate2(strURL) 
        	
        	--set the menu, adddres, and toolbar to off 
        	oIE.Menubar = false; 
        	oIE.AddressBar = false; 
        	oIE.ToolBar = false; 
        	
        	--[[ Some other settings to play with ]]-- 
        	oIE.Top = nIEHpos
        	oIE.Left = nIEWpos
        	oIE.Width = nIEW
        	oIE.Height = nIEH
        	oIE.FullScreen = false;
        	oIE.Resizable = true;
        	-- oIE.StatusBar = true; -- turn the statusbar on/off
        	-- oIE.StatusText = "This will be in the statusbar" -- set the statusbar text ("" = set to nothing)
        	
        	--show IE 
        	oIE.Visible = true
        
        end -- ends the function
        
        	-- Here is an example "function call" (to use the function)
        		fnCenIEPopup(600, 600, "http://www.amsuser.com")
        Intrigued

        Comment

        • Intrigued
          Indigo Rose Customer
          • Dec 2003
          • 6138

          #5
          Ha! Ha! So much for the Last Note: idea...

          I also created a function (SEE: Below) that opens the Popup I.E. window (Object) at coorinates X=0 and Y=0 of the AMS 5 project.

          SEE: Attachment (for screenshot)

          Here's the functon:

          Code:
          function fn0X0YIEPopup(nIEW, nIEH, strURL)
          
          tblProjWin = Window.GetPos(Application.GetWndHandle())
          	nProjWinX = tblProjWin.X
          	nProjWinY = tblProjWin.Y
          		
          		--Create an Instance of IE 
          		oIE=luacom.CreateObject("InternetExplorer.Application.1") 
          		
          		--Navigate to this Website 
          		oIE:Navigate2(strURL) 
          		
          		--set the menu, adddres, and toolbar to off 
          		oIE.Menubar = false; 
          		oIE.AddressBar = false; 
          		oIE.ToolBar = false; 
          		
          		--[[ Some other settings to play with ]]-- 
          		oIE.Top = nProjWinY
          		oIE.Left = nProjWinX
          		oIE.Width = nIEW
          		oIE.Height = nIEH
          		oIE.FullScreen = false;
          		oIE.Resizable = true;
          		-- oIE.StatusBar = true; -- turn the statusbar on/off
          		-- oIE.StatusText = "This will be in the statusbar" -- set the statusbar text ("" = set to nothing)
          		
          		--show IE 
          		oIE.Visible = true
          
          end -- ends the function
          Attached Files
          Intrigued

          Comment

          • Dean Pryzibilla
            Indigo Rose Customer
            • Apr 2005
            • 5

            #6
            Originally posted by Intrigued
            One last note: I just uploaded a version to amsuser dot com that utilizes a function and I also took the liberty to clean up the "look" of the code in the project (SEE: Global Functions section). The actually function call (to use the function) is on the On Click event of the button on the project's sole page.

            The updated code base and an example function call (to use the function):

            Code:
            --[[
            
            Below is a function that takes three arguements.
            The first is the Width of the I.E. Object, the ...
            second is the Height of the I.E. Object, and ...
            the third is the Web Address (URL) for the I.E. Object.
            
            ]]
            
            function fnCenIEPopup(nIEW, nIEH, strURL)
            
            	tblDisplay = System.GetDisplayInfo()
            		nDisW = tblDisplay.Width/2 -- ie. 1280x1024 = 640
            		nDisH = tblDisplay.Height/2	-- id. 1280x1024 = 512
            	
            		--nIEW = 300
            			nIEWhalf = nIEW/2
            		--nIEH = 300
            			nIEHhalf = nIEW/2
            			
            	nIEWpos = nDisW - nIEWhalf
            	nIEHpos = nDisH - nIEHhalf
            	
            	--Create an Instance of IE 
            	oIE=luacom.CreateObject("InternetExplorer.Application.1") 
            	
            	--Navigate to this Website 
            	oIE:Navigate2(strURL) 
            	
            	--set the menu, adddres, and toolbar to off 
            	oIE.Menubar = false; 
            	oIE.AddressBar = false; 
            	oIE.ToolBar = false; 
            	
            	--[[ Some other settings to play with ]]-- 
            	oIE.Top = nIEHpos
            	oIE.Left = nIEWpos
            	oIE.Width = nIEW
            	oIE.Height = nIEH
            	oIE.FullScreen = false;
            	oIE.Resizable = true;
            	-- oIE.StatusBar = true; -- turn the statusbar on/off
            	-- oIE.StatusText = "This will be in the statusbar" -- set the statusbar text ("" = set to nothing)
            	
            	--show IE 
            	oIE.Visible = true
            
            end -- ends the function
            
            	-- Here is an example "function call" (to use the function)
            		fnCenIEPopup(600, 600, "http://www.amsuser.com")



            Thanks very much for the prompt and extremely helpfull solution.

            It didn't scale vertically properly at first until I found that there was a mistake here:


            --nIEW = 300
            nIEWhalf = nIEW/2
            --nIEH = 300
            nIEHhalf = nIEW/2


            Should have been:


            --nIEW = 300
            nIEWhalf = nIEW/2
            --nIEH = 300
            nIEHhalf = nIEH/2

            Then the screen centred vertically correctly.

            Thanks again as this solved my problem. :yes

            Comment

            • Corey
              Indigo Rose Staff Alumni
              • Aug 2002
              • 9745

              #7
              The I-man knocks another one out of the park. :yes

              I got busy for a month there with our new products but I'm free now and I'm going to get the designer site up soon so get your banners ready Intrigued because I've definitely got a free slot for you in the rotation. Aw heck, I'll even make you a few if you need them. I just have to get that activation add-on done then I'll get to the design site. The it's onto getting a few more Speedy CDs out.

              :yes

              Comment

              • yosik
                Indigo Rose Customer
                • Jun 2002
                • 1858

                #8
                Thanks for the function, Intrigued. :yes

                Corey, any insights as to the content of the CDs and/or the site?

                Thanks
                Yossi

                Comment

                • Corey
                  Indigo Rose Staff Alumni
                  • Aug 2002
                  • 9745

                  #9
                  The web site will be tutorials, code, and stuff like that all based around design, flash, photoshop, and AMS. I actually have it done I just haven't had time to add stuff and get it online yet. Considering we just released SUF7.0, TU2.0, Autorun MAX 1.0, and VP2.0 beta all within a few months, you guys can just imagine how fast paced it's been. Lot's of fun but busy.

                  The CDs I do first will likely be Photoshop CDs. But it's tricky, everyone wants CS2 and frankly I still use 7.0 because it does everything I need. I've used CS but I actually like 7.0 better. The punchline of course is that very few people who are looking for that "CS2 Training" label have any educational needs which surpass 7.0 anyhow. Plus there's just sooooo much of that stuff around nowadays too, it's hard to get a hook. I was thinking of specialized stuff maybe like, "Building Cool Interfaces", etc. to try and get around that and play to my strengths. Tough call.

                  I'm going to be doing some music stuff too. Brett gave me a great idea to do a, "How to learn sing-a-long guitar" DVD. That's right up my alley. I sat down and worked on it a bit this weekend to see if it's feasible and definitely it is. I think this could be big. Basically it just quickly teaches the core fundamentals that will allow any average Joe to pick up a guitar now and then and be able to play something that sounds halfway decent by following a couple simple rules. I might even do this one first actually. It's easier for me to do music stuff than the Photoshop thing and there's a much bigger audience with less competition. I did a little research on this and I found out that the Mel Bay "How to play campfire guitar" was one of their best sellers and I can easily do a similar DVD which is 100 times better than that old thing. :yes

                  And the best part is that Brett doesn't get a cent. Muhaha!!!

                  Comment

                  • yosik
                    Indigo Rose Customer
                    • Jun 2002
                    • 1858

                    #10
                    Go for it, Corey. I am sure it can be a great product.
                    As to your hesitation about photoshop, I don't think there is a good solution here.
                    Look at Total Training. They are getting the beta version of the next generation WAY ahead of everyone, thanks to their relationship with Adobe. So they are out with the training DVD almost at the same time as the program is out.
                    In your case, I would concentrate in the idea more than the tool. "how to build an interface" sounds a good idea, using the tools in Photoshop (and Freehand/Corel/Illustrator, AND pen and paper...) to achieve the result. Various paradigms, usage of color schemes, workflow design, 2D vs 3D etc...
                    Then, the fact that you would be using ver 7.0 and not CS2 (and by the time you are out, it may be CS3...) is less of a factor. In fact, you could EMPHASIZE the fact that you DON'T need the newest tool in order to achieve a good result.

                    my 0.2....

                    Good luck,

                    Yossi

                    Comment

                    • Intrigued
                      Indigo Rose Customer
                      • Dec 2003
                      • 6138

                      #11
                      Originally posted by Corey
                      The I-man knocks another one out of the park. :yes

                      I got busy for a month there with our new products but I'm free now and I'm going to get the designer site up soon so get your banners ready Intrigued because I've definitely got a free slot for you in the rotation. Aw heck, I'll even make you a few if you need them. I just have to get that activation add-on done then I'll get to the design site. The it's onto getting a few more Speedy CDs out.

                      :yes
                      Swank'nific and I'm looking forward to your new Website! Any insights with those technologies will be much appreciated!

                      :yes
                      Intrigued

                      Comment

                      Working...
                      X