Sign in to follow this  
Followers 0

Button function not working out for me!

4 posts in this topic

Posted

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 :) )

my ipconfig.au3

post-77428-0-47802900-1357826511_thumb.p

Share this post


Link to post
Share on other sites



Posted (edited)

#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.

#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
1 person likes this

Share this post


Link to post
Share on other sites

Posted

#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.

#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 :)

Share this post


Link to post
Share on other sites

Posted

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

Regards,

MKISH

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.