How to select a file and then FileAppend?

Get help with using AutoHotkey and its commands and hotkeys
bballjoe12
Posts: 113
Joined: 20 Aug 2017, 09:11

How to select a file and then FileAppend?

29 Jan 2018, 09:08

I'm trying to figure out how to have a GUI button that says, "Save," and when you click the save button, it will open a dialog box to select a file to FileAppend. I can get it to work if I already have the filename but I'd like users to be able to select the file they want to FileAppend via the Windows dialog box or if they want to just save a new file? Would it be possible to either save a new file or FileAppend a file within the same Windows dialog box?
bballjoe12
Posts: 113
Joined: 20 Aug 2017, 09:11

Re: How to select a file and then FileAppend?

29 Jan 2018, 09:43

So do I need to grab the path and then use FileAppend? I can open the dialog box with FileSelectFile but I'm not quite sure where to go after that.
garry
Posts: 1869
Joined: 22 Dec 2013, 12:50

Re: How to select a file and then FileAppend?

29 Jan 2018, 11:13

example saves edit to selected text-file

Code: Select all

#warn
name1=TEST
e4x=
(Ltrim`r`n
Line1
Line2
)

Gui,2:default
Gui,2:Font,s12 ,Lucida Console
Gui,2:Color,Black
Gui,2:Color,ControlColor, Black
Gui,2:add,Edit,   x20   y10  w470 h150  cGray   left   vInp ,%e4x%
Gui,2:add,Edit,   x20   y170 w470 h25   cYellow right  vOut
Gui,2:add,Button, x20   y210 w180 h27 gA1,Fileselect & Save
Gui,2:add,text  , x0 y0 h0 w0 vText0,
Gui,2:Show,x1 y1 w500 h240 ,%name1%
GuiControl, Focus,text0
GuiControl, Focus,inp
send,{end}
Return
;-------------------------------
2GuiClose:
ExitApp

a1:
Gui,2:submit,nohide
FileSelectFile, FL1, 3,%a_desktop%, Choose text file:,Supported Files (*.txt;*.bat)
If FL1 =
   return
stringreplace,inp,inp,`n,`r`n,all
fileappend,%inp%`r`n,%fl1%
run,%fl1%
GuiControl,2:,out ,Text SAVED to %fl1%
return
;------------------------------------------------------------

Return to “Ask For Help”

Who is online

Users browsing this forum: Getfree, Google [Bot], hasantr, HenryCAD and 164 guests