Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

Button function not working out for me!


  • Please log in to reply
3 replies to this topic

#1 fanna1119

fanna1119

    Seeker

  • Normal Members
  • 2 posts

Posted 10 January 2013 - 02:02 PM

Hi, I am pretty much a noob in autoit :P
So I used Au3Record to record some things I do and it worked excellent but when I made a GUI using Koda GUI designer and I made a button and I wanted to linked my recorded functions to the button, but I just can't get it right!
can someone maybe show me what I was doing wrong here :)

(sorry if the GUI I uploaded isn't functional since the images inside the program are on my pc :) )

Attached Thumbnails

  • how the Gui looks.PNG

Attached Files









#2 stormbreaker

stormbreaker

    More wits this time...

  • Active Members
  • PipPipPipPipPipPip
  • 547 posts

Posted 10 January 2013 - 02:10 PM

AutoIt         
#include <ButtonConstants.au3> #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include 'MyIPConfig.au3' $Form1 = GUICreate("A problem to solve", 150, 150) $btn = GUICtrlCreateButton('IP Info', 10, 10, 90, 30, $BS_BITMAP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $btn _Button_Function() EndSwitch WEnd


Perhaps, this is the ans. to ur question. Here is the modified version of your posted file.

AutoIt         
#region ---Au3Recorder generated code Start (v3.3.7.0)  --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Func _Button_Function() Run('C:\Windows\System32\cmd.exe') _WinWaitActivate("C:\Windows\System32\cmd.exe","") Send("ipconfig{ENTER}") MouseClick("right",14,55,1) MouseClick("left",68,73,1) _WinWaitActivate("Mark C:\Windows\System32\cmd.exe","") MouseMove(13,52) MouseDown("left") MouseMove(635,306) MouseUp("left") _WinWaitActivate("Select C:\Windows\System32\cmd.exe","") Send("{Enter}") Run('C:\Windows\System32\notepad.exe') _WinWaitActivate("Untitled - Notepad","") Send("{CTRLDOWN}v{CTRLUP}") EndFunc #endregion --- Au3Recorder generated code End ---

Edited by MKISH, 10 January 2013 - 02:11 PM.

  • fanna1119 likes this

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1


#3 fanna1119

fanna1119

    Seeker

  • Normal Members
  • 2 posts

Posted 10 January 2013 - 03:14 PM

AutoIt         
#include <ButtonConstants.au3> #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include 'MyIPConfig.au3' $Form1 = GUICreate("A problem to solve", 150, 150) $btn = GUICtrlCreateButton('IP Info', 10, 10, 90, 30, $BS_BITMAP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete() Exit Case $btn _Button_Function() EndSwitch WEnd


Perhaps, this is the ans. to ur question. Here is the modified version of your posted file.

AutoIt         
#region ---Au3Recorder generated code Start (v3.3.7.0) --- #region --- Internal functions Au3Recorder Start --- Func _Au3RecordSetup() Opt('WinWaitDelay',100) Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _AU3RecordSetup() #endregion --- Internal functions Au3Recorder End --- Func _Button_Function() Run('C:\Windows\System32\cmd.exe') _WinWaitActivate("C:\Windows\System32\cmd.exe","") Send("ipconfig{ENTER}") MouseClick("right",14,55,1) MouseClick("left",68,73,1) _WinWaitActivate("Mark C:\Windows\System32\cmd.exe","") MouseMove(13,52) MouseDown("left") MouseMove(635,306) MouseUp("left") _WinWaitActivate("Select C:\Windows\System32\cmd.exe","") Send("{Enter}") Run('C:\Windows\System32\notepad.exe') _WinWaitActivate("Untitled - Notepad","") Send("{CTRLDOWN}v{CTRLUP}") EndFunc #endregion --- Au3Recorder generated code End ---

THANK YOU so much for your help :)

#4 stormbreaker

stormbreaker

    More wits this time...

  • Active Members
  • PipPipPipPipPipPip
  • 547 posts

Posted 10 January 2013 - 03:29 PM

Glad it works for you... thanks for the 'LIKE'.

Regards,
MKISH

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users