confused2gether Posted April 2, 2008 Share Posted April 2, 2008 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 More sharing options...
DarkMatter Posted April 2, 2008 Share Posted April 2, 2008 How are you issuing the save command? [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
confused2gether Posted April 2, 2008 Author Share Posted April 2, 2008 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 More sharing options...
DarkMatter Posted April 2, 2008 Share Posted April 2, 2008 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 More sharing options...
confused2gether Posted April 2, 2008 Author Share Posted April 2, 2008 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? AnonymousX 1 Link to comment Share on other sites More sharing options...
DarkMatter Posted April 2, 2008 Share Posted April 2, 2008 (edited) Your correct, that would be behind the scenes. What you have looks correct to me. Edited April 2, 2008 by DarkMatter [sub]Quantum mechanics: The dreams stuff is made of[/sub] Link to comment Share on other sites More sharing options...
zorphnog Posted April 2, 2008 Share Posted April 2, 2008 Seems correct, but to have it save to the desktop change: $File = FileOpen("C:\test.html", 2) to $File = FileOpen(@DesktopDir & "\test.html", 2) Link to comment Share on other sites More sharing options...
confused2gether Posted April 2, 2008 Author Share Posted April 2, 2008 Awesome. Looks all good to me. I will try it out and let you know if I have any issues. Thanks Link to comment Share on other sites More sharing options...
AnonymousX Posted December 29, 2017 Share Posted December 29, 2017 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now