Jump to content

Saving a text document


Recommended Posts

Hi, :">

I'm new to scripting. I can program in C, but this is a total new ball game to me. Any help is much appreciated.

First of all, I read the tutorial on this website on opening a text file, write something in it and then close it. Now, what if I wanted to save it in a specific directory?

So I got to here:

Run("notepad.exe")
WinWaitActive("Untitled - Notepad")
Send("This is a test...")
WinClose("Untitled - Notepad")
WinWaitActive("Notepad", "The text in the Untitled file has changed")
Send("!y")
WinWaitActive("Save As")
ControlClick("Save As", "Save &in:", "", "Desktop")
Send("notepad_test.txt","File name:")
Send("!s")

But obviously that didn't work. I can save the file to default directory just fine, but not on my desktop (or wherever I wanted it to be). I've looked at 20 or so pages in the search but found nothing.

I know the error is "ControlClick" but I don't know how to direct the mouse to choose "Desktop". Any help is much appreciated.

Thanks.

Link to comment
Share on other sites

better to save it and then copy/move it to any folder you want...

see

FileCopy

--------------------------------------------------------------------------------

Copies one or more files.

FileCopy ( "source", "dest" [, flag] )

Parameters

source The source path of the file(s) to copy. Wildcards are supported.

dest The destination path of the copied file(s).

flag [optional] this flag determines whether to overwrite files if they already exist.

Can be a combination of the following:

0 = (default) do not overwrite existing files

1 = overwrite existing files

8 = Create destination directory structure if it doesn't exist (See Remarks).

8)

NEWHeader1.png

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