AutoHotkey Community

It is currently May 27th, 2012, 9:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: February 9th, 2006, 7:38 am 
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.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2006, 11:06 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 23rd, 2006, 11:42 am 
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, Google Feedfetcher, migz99 and 71 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group