LiLShinta Posted April 6, 2008 Posted April 6, 2008 First of all, I am noob. Ive been using and trying to understand autoIT for3 days. now my problem is on the GUI. For example, i want to have a list of names with surnames on another input box in which the input data will be transfered to the notepad after pressing save. how can it be? i also created a form of it. can you please help me to make a script for this.oh i forgot to say that there is also a checkbox located beside each of the names. can someone help me generate a script for this? the check box will make each box enable and if there is a check in checkbox, it will only mean that the data input will be copied in notepad. tnx.
martin Posted April 6, 2008 Posted April 6, 2008 First of all, I am noob. Ive been using and trying to understand autoIT for3 days. now my problem is on the GUI. For example, i want to have a list of names with surnames on another input box in which the input data will be transfered to the notepad after pressing save. how can it be? i also created a form of it. can you please help me to make a script for this. oh i forgot to say that there is also a checkbox located beside each of the names. can someone help me generate a script for this? the check box will make each box enable and if there is a check in checkbox, it will only mean that the data input will be copied in notepad. tnx.Welcome to AutoIt forums To read the text in an edit use GuiCtrlRead. Also use GuiCtrlRead to get the state of the checkboxes. To send the text to Notepad first set Notepad active, or focused, using WInActivate("Untitled") or whatever the title in Notepad is, then use Send to send the text to it. expandcollapse popup WinActiveate("Untitled");assuming it's already running! if BitAnd(GuiCtrlRead($chk1),$GUI_CHECKED) = $GUI_CHECKED then $ip1text = GuiCtrlRead($ip1) Send($ip1text) endif if BitAnd(GuiCtrlRead($chk2),$GUI_CHECKED) = $GUI_CHECKED then $ip2text =...etc [code=auto:0] You could write the text to a file using FileWriteLine rather than send ot to Notepad. You would be able to save a lot of code if you used arrays for your controls and maybe you have, but first things first. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. GEOSoft Posted April 7, 2008 GEOSoft MVPs 10.3k Sure I'm senile. What's your excuse? Posted April 7, 2008 (edited) As martin pointed out, make sure that the notepad window has been activated then you can use If GUICtrlRead($Chk1) = 1 Then $oTxt = GUICtrlRead($ip1) & " " & GUICtrlRead($Ip2) & @CRLF Send($oTxt) EndIf Edited April 7, 2008 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
LiLShinta Posted April 7, 2008 Author Posted April 7, 2008 (edited) $oTxt = GUICtrlRead($ip1) & " " & GUICtrlRead($Ip2) & @CRLFcan i ask, what is ' & "" & 'for? Edited April 7, 2008 by LiLShinta
Moderators SmOke_N Posted April 7, 2008 Moderators Posted April 7, 2008 $oTxt = GUICtrlRead($ip1) & " " & GUICtrlRead($Ip2) & @CRLF can i ask, what is ' & "" & 'for?& is used to concatenate strings. Example: Dim $sPhraseOne = "Welcome" Dim $sPhraseTwo = " To " Dim $sPhraseThree = "AutoIt" MsgBox(64, "Info", $sPhraseOne & $sPhraseTwo & $sPhraseThree) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
LiLShinta Posted April 7, 2008 Author Posted April 7, 2008 badly i got another problem.. here is my script expandcollapse popup#include <GUIConstants.au3>; tell it to use GUI related constant variables etc. Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $Form1 = GUICreate("My 1st Script", 493, 389, 324, 116) $start = GUICtrlCreateButton("Start Copy", 312, 64, 153, 41, 0) $quit = GUICtrlCreateButton("Exit", 320, 200, 137, 49, 0) $Chk1 = GUICtrlCreateCheckbox("", 264, 48, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk2 = GUICtrlCreateCheckbox("", 264, 176, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk3 = GUICtrlCreateCheckbox("", 264, 144, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk4 = GUICtrlCreateCheckbox("", 264, 80, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk5 = GUICtrlCreateCheckbox("", 264, 112, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Input1 = GUICtrlCreateInput("", 16, 48, 113, 21) $Input2 = GUICtrlCreateInput("", 16, 80, 113, 21) $Input3 = GUICtrlCreateInput("", 16, 112, 113, 21) $Input4 = GUICtrlCreateInput("", 16, 144, 113, 21) $Input5 = GUICtrlCreateInput("", 16, 176, 113, 21) ;Tell the buttons what to read from when clicked v GUICtrlSetOnEvent($quit, "quit"); tell the quit button to use my quit function (example: quit = Func quit()) GUICtrlSetOnEvent($start, "start"); tell the start button to use my start function (example: start = Func start()) GUISetOnEvent($GUI_EVENT_CLOSE, "quit");tell the program that when you click that red X at top right of program it uses my quit function ;End of the tell ^ GUISetState(@SW_SHOW);Tell it to show my box While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func quit(); quit function Exit;exit the program endfunc;end the function ; this is the important part where you must change something like the username and password Func start() $msg1 = GUICtrlRead($Input1) $msg2 = GUICtrlRead($Input2) $msg3 = GUICtrlRead($Input3) $msg4 = GUICtrlRead($Input4) $msg5 = GUICtrlRead($Input5) if BitAND(GuiCtrlRead($Chk1),$GUI_CHECKED) = $GUI_CHECKED then Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled - Notepad") Send("" & $msg1) WinMinimizeAll() EndIf if BitAND(GuiCtrlRead($Chk2),$GUI_CHECKED) = $GUI_CHECKED then Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled - Notepad") Send("" & $msg2) WinMinimizeAll() EndIf if BitAND(GuiCtrlRead($Chk3),$GUI_CHECKED) = $GUI_CHECKED then Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled - Notepad") Send("" & $msg3) WinMinimizeAll() EndIf if BitAND(GuiCtrlRead($Chk4),$GUI_CHECKED) = $GUI_CHECKED then Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled - Notepad") Send("" & $msg4) WinMinimizeAll() EndIf if BitAND(GuiCtrlRead($Chk5),$GUI_CHECKED) = $GUI_CHECKED then Send("#r") WinWaitActive("Run") Send("notepad.exe{Enter}") WinWaitActive("Untitled - Notepad") Send("" & $msg5) WinMinimizeAll() EndIf msgbox(0,"Sucess!","Done") EndFunc my problem there is where i have to run another notepad to put the second date to be input, it doesnt copy the input data. anyone there please help me.
Madza91 Posted April 7, 2008 Posted April 7, 2008 Hi, problem is in checkboxes Just replace this code with your 8,9,10,11,12 lines $Chk1 = GUICtrlCreateCheckbox("", 264, 48, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk2 = GUICtrlCreateCheckbox("", 264, 80, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk3 = GUICtrlCreateCheckbox("", 264, 112, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk4 = GUICtrlCreateCheckbox("", 264, 144, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) $Chk5 = GUICtrlCreateCheckbox("", 264, 176, 17, 17, BitOR($BS_CHECKBOX,$BS_AUTOCHECKBOX,$BS_LEFT,$WS_TABSTOP)) [quote name='dbzfanatic' post='609696' date='Nov 26 2008, 08:46 AM']This is a help forum not a "write this for me" forum.[/quote](Sorry for bad English) :)
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