star2 Posted April 25, 2007 Share Posted April 25, 2007 (edited) hi guys this is the new question again I have Input + Edit control, wich I want to export text intered inside them to a [ test.inf ] file with a certain path using the GUI button I need to know how to do this with ur help ppl here's my GUI #include <GUIConstants.au3> GUICreate ("test", 300,250) GUISetFont (12) GUICtrlCreateLabel ("one line input",4,4) $put1 = GUICtrlCreateInput ("",4,25,200,25) GUICtrlCreateLabel ("Multi line input",4,60) $put2 = GUICtrlCreateEdit ("",4,80,150,100) $send = GUICtrlCreateButton ("send all to file",4,215,150,25) GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd note: what I need is when I press the GUI button it will create a file named test.inf replacing any existed file containing the text entered inside the [ input + edit controls ] let's see who's ganna save the day ... Edited April 25, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
Zedna Posted April 25, 2007 Share Posted April 25, 2007 (edited) #include <GUIConstants.au3> GUICreate("test", 300, 250) GUISetFont(12) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData() WEnd Func SendMyData() FileDelete('test.inf') $data = GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) FileWrite('test.inf', $data) MsgBox(0,'Info','Data written to test.inf') EndFunc Edited April 25, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
star2 Posted April 25, 2007 Author Share Posted April 25, 2007 thank u so much I love the way u made it very simple thank u again it worked just fine thanks I would realy love to get ur help regarding how to make a select file button cuse my GUI will select the user file and replace it with another but I don't wanna bother u now thanks alot [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
lordofthestrings Posted April 25, 2007 Share Posted April 25, 2007 with this code the top input field works.. #include <GUIConstants.au3> $nr = 0 GUICreate("test", 300, 250) GUISetFont(12) GUICtrlCreateLabel("one line input", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) GUICtrlCreateLabel("Multi line input", 4, 60) $put2 = GUICtrlCreateEdit("", 4, 80, 150, 100) $send = GUICtrlCreateButton("send all to file", 4, 215, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop If $msg = $send Then SendMyData() WEnd Func SendMyData() $nr =+ 1 FileDelete('test.inf') $data = GUICtrlRead($put1) & @CRLF & @CRLF & GUICtrlRead($put2) IniWrite( "test.inf", "TMPSection", $nr, $data) MsgBox(0,'Info','Data written to test.inf') EndFunc have to look into why the bottom one doesnt work correctly.. Link to comment Share on other sites More sharing options...
lordofthestrings Posted April 25, 2007 Share Posted April 25, 2007 to get the user file, make sure the filename is created with @username then you can do this without a selection box for the file, let the script decide by the user that launched it, which file to select.. Link to comment Share on other sites More sharing options...
Zedna Posted April 25, 2007 Share Posted April 25, 2007 I would realy love to get ur help regarding how to make a select file buttoncuse my GUI will select the user file and replace it with anotherbut I don't wanna bother u now thanks alotLook into HelpFile at FileSaveDialog() function Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
star2 Posted April 25, 2007 Author Share Posted April 25, 2007 (edited) thanks for all the replies here's the GUI #include <GUIConstants.au3> #include <GUIConstants.au3> GUICreate("test", 500, 100) GUISetFont(12) GUICtrlCreateLabel("please select your picture", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) $open = GUICtrlCreateButton("select picture", 210, 25, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $open Then FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)") EndIf WEnd what I want is to select an *.bmp image using the select button and the input control will be = image path Edited April 25, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
piccaso Posted April 25, 2007 Share Posted April 25, 2007 #include <GUIConstants.au3> GUICreate("test", 500, 100) GUISetFont(12) GUICtrlCreateLabel("please select your picture", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) $open = GUICtrlCreateButton("select picture", 210, 25, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $open Then $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)") If Not @error Then GUICtrlSetData($put1,$sFile) EndIf WEnd CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map Link to comment Share on other sites More sharing options...
star2 Posted April 25, 2007 Author Share Posted April 25, 2007 (edited) oo welcome piccaso I new it and I really love it when u come along and do ur magic thank you I want to ask u one more question if I added a save button and wanted it to save a copy of the selected image to a spicific path can u help with this #include <GUIConstants.au3> GUICreate("test", 500, 100) GUISetFont(12) GUICtrlCreateLabel("please select your picture", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) $open = GUICtrlCreateButton("select picture", 210, 25, 150, 25) $save = GUICtrlCreateButton("Save", 210, 55, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop if $msg = $open Then $sFile = FileOpenDialog ("open image", @DesktopDir , "images (*.bmp)") If Not @error Then GUICtrlSetData($put1,$sFile) EndIf WEnd Edited April 25, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 25, 2007 Moderators Share Posted April 25, 2007 Something like this? #include <GUIConstants.au3> GUICreate("test", 500, 100) GUISetFont(12) GUICtrlCreateLabel("please select your picture", 4, 4) $put1 = GUICtrlCreateInput("", 4, 25, 200, 25) $open = GUICtrlCreateButton("select picture", 210, 25, 150, 25) $save = GUICtrlCreateButton("Save", 210, 55, 150, 25) GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $open $sFile = FileOpenDialog("open image", @DesktopDir, "images (*.bmp)") If Not @error Then GUICtrlSetData($put1, $sFile) EndIf Case $save If GUICtrlRead($put1) <> "" Then $sDest = FileSaveDialog("Save Image", @DesktopDir, "Images (*.bmp)", 16) If Not @error Then FileCopy($sFile, $sDest, 9) EndIf EndIf EndSwitch WEnd Link to comment Share on other sites More sharing options...
star2 Posted April 26, 2007 Author Share Posted April 26, 2007 (edited) thank you big daddy actually I've used this way FileCopy ($sFile ,@DesktopDir & '\new.inf',1) it's very simple cause I wanted the save button to save a copy without showing a save dialog and it worked just fine thank you again Edited April 26, 2007 by star2 [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
BrettF Posted April 26, 2007 Share Posted April 26, 2007 thank you big daddy actually I've used this way FileCopy ($sFile ,@DesktopDir & '\new.inf',1) it's very simple cause I wanted the save button to save a copy without showing a save dialog and it worked just fine thank you again Correct me if I'm wrong, but isn't that what big_d used?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
star2 Posted April 26, 2007 Author Share Posted April 26, 2007 Correct me if I'm wrong, but isn't that what big_d used??yes he did and I used his way that's why I'm thankful to him !!I only declared that I made it without the save dialogand I thank big-daddy and u also Bert [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
BrettF Posted April 26, 2007 Share Posted April 26, 2007 yes he did and I used his way that's why I'm thankful to him !!I only declared that I made it without the save dialogand I thank big-daddy and u also Bert Good job on finding the answer in the end Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
MHz Posted April 26, 2007 Share Posted April 26, 2007 Good job on finding the answer in the end Gosh, the others do the work and you even get some praise, wow. Link to comment Share on other sites More sharing options...
BrettF Posted April 26, 2007 Share Posted April 26, 2007 Gosh, the others do the work and you even get some praise, wow. Kinda ironic world A perfect place perhaps?? Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
star2 Posted April 26, 2007 Author Share Posted April 26, 2007 Gosh, the others do the work and you even get some praise, wow. oo just give me a break I'm new here and I'm trying to learn cause Autoit is greatI've only started using it few days after joining the forum :"> [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
MHz Posted April 26, 2007 Share Posted April 26, 2007 oo just give me a break I'm new here and I'm trying to learn cause Autoit is greatI've only started using it few days after joining the forum :">I just was having some fun with Bert about his praised effort.Looks like you made some typo's in your code in the other topic. With a nice editor like Scite4AutoIt3, then making simple typo's should not happen too easy. Have a good look on the download page for it if you need to. AutoIt is great and if you commit time to learning then you will be much better latter on. Link to comment Share on other sites More sharing options...
star2 Posted April 28, 2007 Author Share Posted April 28, 2007 I just was having some fun with Bert about his praised effort.Looks like you made some typo's in your code in the other topic. With a nice editor like Scite4AutoIt3, then making simple typo's should not happen too easy. Have a good look on the download page for it if you need to. AutoIt is great and if you commit time to learning then you will be much better latter on. I thought the (praised) thing was about me - anyway thanks for the advice ... [quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now