SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: notepad

  1. #1
    SitePoint Addict
    Join Date
    May 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    notepad

    Hi

    Could someone tell me how to start notepad in javascript with onmousedown

    Thanks

    pat

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    I don't know if you can do it with javascript. But you can with vbscript
    HTML Code:
    <html><head>
    <script language="vbscript">
    set WSHshellObj = Createobject("Wscript.shell")
    WSHshellObj.run "%windir%\notepad.exe", 1, False
    </script></head>
    <body>
    0 Hide the window and activate another window.<br />
    1 Activate and display the window. (restore size and position) Specify this flag when displaying a window for the first time.<br />
    2 Activate & minimize.<br />
    3 Activate & maximize.<br />
    4 Restore. The active window remains active.<br />
    5 Activate & Restore.<br />
    6 Minimize & activate the next top-level window in the Z order.<br />
    7 Minimize. The active window remains active.<br />
    8 Display the window in its current state. The active window remains active.<br />
    9 Restore & Activate. Specify this flag when restoring a minimized window.<br />
    10 Sets the show-state based on the state of the program that started the application.<br />
    </body></html>
    Just put the code in a function and call it with the mousedown event.

  3. #3
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    As far as I am aware, JavaScript will not allow launching of executable code because of the obvious security risks which will be associated with it. JS is relatively sandboxed so it has limited access to your machine to help protect you from such potentially malicious clientside scripting.

  4. #4
    SitePoint Addict
    Join Date
    May 2006
    Posts
    200
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm, thanks but I can't use vbscript, I'm trying to modify a javascript programme.

    Maybe I should expose my problem and see it you can help me.
    I'm using a RTE program (Cross-Browser Rich Text Editor - great little tool) within an admin tool. If the users type in the rte window all works fine. But if they copy/paste from word, there is a lot of formatting garbage that gets pasted in the RTE. For the moment the user needs to paste in Notepad, the copy from notepad, and paste into the RTE window. Too bad there isn't a special copy in word lol. any ideas ?

    I don't know if you can do it with javascript. But you can with vbscript
    Quote Originally Posted by AlexDawson View Post
    As far as I am aware, JavaScript will not allow launching of executable code because of the obvious security risks which will be associated with it. JS is relatively sandboxed so it has limited access to your machine to help protect you from such potentially malicious clientside scripting.

  5. #5
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    You could parse the text and clean it of any formatting; it would strip it of any colors or themes applied to it though. The problem is RTF is notably extremely difficult to work with, I know plenty of developers who would kill for a simple way to work with RTF as opposed to using the RTF specification and wading through hundreds of pages of syntax


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •