Sign in to follow this  
Followers 0
Rawox

How to save an Notepad File on Desktop?

6 posts in this topic

Hi Guys,

I first readed the FAQ but could not find any answer to this question so I just post it here :)

I made an little script that opens Notepad, types some text and then clicks close -> yes, save it

and then gives an name. I can also make it to work to click on 'Save' so the .txt file is saved.

But I want to always save it on the desktop. Does anyone knows how to do that?

Here is my code:

; Opening Notepad Again for Scan Result Window
Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Sleep ( 400 )
Send("-------------------------------------------------------------------------------------------{ENTER}")
Sleep ( 800 )
Send("| This Scan Was Done By:      Computer Sam.       |{ENTER}")
Send("| Computer Sam from:      Microsoft Office.       |{ENTER}")
Send("| Time past:          13 seconds.         |{ENTER}")
Send("| Typ of Scan:            Time.           |{ENTER}")
Send("| Directory of Saved Log:     Desktop         |{ENTER}")
Send("-------------------------------------------------------------------------------------------{ENTER}")
;Save
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "Do you want to save")
Sleep ( 1 )
Send("!y")
Sleep ( 3000 )
Send("Timescan Log.txt")
Sleep ( 1 )
Send("!De")

Hoping for replys >_<

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Send(@desktopdir & "\Timescan Log.txt")

.. but why not use FileWrite() in stead of using Notepad?

Groet,

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I don't know how to edit it, could u please post the whole script I can't get this to work :)

Share this post


Link to post
Share on other sites

I don't know how to edit it, could u please post the whole script I can't get this to work >_<

Nah.... you have a go and post what you have and what isn't working. :)

(minder werk voor mij)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Do what Jos said first!

$Hand = FileOpen(@DesktopDir & "\timescan Log.txt", 1)

FileWrite($Hand, "-------------------------------------------------------------------------------------------"&@CRLF& _

"| This Scan Was Done By: Computer Sam. |"&@CRLF&"| Computer Sam from: Microsoft Office. |"&@CRLF& _

"| Time past: 13 seconds. |"&@CRLF&"| Type of Scan: Time. |"&@CRLF& _

"| Directory of Saved Log: Desktop |"&@CRLF& _

"-------------------------------------------------------------------------------------------")

FileClose($Hand)

Edited by Alienware

Share this post


Link to post
Share on other sites

Tnx Alienware, with some changes I've got it :)

Share this post


Link to post
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
Sign in to follow this  
Followers 0