AutoHotkey Community

It is currently May 27th, 2012, 2:52 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: November 27th, 2009, 1:56 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 2:11 pm 
Offline

Joined: November 9th, 2009, 3:09 pm
Posts: 258
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 2:34 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 2:46 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 2:53 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 27th, 2009, 3:11 pm 
Offline

Joined: August 13th, 2006, 6:45 am
Posts: 355
Location: Germany
please note, that there is a space on both sides of the first '%' to make the remainder of the line an expression

Hubert


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 30th, 2009, 9:15 am 
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???


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google [Bot], rbrtryn, Yahoo [Bot] and 21 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