AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

getting info for a txt file

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
3334345
Guest





PostPosted: Thu Feb 09, 2006 7:38 am    Post subject: getting info for a txt file Reply with quote

I have this litle gui that I want to grab some links out of a txt file they are like this in the file:
http://www.google.com
http://www.google.com
http://www.google.com
etc
So anyways I want to have each link go into each editbox 7 of them.
Then edit the urls in the editboxs and have the save button save it back to the url.txt file.
Been trying this but I suck at this coding. lol

Code:

; Generated using SmartGUI Creator 3.5.1
;;fill from url.txt
Gui, Add, Text, x130 y62 w100 h30 , Link 1
Gui, Add, Text, x130 y97 w100 h20 , Link 2
Gui, Add, Text, x130 y137 w100 h20, Link 3
Gui, Add, Text, x130 y177 w100 h20, Link 4
Gui, Add, Text, x130 y217 w100 h20, Link 5
Gui, Add, Text, x130 y257 w100 h20, Link 7
Gui, Add, Text, x130 y297 w100 h20, Link 8

Gui, Add, Edit, x166 y57 w250 h30,
Gui, Add, Edit, x166 y97 w250 h30,
Gui, Add, Edit, x166 y137 w250 h30, 
Gui, Add, Edit, x166 y177 w250 h30, 
Gui, Add, Edit, x166 y217 w250 h30,
Gui, Add, Edit, x166 y257 w250 h30,
Gui, Add, Edit, x166 y297 w250 h30,
Gui, Add, Button, x50 y337 w100 h30, Save
Gui, Add, Text, x196 y7 w140 h30,Link Editor
Gui, Show, x249 y99 h388 w452, Link Editor
Return

buttonsave:
;;url.txt
GuiClose:
ExitApp

Anyone feel like helping me code this.
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Thu Feb 09, 2006 11:06 am    Post subject: Reply with quote

First I would suggest to place the code you have into a subroutine, e.g. "BuildGui:". Please add to each Edit control a varaiable (v-Label) e.g. vEdtUrl1.

Next thing I want to suggest is create a basic structure for the autoexec section (the first in every script).
Code:
;My first script

;Read data from file
GoSub ReadData

;Create GUI
GoSub, BuildGui
Return
;end of auto-exec-section

;all other code goes below this point


So the next thing would be to read the data form file. This code goes into the "ReadData:" subroutine. The command you are looking for is "Loop,Read".

The "buttonsave:" subroutine, will need a "Gui,Submit" and then a "FileAppend" and a Return at the end.

Please look up the commands in the manual and try. Post again if you have problems.
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
garry_guest
Guest





PostPosted: Thu Feb 23, 2006 11:42 am    Post subject: Reply with quote

Code:
;-- 2005-02-23 test1.ahk
;-- edit,correct,overwrite,save
F1=URL.TXT
I=0
loop,7
      {
     I+=1
     FileReadLine, line, %F1%, %i%
     If Errorlevel <> 0
     GoTo,EX3
     A%I%=%LINE%
      }
EX3:

Gui, Add, Text, x130 y62  w100 h30, Link 1
Gui, Add, Text, x130 y97  w100 h20, Link 2
Gui, Add, Text, x130 y137 w100 h20, Link 3
Gui, Add, Text, x130 y177 w100 h20, Link 4
Gui, Add, Text, x130 y217 w100 h20, Link 5
Gui, Add, Text, x130 y257 w100 h20, Link 6
Gui, Add, Text, x130 y297 w100 h20, Link 7


Gui, Add, Edit, x166 y57  w250 h30 vA1,%A1%
Gui, Add, Edit, x166 y97  w250 h30 vA2,%A2%
Gui, Add, Edit, x166 y137 w250 h30 vA3,%A3%
Gui, Add, Edit, x166 y177 w250 h30 vA4,%A4%
Gui, Add, Edit, x166 y217 w250 h30 vA5,%A5%
Gui, Add, Edit, x166 y257 w250 h30 vA6,%A6%
Gui, Add, Edit, x166 y297 w250 h30 vA7,%A7%


Gui, Add, Button, x50 y337 w100 h30, Save
Gui, Add, Text, x196 y7 w140 h30,Link Editor
Gui, Show, x249 y99 h388 w452, Link Editor
Return

buttonsave:
gui,submit,nohide
FILEDELETE %F1%
ifNotExist, %A_ScriptDir%\%F1%
fileappend,%A1%`r`n%A2%`r`n%A3%`r`n%A4%`r`n%A5%`r`n%A6%`r`n%A7%`r`n,%F1%
GuiClose:
ExitApp
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group