topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday December 14, 2024, 5:27 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: DONE: Edit a txt file gui  (Read 11791 times)

Candle

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
DONE: Edit a txt file gui
« on: February 09, 2006, 12:03 PM »
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.yahoo.com
http://www.msncom
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.
So I can change the url links in the txt file.
Been trying this but I suck at this coding. lol



;;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.
Thanks for the help
« Last Edit: February 18, 2006, 02:43 AM by brotherS »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #1 on: February 09, 2006, 12:14 PM »
Hello Candle, wellcome to the donationcoder!
I couldn't understand a one thing about the program you're requesting:
Do you want to edit the links, and then replace them on the url.txt file? In the same places they were before?
Or can the txt file be truncated (deleted) and then, all the links be added to it again?

Candle

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #2 on: February 09, 2006, 12:27 PM »
Each line would be change from what is entered  in the editbox.
I want to use the gui to edit the url's in the  txt file . so they would be replace with the new url that is enter in anyone of the Gui, Add, Edit, x166 y57 w250 h30,
Get what I mean?
Oh ya using autohotkey
« Last Edit: February 09, 2006, 12:30 PM by Candle »

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #3 on: February 09, 2006, 01:22 PM »
I think i got what you were referring to.
Are the urls one per line?
If not, they have one space before and after them, don't they?
Can there be more then one url in the file containing "www.google.com"?

Candle

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #4 on: February 09, 2006, 01:33 PM »
There will only be one per line and none will be the same.
7 lines total.
Thank you for your help

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #5 on: February 09, 2006, 01:37 PM »
Ok, no problem, i should postit still today ;)

Candle

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #6 on: February 09, 2006, 01:40 PM »
Cool. thank you very much.

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #7 on: February 09, 2006, 02:21 PM »
Ok... Check if this fits you ;)
NLines = 7
Loop %NLines%
{
FileReadLine, line, url.txt, %A_Index%
if ErrorLevel <> 0
MsgBox, something went wrong. reading line: %a_index%
Line%A_index%=%line%
}
GoSub GuiShow
return

GuiShow:
;;fill from url.txt
Gui, Add, Text, x130 y62 w100 h30 , Line1
Gui, Add, Text, x130 y97 w100 h20 , Line2
Gui, Add, Text, x130 y137 w100 h20 , Line3
Gui, Add, Text, x130 y177 w100 h20 , Line4
Gui, Add, Text, x130 y217 w100 h20 , Line5
Gui, Add, Text, x130 y257 w100 h20 , Line6
Gui, Add, Text, x130 y297 w100 h20 , Line7

Gui, Add, Edit, x166 y57 w250 h30 vLine1, %Line1%
Gui, Add, Edit, x166 y97 w250 h30 vLine2, %Line2%
Gui, Add, Edit, x166 y137 w250 h30 vLine3, %Line3%
Gui, Add, Edit, x166 y177 w250 h30 vLine4, %Line4%
Gui, Add, Edit, x166 y217 w250 h30 vLine5, %Line5%
Gui, Add, Edit, x166 y257 w250 h30 vLine6, %Line6%
Gui, Add, Edit, x166 y297 w250 h30 vLine7, %Line7%
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
FileDelete, url.txt
Loop, %NLines%
{
  temp := (line%A_Index%)
  FileAppend, %temp%`n, url.txt
}
return

GuiClose:
ExitApp

Candle

  • Participant
  • Joined in 2006
  • *
  • default avatar
  • Posts: 18
    • View Profile
    • Donate to Member
Re: Edit a txt file gui
« Reply #8 on: February 09, 2006, 02:30 PM »
Works great. thank you .