Jump to content

Notepad Save file in user desktop directory as HTML


Recommended Posts

I am writing a quick and easy script for creating some HTML signatures and I have it prompt user for info then it launches Notepad and types out all of the code and then saves the file as EmailSignature.html but it always seems to save it in different locations. Is there anyway of making sure that it saves it on the desktop of the current user rather than wherever Notepad's default is?

Link to comment
Share on other sites

How are you issuing the save command?

By closing the file and then using the Save As window.

Windows Vista Version

WinClose("Untitled - Notepad")
WinWaitActive("Notepad")
Send("!s")
WinWaitActive("Save As")
Send("!t")
Send("{RIGHT}")
Send("{RIGHT}")
Send("{ENTER}")
Send("!n")
Send("EmailSignature.html")
Send("{ENTER}")

Windows XP Version

WinClose("Untitled - Notepad")
WinWaitActive("Notepad")
Send("!y")
WinWaitActive("Save As")
Send("!t")
Send("{RIGHT}")
Send("{RIGHT}")
Send("{ENTER}")
Send("!n")
Send("EmailSignature.html")
Send("{ENTER}")

The send right and enter are to select ALL FILES instead of .TXT in the window. If you have a better way I should go, let me know.

Link to comment
Share on other sites

You might not want to do this but why not just write the HTML straight to a file:

Dim $htmlCode
Dim $File

$htmlCode &= "<html>" & @CRLF
$htmlCode &= "<head>" & @CRLF
$htmlCode &= "<title>This is some sample html</title>" & @CRLF
$htmlCode &= "</head>" & @CRLF

$File = FileOpen("C:\test.html", 2)
FileWrite($File, $htmlCode)
FileClose($File)

[sub]Quantum mechanics: The dreams stuff is made of[/sub]

Link to comment
Share on other sites

You might not want to do this but why not just write the HTML straight to a file:

Dim $htmlCode
Dim $File

$htmlCode &= "<html>" & @CRLF
$htmlCode &= "<head>" & @CRLF
$htmlCode &= "<title>This is some sample html</title>" & @CRLF
$htmlCode &= "</head>" & @CRLF

$File = FileOpen("C:\test.html", 2)
FileWrite($File, $htmlCode)
FileClose($File)
Im guessing too that works behind the scenes and is silent which is million times better than what im doing right now lol. Although this is just a simple quickie program, silent would still be nice. Now im guessing that if I needed to have it input information it would be something like this:

$htmlCode &= "<a href = {ASC 034}mailto:" & $emailAddress & "{ASC 034}>" & $emailAddress & "</a>" & @CRLF

$emailAddress would be coming from an inputbox

{ASC 034} is the double quote

Does that seem correct?

Link to comment
Share on other sites

  • 9 years later...
On 4/2/2008 at 7:52 AM, DarkMatter said:

You might not want to do this but why not just write the HTML straight to a file:

Dim $htmlCode
Dim $File

$htmlCode &= "<html>" & @CRLF
$htmlCode &= "<head>" & @CRLF
$htmlCode &= "<title>This is some sample html</title>" & @CRLF
$htmlCode &= "</head>" & @CRLF

$File = FileOpen("C:\test.html", 2)
FileWrite($File, $htmlCode)
FileClose($File)

Almost 10 years later and this post became a lifesaver to me, THANKS!

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...