Jump to content

FileSaveDialog


Recommended Posts

Hello there, upon the FileSaveDialog command, is there anyway for the directory to select?..like i don't wan to juz select the desktop or my documents..what i want is to select inside folders and inside folders..for example.. Desktop > My Documents > Folder 1 > Folder 2 > Folder 3.. I want the computer to automatically select the sub folder itself..so that it can save in the correct folder..is there anyway i can do it??..please help..thanks.. =)

Link to comment
Share on other sites

Erm..sorry..can u teach me an example of FileSelect Folder?..i'am quite new to this software. The help examples in AutoIT i don't quite understand.. thanks.. =)

$dir = FileSelectFolder("Choose a folder.", "") 
MsgBox (0, "Chosen Dir", "Your Chosen Dir was: " & $dir)
Link to comment
Share on other sites

Sorry..what i meant was like this...for example.if i were to save a file using notepad then i want to select this Folder 3 particulary Desktop > My Documents > Folder 1 > Folder 2 > Folder 3 so that i can save under this folder..this text file to save under folder 3..so how do i get the computer to automically select this Folder 3 so that i can save my text file in it. I dun quite understand ur example..really sorry abt that..hope u can help me furthur more.thanks. =)

Link to comment
Share on other sites

Sorry..what i meant was like this...for example.if i were to save a file using notepad then i want to select this Folder 3 particulary Desktop > My Documents > Folder 1 > Folder 2 > Folder 3 so that i can save under this folder..this text file to save under folder 3..so how do i get the computer to automically select this Folder 3 so that i can save my text file in it. I dun quite understand ur example..really sorry abt that..hope u can help me furthur more.thanks. =)

Like This?

$IntDir = ""
$dir = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"
MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir)
$IntDir = $dir
$dir2 = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"
MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir2)
FileDelete($dir)
FileDelete($dir2)
Link to comment
Share on other sites

Sorry..what i meant was like this...for example.if i were to save a file using notepad then i want to select this Folder 3 particulary Desktop > My Documents > Folder 1 > Folder 2 > Folder 3 so that i can save under this folder..this text file to save under folder 3..so how do i get the computer to automically select this Folder 3 so that i can save my text file in it. I dun quite understand ur example..really sorry abt that..hope u can help me furthur more.thanks. =)

A little help here will do..thanks..the help examples in AutoIT cannot help me..=)

Link to comment
Share on other sites

Like This?

$IntDir = ""
$dir = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"
MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir)
$IntDir = $dir
$dir2 = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"
MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir2)
FileDelete($dir)
FileDelete($dir2)
Like i said.... Like this?
Link to comment
Share on other sites

A little help here will do..thanks..the help examples in AutoIT cannot help me..=)

You mean, writing a file to a location that you know beforehand? And not let the user choose it? Then just don't use a function that is explicitly meant to let the user choose a folder but just hardcode it, or have it read from a system var or something.

For instance, if you want to save something to your (or any other user's) My Documents\folder1\folder2, you could do something like:

$fileHandle = FileOpen(@MyDocumentsDir&"\folder1\folder2\somefile.txt",10)
FileWriteLine($fileHandle,"This line is a test line.")
FileWriteLine($fileHandle,"This file is a test file to write test lines in.")
FileClose($fileHandle)

Might this be what you mean?

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Hi SadBunny. Thanks for ur help..but i juz wan to save my folder. So how do i send the directory to it?..

$fileHandle = FileOpen(@MyDocumentsDir&"\folder1\folder2\somefile.txt",10)

FileWriteLine($fileHandle,"This line is a test line.")

FileWriteLine($fileHandle,"This file is a test file to write test lines in.")

FileClose($fileHandle)

Send($fileHandle)

izzit something like tat??..sorry..i'am quite noob to this software..hope to have ur reply back.. =)

Link to comment
Share on other sites

Like i said.... Like this?

Hi Bert. Thanks for ur help. But i dun understand this part.

$IntDir = ""

$dir = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"

MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir)

$IntDir = $dir

$dir2 = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"

MsgBox(0, "Chosen Dir", "Your first Chosen Dir was: " & $dir2)

FileDelete($dir)

FileDelete($dir2)

Why must FileDelete($dir) , FileDelete($dir2)??...i dun quite understand this part..can u help me to elaborate??..sorry and thanks.. =)

Link to comment
Share on other sites

Hi SadBunny. Thanks for ur help..but i juz wan to save my folder. So how do i send the directory to it?..

[code snip]

Send($fileHandle)

