Jump to content

How to save an Notepad File on Desktop?


Rawox
 Share

Recommended Posts

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

Link to comment
Share on other sites

  • Developers

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

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

Groet,

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

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)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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