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 

To get contents before = sign in INI file
Goto page Previous  1, 2
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
hd0202



Joined: 13 Aug 2006
Posts: 176
Location: Germany

PostPosted: Fri Nov 27, 2009 1:56 pm    Post subject: Reply with quote

here is my solution:
Code:
Loop, read, C:\Documents and Settings\Devil\Desktop\test.ini
   {
      if a_loopreadline contains =
      {
          ind++
         StringSplit, buttonname, a_loopreadline, =
          button%ind% := buttonname1
          function%ind% := buttonname2
         Gui, Add, Button,gbuttonname w200 h50, %buttonname1%
      }
   }
gui show
Return

buttonname:
ControlGetFocus, buttonnum
ControlGetText, buttontext, %buttonnum%
loop, % ind
{
   if (button%a_index% = buttontext)
      run function%a_index%
}
return


Hubert
Back to top
View user's profile Send private message
Jasdeep



Joined: 09 Nov 2009
Posts: 190

PostPosted: Fri Nov 27, 2009 2:11 pm    Post subject: Reply with quote

kool but dude its sending function 1...well here is the whole code
Code:

Run C:\ETAS\ETKControlPanel6.4\ETKControlPanel.exe -n
WinWaitActive INCA/MAC
CoordMode,Mouse,Relative
MouseClick,left,395,106
sleep 1000


Loop, read, C:\Documents and Settings\jakhangu\Desktop\test.ini
   {
      if a_loopreadline contains =
      {
          ind++
         StringSplit, buttonname, a_loopreadline, =
          button%ind% := buttonname1
          function%ind% := buttonname2
         Gui, Add, Button,gbuttonname w200 h50, %buttonname1%
      }
 
}
gui show
Return

buttonname:
ControlGetFocus, buttonnum
ControlGetText, buttontext, %buttonnum%
loop, % ind
{
   if (button%a_index% = buttontext)
     
  WinMinimize New AutoHotkey
  sleep 500
  send !{L}
 sleep 500
send function%a_index%  ; as this command should send the text of .ini file that is D:\ETASData\ETKControlPanel6.4\ETKS4_1\ETC\ProductionTest_ETKS4_1_TU6_2.etc into filename textbox  but instead of that it sends function1....in your program it was run sorry but i want to send that text
}

return



and here is the ini file

Code:

[Production]
ETKS4_1=D:\ETASData\ETKControlPanel6.4\ETKS4_1\ETC\ProductionTest_ETKS4_1_TU6_2.etc
ETKS4_2=D:\ETASData\ETKControlPanel6.4\ETKS4_2\ETC\ProductionTest_ETKS4_2_TU6_3.etc



but when i executes it sends function1

i am sorry bro i know i am getting on your nerves sorry for all
Back to top
View user's profile Send private message
hd0202



Joined: 13 Aug 2006
Posts: 176
Location: Germany

PostPosted: Fri Nov 27, 2009 2:34 pm    Post subject: Reply with quote

for test purpose I had
Code:
msgbox, % run function%a_index%

in your case it must be
Code:
run % function%a_index%
; or
send % function%a_index%


Hubert
Back to top
View user's profile Send private message
Guest






PostPosted: Fri Nov 27, 2009 2:46 pm    Post subject: Reply with quote

thanks brother i will try it well see you later as i have to run to catch my train and thanks a million million for all your support and help i will be always grateful to you take care always
Back to top
Guest






PostPosted: Fri Nov 27, 2009 2:53 pm    Post subject: Reply with quote

it gives error when i added send %function%a_index% and states as
this parameter contains a variable name missing its ending percent sign and if i add one more sign still it gives error
Back to top
hd0202



Joined: 13 Aug 2006
Posts: 176
Location: Germany

PostPosted: Fri Nov 27, 2009 3:11 pm    Post subject: Reply with quote

please note, that there is a space on both sides of the first '%' to make the remainder of the line an expression

Hubert
Back to top
View user's profile Send private message
Guest






PostPosted: Mon Nov 30, 2009 9:15 am    Post subject: Reply with quote

ya you are right its working when i gave space thanks buddy...well i dont understand that the more button i am adding through ini file my script is running very slowly like for the first button it works very fast and the speed goes on decreasing as i move from top to down...any idea for the reason behind this?? and is their a way to speed up the appilcation???
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
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