izzit something like tat??..sorry..i'am quite noob to this software..hope to have ur reply back.. =)

Send() sends simulated keystrokes to the active window. Use this to simulate keyboard keystrokes. Not to operate on files.

I'm sorry but it is still a bit unclear what exactly you want to do, even after all your attempts to explain. Might it be that you want to backup a folder? (Btw, folder is the same thing as directory, only 'folder' has been used since GUI-based operating systems started using folder icons to represent directories. Make sure you don't mix that up; if you think they are different then please explain what concepts you mean.)

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

Hi SadBunny. Sorrie abt the confusion. I explain it again. I have a program called Synergee and after doing all the open file doing reports and i have come to the final part of the steps which is saving the file. Normally we press Ctrl+S to save the file and by pressing Ctrl+S, it comes out a Save As box. My question is by using these commands(below), izzit the same as saving by pressing Ctrl+S??..

$IntDir = ""

$dir = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"

And for my that part of question still in my mind is that, I wan the computer to automactically select the folder as in to Save in. For example: "C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3", this is my directory to save my .txt file inside the Folder 3. And if by pressing Ctrl+S, and which command should i use to make the computer select the Folder 3 to save my text file inside??..thanks..i realli need this help..hope to get ur reply soon.. =)

Link to comment
Share on other sites

Hi SadBunny. Sorrie abt the confusion. I explain it again. I have a program called Synergee and after doing all the open file doing reports and i have come to the final part of the steps which is saving the file. Normally we press Ctrl+S to save the file and by pressing Ctrl+S, it comes out a Save As box. My question is by using these commands(below), izzit the same as saving by pressing Ctrl+S??..

$IntDir = ""

$dir = FileSaveDialog("Save", $IntDir, "Text Files (.txt)") & ".txt"

And for my that part of question still in my mind is that, I wan the computer to automactically select the folder as in to Save in. For example: "C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3", this is my directory to save my .txt file inside the Folder 3. And if by pressing Ctrl+S, and which command should i use to make the computer select the Folder 3 to save my text file inside??..thanks..i realli need this help..hope to get ur reply soon.. =)

I think you have some more AutoIt practising to do :-)

Sending a CTRL+S keystroke combo to Windows would be done by Send("^s"), but you cannot modify this command to select a specific folder to save to, since it just sends CTRL+S to some application, starting the default procedure for CTRL+S (meaning, normally, a regular Save File dialog of the application in question).

If you want your app to save something to a specific file using simulated keystroke commands (the Send() function) and the regular file save dialog of the app, you would have to use Send("^s"), BUT you would also need to simulate the keystrokes that you would need to select a folder manually. (I would suggest to send: 1. CTRL+S, 2. The DELETE key (since the save dialog mostly contains something like *.txt but selected, you want to remove that!), 3. The string containing the target folder&file. like C:\Docs\Folder1\Folder2\something.txt. See the Send() help for information how to send that stuff.)

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

I think you have some more AutoIt practising to do :-)

Sending a CTRL+S keystroke combo to Windows would be done by Send("^s"), but you cannot modify this command to select a specific folder to save to, since it just sends CTRL+S to some application, starting the default procedure for CTRL+S (meaning, normally, a regular Save File dialog of the application in question).

If you want your app to save something to a specific file using simulated keystroke commands (the Send() function) and the regular file save dialog of the app, you would have to use Send("^s"), BUT you would also need to simulate the keystrokes that you would need to select a folder manually. (I would suggest to send: 1. CTRL+S, 2. The DELETE key (since the save dialog mostly contains something like *.txt but selected, you want to remove that!), 3. The string containing the target folder&file. like C:\Docs\Folder1\Folder2\something.txt. See the Send() help for information how to send that stuff.)

Erm..sorry again..so meaning that by pressing Ctrl+S, i can't type anything in the Save in icon??..i want my directory to appear in the Save in directory. Is there no way??..meaning the user has to manually select the folder itself??..still blur..

Link to comment
Share on other sites

Hi all, I would realli appreciate it if someone can explain to me abt the FileSaveDialog command. thanks. I would like to ask if i were to use notepad and i written some text into it, and want to save it inside this folder, the directory is "C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3". So is this command appropriate??.. I know by using this FileSaveDialog, it comes out a Save box dialog. But what i want to know is by pressing Ctrl+S, izzit the same as this dialog box??..izzit a program that don't have a Save fuction, thats why we use FileSaveDialog??...is my guess correct?..i hope someone can clear my doubts on this..Thanks.. =)

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