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 

ReadFile and stringsplit

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



Joined: 15 Jul 2006
Posts: 29

PostPosted: Wed Sep 19, 2007 5:29 am    Post subject: ReadFile and stringsplit Reply with quote

I'm attempting to read lines in a file and use those lines for WinClose, however, I don't seem to be getting the string split properly. Sad

BTW, the reason I'm using fileread is so I don't have to open the file again until/unless it's edited.

Code:

FileRead, contents, windowkiller.ini
winkills = %contents%
StringSplit, KillerArray, winkills, `,

Loop, %KillerArray0%
{
   
    windowtokill := KillerArray%a_index%
    msgbox, 0, test, Line is %windowtokill%
    IfWinExist, %windowtokill%
    winclose
    sleep 500
    }
Back to top
View user's profile Send private message
BoBoĻ
Guest





PostPosted: Wed Sep 19, 2007 6:11 am    Post subject: Reply with quote

Code:
FileRead, content, windowkiller.ini

Loop, Parse, content, `n
{
    StringSplit, KillerArray, A_LoopField, =
    MsgBox, 0, Test, Window is named %KillerArray2%
    IfWinExist, %KillerArray2%
       Winclose
    Sleep 500
    }
Back to top
engunneer



Joined: 30 Aug 2005
Posts: 6856
Location: Pacific Northwest, US

PostPosted: Wed Sep 19, 2007 2:59 pm    Post subject: Reply with quote

please post an example windowkiller.ini that you expect to work. Also note that by giving it an ini name, you imply to some people the ini file format.

Code:

Loop, read, windowkiller.ini
{
    IfWinExist, %A_LoopFileReadLine%
       Winclose
    Sleep 500
}

_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
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