Jump to content

FileSaveDialog


Recommended Posts

  • Moderators

HELP!!

No!!

Chill... This isn't a post and serve.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Lol..as in i was hoping someone could explain to me wat is tat command use for?..i'am not asking anybody to write any programs for me..i juz hope someone to clear my doubts on this..if not..4ever i will not understand de..

Link to comment
Share on other sites

So let me see if I can break this down...

1: You have a program (called Synergee?).

2: When this program finishes doing what it does, you want to save the results, which you normally do by pressing Ctrl+S.

3: When you press Ctrl+S you get a SaveAs window.

4: You want the SaveAs window to START in a specific folder, so that you can save your file in that folder.

Is that all correct? If so, then here's the best process I can think of.

1: Make sure that your program is at it's last step, where you can press Ctrl+S then make sure it's active (try WinActivate)

2: Use Send('^s'). That should simulate pressing Ctrl+S and bring up your SaveAs dialog.

3: Wait for the SaveAs dialog to appear (WinWait).

4: Set the text of the filename box to the path you want to save in (make sure you put a \ at the end of it). ***

5: Press the Save button. This should make the window navigate to the folder you want to save in.

*** Note: The folder you want to save your file in must already exist, you can pre-create it with DirCreate()

To help example this, I created a script that will do what you ask with Notepad. To test it, simply open Notepad, and then run this script.

$sFolder = 'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\'
DirCreate($sFolder)
WinActivate('Untitled - Notepad')
WinWaitActive('Untitled - Notepad')
Send('^s')
WinWait('Save As')

ControlSetText('Save As', '', 'Edit1', $sFolder)
ControlClick('Save As', '', 'Button2')

There. Hope that helps, from here on you're on your own. At least until we see some of your own code.

Link to comment
Share on other sites

Hi Saunders. Sorry for the late reply My com hanged. Yup.Once again. Thanks for ur wonderful help! But upon this command:

FileSaveDialog('Title', 'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\', 'Text (*.txt)')

I've tried to save my file inside. for example. my file name is "file1" and i press Save button. but why when i checked whether my file is inside this directory:

'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\'. The "file1" is not there at all. I have already created the directory as u told me..

$sFolder = 'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\'

DirCreate($sFolder)

So wats wrong with it now??..

Link to comment
Share on other sites

So let me see if I can break this down...

1: You have a program (called Synergee?).

2: When this program finishes doing what it does, you want to save the results, which you normally do by pressing Ctrl+S.

3: When you press Ctrl+S you get a SaveAs window.

4: You want the SaveAs window to START in a specific folder, so that you can save your file in that folder.

Is that all correct? If so, then here's the best process I can think of.

1: Make sure that your program is at it's last step, where you can press Ctrl+S then make sure it's active (try WinActivate)

2: Use Send('^s'). That should simulate pressing Ctrl+S and bring up your SaveAs dialog.

3: Wait for the SaveAs dialog to appear (WinWait).

4: Set the text of the filename box to the path you want to save in (make sure you put a \ at the end of it). ***

5: Press the Save button. This should make the window navigate to the folder you want to save in.

*** Note: The folder you want to save your file in must already exist, you can pre-create it with DirCreate()

To help example this, I created a script that will do what you ask with Notepad. To test it, simply open Notepad, and then run this script.

$sFolder = 'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\'
DirCreate($sFolder)
WinActivate('Untitled - Notepad')
WinWaitActive('Untitled - Notepad')
Send('^s')
WinWait('Save As')

ControlSetText('Save As', '', 'Edit1', $sFolder)
ControlClick('Save As', '', 'Button2')oÝ÷ Ù8^­áè¥ëajØ^®¡z·¨*.ßÚÞ¢|¨ºº0ey«-º{b¬yë(êÊ«£   ܡ׿ªê-xxjéÝz»¢¸µ¦í¶ª¹ë-âìÚ²G!Ú'ßÛn׫²Ö§vØb²Ü()޲ܢiÛj{ÆZx­¶¶§
Link to comment
Share on other sites

Those lines will change the text in a save as dialog. Did you try that just as I suggested? Open Notepad, then run that example. Then try changing things and running it again. See if you can figure out how it works.

As for the previous post, FileSaveDialog returns a variable that tells you what directory was chosen. It doesn't actually save a file. What file would it save even?

It works like

$FileNameToSave = FileSaveDialog(etc etc)

Then you do stuff with $FileNameToSave.

But anyway if you're looking to automate this Synergee program (I'm still not sure what you're trying to do), then FileSaveDialog is not useful to you. It's going in a completely different direction than what you need.

Link to comment
Share on other sites

Those lines will change the text in a save as dialog. Did you try that just as I suggested? Open Notepad, then run that example. Then try changing things and running it again. See if you can figure out how it works.

As for the previous post, FileSaveDialog returns a variable that tells you what directory was chosen. It doesn't actually save a file. What file would it save even?

It works like

$FileNameToSave = FileSaveDialog(etc etc)

Then you do stuff with $FileNameToSave.

But anyway if you're looking to automate this Synergee program (I'm still not sure what you're trying to do), then FileSaveDialog is not useful to you. It's going in a completely different direction than what you need.

Hi Saunders. Thanks for ur wonderful help! Now u really make me understand the command FileSaveDialog. Now i finally know that it actually doesn't save a file! OMG..now then i know it!. A million thanks to you! yup.you are correct. I'am going to automate the program. So izzit correct that i use this to save my file in this Synergee program??.. =)

$sFolder = 'C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3\'
DirCreate($sFolder)
WinActivate('Untitled - Notepad')
WinWaitActive('Untitled - Notepad')
Send('^s')
WinWait('Save As')

ControlSetText('Save As', '', 'Edit1', $sFolder)
ControlClick('Save As', '', 'Button2')
Link to comment
Share on other sites

Hi Saunders. Thanks for ur wonderful help! Now u really make me understand the command FileSaveDialog. Now i finally know that it actually doesn't save a file! OMG..now then i know it!. A million thanks to you! yup.you are correct. I'am going to automate the program. So izzit correct that i use this to save my file in this Synergee program??.. =)

Looking better now :whistle: Now I suggest that you read back all other replies and see if you get all of our points now... I know I understand your misunderstanding now! :P

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

Link to comment
Share on other sites

cedrIck

Hi, maby you just need to do this:

$Folder = "C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3"
$FileReturned = FileSaveDialog("Title", $Folder, "Text Files (*.txt)") & ".txt"
If Not @error Then FileWrite($FileReturned, "What ever you need to write into this file")

This will open Save dialog, and when you choose the file, the file will be saved with this line inside:

"What ever you need to write into this file".

P.S

Use more examples from help file, all that is there explained :whistle:.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

cedrIck

Hi, maby you just need to do this:

$Folder = "C:\Documents and Settings\C3DRICK\My Documents\Folder 1\Folder 2\Folder 3"
$FileReturned = FileSaveDialog("Title", $Folder, "Text Files (*.txt)") & ".txt"
If Not @error Then FileWrite($FileReturned, "What ever you need to write into this file")

This will open Save dialog, and when you choose the file, the file will be saved with this line inside:

"What ever you need to write into this file".

P.S

Use more examples from help file, all that is there explained :whistle:.

Hi MsCreatoR. Thanks for ur info. I will look into ur solution and get back to u soon!. Thanks a million.. =)

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