www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 09-06-2005, 08:42 PM
    rfaizal rfaizal is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1
    Create Shortcut on Dekstop via Javascript

    Hi,

    I'm currently testing a feature that is enabling a shortcut on the desktop. However, I'm stuck at selecting the icon for the shortcut as by default it will show the IE icon. Can anyone help me on this. This is the coding created for the shortcut

    <script language="Javascript">

    var WshShell = new ActiveXObject("WScript.Shell");
    strDesktop = WshShell.SpecialFolders("Desktop");
    var oShellLink = WshShell.CreateShortcut(strDesktop + "\\shorcut.url");
    oShellLink.TargetPath = "http://myurl.com";
    oShellLink.Save();

    </script>

    Reply With Quote
      #2  
    Old 09-13-2005, 07:54 AM
    Stone_Man Stone_Man is offline
    Registered User
     
    Join Date: Sep 2005
    Posts: 1
    Simply name your icon "favicon.ico" and place it in your root directory.

    Last edited by Stone_Man; 09-13-2005 at 07:58 AM.
    Reply With Quote
      #3  
    Old 09-13-2005, 04:53 PM
    felgall's Avatar
    felgall felgall is offline
    Computer Consultant
     
    Join Date: Mar 2005
    Location: Sydney, Australia
    Posts: 7,979
    You should place that code inside of

    if (ActiveXObject) {}

    in order to avoid errors in browsers that are not IE running on Windows.
    Reply With Quote
      #4  
    Old 09-13-2005, 05:32 PM
    Ultimater's Avatar
    Ultimater Ultimater is offline
    Eccentric Tatertot
     
    Join Date: Jan 2005
    Location: Los Angeles, CA
    Posts: 4,804
    Here's a helpful link to convert your BMPs, PNGs, etc into ICOs FOR FREE! and without downloading software!

    http://www.html-kit.com/e/favicon.cgi
    After you select a picture from your hard-drive and hit the "Generate Favicon.ico" buttoon
    to save the ICO file to your desktop, just click the "download favicon" button and it will download to your desktop as a ZIP file containing both a PNG format preview of your ICO and the actual ICO along with a readme.

    Enjoy!
    __________________
    Ultimater

    XMLHttpRequest:
    Specification | xmlhttp object | open and onreadystatechange order | String.prototype.toXMLDocument | Sarissa | Prototype | Dojo
    Broadening one's horizons:
    24ways.org


    Note I have a bad habit of editing my posts hours at a time and hours later.

    Last edited by Ultimater; 09-13-2005 at 05:35 PM.
    Reply With Quote
      #5  
    Old 09-15-2006, 01:58 PM
    zencoder zencoder is offline
    Registered User
     
    Join Date: Sep 2006
    Posts: 4
    (1) If you want to add a true shortcut in IE, you can create a text file with a .URL extension with its content in INI file format.

    Code:
    [InternetShortcut]
    URL=http://www.webdeveloper.com
    IconIndex=0
    IconFile=C:\MyFolder\MyProgram.exe
    -------
    The icon file can be a .ico or a .exe with an embedded icon.

    Just a guess but to add an icon to your existing code (your code creates the .url file) the following example is from the msdn library:

    Code:
          <script language="JScript">
             var WshShell = WScript.CreateObject("WScript.Shell");
             strDesktop = WshShell.SpecialFolders("Desktop");
             var oShellLink = WshShell.CreateShortcut(strDesktop + "\\Shortcut Script.lnk");
             oShellLink.TargetPath = WScript.ScriptFullName;
             oShellLink.WindowStyle = 1;
             oShellLink.Hotkey = "CTRL+SHIFT+F";
             oShellLink.IconLocation = "notepad.exe, 0";
             oShellLink.Description = "Shortcut Script";
             oShellLink.WorkingDirectory = strDesktop;
             oShellLink.Save();
          </script>
    (2) If you want to add a bookmark in the favorites folder I suggest reading this article: http://scriptasylum.com/tutorials/bookmark.html. A single java script function and an input button should get you there.

    Code:
    <script language="Javascript"> 
      function setBookmark(url,str){
        if(str=='')str=url;
        if (document.all)window.external.AddFavorite(url,str);
        else alert('Press CTRL and D to add a bookmark to:\n"'+url+'".');
    } 
    </script>
    
      <input type="button" value="Add to Favorites" 
        onclick="setBookmark( self.location.href , document.title )">
    -- Britton LaRoche

    Last edited by zencoder; 09-20-2006 at 11:13 AM.
    Reply With Quote
      #6  
    Old 09-15-2006, 03:02 PM
    zencoder zencoder is offline
    Registered User
     
    Join Date: Sep 2006
    Posts: 4
    Bookmarks in Mozilla, Firefox and Opera

    This handy script adds a bookmark link for mozilla opera and firefox:

    Code:
    <script language="JavaScript1.2" type="text/javascript"> 
    
    function AddBookmarkLink() { 
     	title = "Webpage Title";   
     	url = "Webpage URL";  
     
    	if (window.sidebar) { 
    	   // Mozilla Firefox Bookmark		
    	   window.sidebar.addPanel(title, url,"");	
    	} else if( window.external ) { 
    	   // IE Favorite		
    	   window.external.AddFavorite( url, title); 
    	} else if(window.opera && window.print) { 
    	   // Opera Hotlist		
    	   return true; 
    	} 
    } 
    	
    if (window.external) {  
       document.write('<a href ="javascript:AddBookmarkLink()");">Add to Favorites</a>');   
    } else  if (window.sidebar) {  
      document.write('<a href =     "javascript:AddBookmarkLink()");">Bookmark Page</a>');  
    } else if (window.opera && window.print) {	   
      document.write('<a href =     "javascript:AddBookmarkLink()");">Add Bookmark</a>'); 
    } 
    	  
    </script>

    Last edited by zencoder; 09-20-2006 at 11:08 AM.
    Reply With Quote
      #7  
    Old 09-16-2006, 12:13 AM
    Kravvitz Kravvitz is offline
    CSS & JS/DOM Adept
     
    Join Date: Jul 2005
    Location: USA
    Posts: 3,913
    Check out this: The Ultimate Add Bookmark Script

    zencoder, please read Guidelines and Suggestions for Posting on Web Development Forums.
    __________________
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.
    Reply With Quote
      #8  
    Old 09-18-2006, 11:43 AM
    zencoder zencoder is offline
    Registered User
     
    Join Date: Sep 2006
    Posts: 4
    Kravitz,

    Quote:
    Originally Posted by Kravvitz
    Now that is a nice script! I looked at the license, we able to use that script in commercial applications?

    I am new. Forgive me, was I cross posting? I found this link looking for a decent bookmark javascript example. I found the answer to a windows short cut and I thought I'd try to help answer both questions.
    Reply With Quote
      #9  
    Old 09-19-2006, 12:14 PM
    Kravvitz Kravvitz is offline
    CSS & JS/DOM Adept
     
    Join Date: Jul 2005
    Location: USA
    Posts: 3,913
    Quote:
    Originally Posted by zencoder
    Now that is a nice script! I looked at the license, we able to use that script in commercial applications?
    The license says that you can negotiate for its use in commercial applications -- you would probably need to pay a fee.

    Quote:
    Originally Posted by zencoder
    I am new. Forgive me, was I cross posting?
    No, I linked to that because you didn't use the [code] tags.
    __________________
    Learn CSS. | SSI | PHP includes | X/HTML Validator | CSS validator | Dynamic Site Solutions

    Design/program for Firefox (and/or Opera), apply fixes for IE, not the other way around.

    Check out my blog.
    Reply With Quote
      #10  
    Old 09-20-2006, 11:09 AM
    zencoder zencoder is offline
    Registered User
     
    Join Date: Sep 2006
    Posts: 4
    Quote:
    Originally Posted by Kravvitz
    I linked to that because you didn't use the [code] tags.
    Sweet! You rock Kravitz!

    Thanks for the tip!
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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 Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 07:00 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.