utterlyconfused Posted February 7, 2007 Share Posted February 7, 2007 First of all I'm new to Autoit and it is refreshing to see that there is a community that is willing to help the noobs out with their coding misadventures. My question, I hope it's an easy solve for most of you, is that I created a function that will create some buttons based on a search in a directory for a specific file name. What happens is my buttons get named the same as the file names. What should happen is if I click on any of the buttons, Notepad runs and opens the specific file based on the button. Here's the code: FUNC SearchServer() $xlocation = 20 $ylocation = 145 $width = 100 $height = 20 $i = 0 FileChangeDir("H:\common") $search = FileFindFirstFile("*.txt") While $i <= 10 $filearray[$i] = FileFindNextFile($search) $PXEarray[$i] = $filearray[$i] If @error Then $i = $i - 1 ExitLoop Else $i = $i + 1 EndIf Wend $i = 0 While $i <= 10 If $filearray[$i] = "" Then ExitLoop Else If $i = 5 Then $xlocation = 200 $ylocation = 150 EndIf $filearray[$i] = StringUpper($filearray[$i]) GuICtrlCreateButton($filearray[$i], $xlocation, $ylocation, $width, $height) GUICtrlSetOnEvent(-1, "PXEbuttonexec") $t = FileGetTime($filearray[$i],1) $date = $t[1] & "/" & $t[2] & "/" & $t[0] GUICtrlCreateLabel($date,$xlocation + 110,$ylocation,70,20) EndIf $ylocation = $ylocation + 25 $i = $i + 1 Wend Link to comment Share on other sites More sharing options...
someone Posted February 7, 2007 Share Posted February 7, 2007 (edited) Is it just me or do you get syntax errors as well as some other errors when you run this script? Is it possible for you to post your whole code or enough of it to test with? Edited February 7, 2007 by someone While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd Link to comment Share on other sites More sharing options...
xcal Posted February 7, 2007 Share Posted February 7, 2007 Are you actually using GUIOnEventMode, 1? If you aren't, then GUICtrlSetOnEvent won't work for you. You need to be using GuiGetMsg(). How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
utterlyconfused Posted February 7, 2007 Author Share Posted February 7, 2007 OOps, I'm sorry guys, I was trying to edit my post and tried pressing "Tab" which caused my browser to act erradically. I now have two posts with the same question. Please refer to thread : http://www.autoitscript.com/forum/index.php?showtopic=40812 for a clearer picture. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now