Sign in to follow this  
Followers 0
dreamzboy

Saving a text document

5 posts in this topic

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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

send the full path

...
WinWaitActive("Save As")
Send("c:\programs\asdasd\gnappo.txt")
Send("{ENTER}")
...

Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

Share this post


Link to post
Share on other sites

Thank you so very much from the both of you, especially with the quick response.

got it to work beautifully. Continue learning... :shocked: from the first script that is.

Share this post


Link to post
Share on other sites

you welcome :shocked:


Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key

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