drax Posted May 6, 2010 Share Posted May 6, 2010 I want to write script that works like this: HotKeySet("{F9}", "say") Func say() Send("{ENTER}") sleep(100) Send("message") sleep(250) Send("{ENTER}") EndFunc While 1 sleep(100) Wend but the script should read the message from input. so i write gui: GuiCreate("The messenger", 200, 140) GuiCtrlCreateInput("Message that will be written", 15, 15, 130, 20) GUICtrlCreateButton("Save",15,40,110,40) HotKeySet("{F9}", "say") Func say() Send("{ENTER}") sleep(100) Send("message") sleep(250) Send("{ENTER}") EndFunc GuiSetState() While 1 sleep(100) WEnd I need help with making this work. thanks I hope You will understand and help me Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 6, 2010 Moderators Share Posted May 6, 2010 drax,Welcome to the AutoIt forum. A good start - some code to work on and a clear question. I wish some other newcomers would do the same.A couple of points:- 1. You need to change Send("message") so that it sends what is in the input. To do that you need to store the ControlID returned when you create the input so that you can read it using GUICtrlRead.- 2. You need to be able to Exit at some point, so look for the GUI [X] being pressed.- 3. It is a good idea to keep your code in nice sections - look at this:; general settings HotKeySet("{F9}", "say") ; create GUI GUICreate("The messenger", 200, 140) $hInput = GUICtrlCreateInput("Message that will be written", 15, 15, 130, 20) ; <<<<<<<<<<<<<<<<< Point 1 GUICtrlCreateButton("Save", 15, 40, 110, 40) GUISetState() ; loop While 1 If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit ; <<<<<<<<<<<<<<<<< Point 2 WEnd ; functions Func say() Send("{ENTER}") Sleep(100) Send(GUICtrlRead($hInput)) ; <<<<<<<<<<<<<<<<< Point 1 Sleep(250) Send("{ENTER}") EndFunc ;==>sayI hope that helps. Good luck with the rest of the script. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
drax Posted May 6, 2010 Author Share Posted May 6, 2010 (edited) Is there any way to make script with GUI running in the background ? and question for menu in GUI i want to make menu with two possitions, info and exit i get this code, but i dont have any idea how to make possitions in this menu GuiCtrlCreateMenu("Info", -1, 2) btw. Thanks a lot for last help Edited May 6, 2010 by drax Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 6, 2010 Moderators Share Posted May 6, 2010 drax,A few changes:- 1. The menu items you wanted (with a little message ).- 2. Look at the icon in the SysTray - you have a "Hide" option. But if you hide the GUI, it changes to "Show" to bring it back. expandcollapse popup#include <GUIConstantsEx.au3> ; general settings HotKeySet("{F9}", "say") $fShow = True ; create tray menu Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. Global $hHide_Tray = TrayCreateItem("Hide") TrayItemSetOnEvent(-1, "_Hide_Show") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_On_Exit") ; create GUI $hGUI = GUICreate("The messenger", 200, 140) $hInput = GUICtrlCreateInput("Message that will be written", 15, 15, 130, 20) GUICtrlCreateButton("Save", 15, 40, 110, 40) GUISetState() ; create menu Global $mFile_Menu = GUICtrlCreateMenu("&File") Global $hExit_Menu_Item = GUICtrlCreateMenuItem("&Exit", $mFile_Menu) Global $mHelp_Menu = GUICtrlCreateMenu("&?") Global $hAbout_Menu_Item = GUICtrlCreateMenuItem("&About", $mHelp_Menu) ; loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hExit_Menu_Item Exit Case $hAbout_Menu_Item _About() EndSwitch WEnd ; functions Func say() Send("{ENTER}") Sleep(100) Send(GUICtrlRead($hInput)) Sleep(250) Send("{ENTER}") EndFunc ;==>say Func _Hide_Show() If $fShow Then GUISetState(@SW_HIDE, $hGUI) ; show GUI TrayItemSetText($hHide_Tray, "Show") ; change tray menu text $fShow = False ; set flag Else GUISetState(@SW_SHOW, $hGUI) TrayItemSetText($hHide_Tray, "Hide") $fShow = True EndIf EndFunc Func _About() MsgBox(0, "About", "Melba23 wrote a lot of this code!") EndFunc Func _On_Exit() Exit EndFuncHow is this? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
drax Posted May 6, 2010 Author Share Posted May 6, 2010 (edited) Yea. Works excellent. And from little script it turns to into 119 lines scrpit. atm my largest script expandcollapse popupScript Start - Add your code below here #include <GuiConstantsEx.au3> #include <StaticConstants.au3> ; general settings HotKeySet("{F7}", "say") HotKeySet("{F8}", "say1") HotKeySet("{F9}", "say2") HotKeySet("{F10}", "say3") Local $sFile = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\Diablo II", "InstallPath") & "Diablo II.exe" $var1 = IniRead("config.ini", "config", "var1", "NotFound") $var2 = IniRead("config.ini", "config", "var2", "NotFound") $var3 = IniRead("config.ini", "config", "var3", "NotFound") $var4 = IniRead("config.ini", "config", "var4", "NotFound") $fShow = True ; create tray menu Opt("TrayOnEventMode", 1) ; Use event trapping for tray menu Opt("TrayMenuMode", 3) ; Default tray menu items will not be shown. Global $hHide_Tray = TrayCreateItem("Hide") TrayItemSetOnEvent(-1, "_Hide_Show") TrayCreateItem("") TrayCreateItem("Exit") TrayItemSetOnEvent(-1, "_On_Exit") ; create GUI $hGUI = GUICreate("Trade Helper", 300,150) GUISetIcon($sFile) $hInput = GUICtrlCreateInput($var1, 15, 15, 150, 20) $gInput = GUICtrlCreateInput($var2, 15, 35, 150, 20) $iInput = GUICtrlCreateInput($var3, 15, 55, 150, 20) $jInput = GUICtrlCreateInput($var4, 15, 75, 150, 20) ;labels GUICtrlCreateLabel("Press F7 to say this in game", 166,15) GUICtrlCreateLabel("Press F8 to say this in game", 166,35) GUICtrlCreateLabel("Press F9 to say this in game", 166,55) GUICtrlCreateLabel("Press F10 to say this in game", 166,75) GUICtrlCreateLabel("Everything can be edited in config.ini file", 15,100) GUISetState() ; create menu Global $mFile_Menu = GUICtrlCreateMenu("&File") Global $hExit_Menu_Item = GUICtrlCreateMenuItem("&Exit", $mFile_Menu) Global $mHelp_Menu = GUICtrlCreateMenu("&?") Global $hAbout_Menu_Item = GUICtrlCreateMenuItem("&About", $mHelp_Menu) ; loop While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $hExit_Menu_Item Exit Case $hAbout_Menu_Item _About() EndSwitch WEnd ; functions Func say() Send("{ENTER}") ;open chat box Sleep(100) ;delay Send(GUICtrlRead($hInput)) ;write message Sleep(250) ;delay Send("{ENTER}") ;send message EndFunc Func say1() Send("{ENTER}") ;open chat box Sleep(100) ;delay Send(GUICtrlRead($gInput)) ;write message Sleep(250) ;delay Send("{ENTER}") ;send message EndFunc Func say2() Send("{ENTER}") ;open chat box Sleep(100);delay Send(GUICtrlRead($iInput)) ;write message Sleep(250);delay Send("{ENTER}");send message EndFunc Func say3() Send("{ENTER}");open chat box Sleep(100);delay Send(GUICtrlRead($jInput)) ;write message Sleep(250);delay Send("{ENTER}");send message EndFunc Func _Hide_Show() If $fShow Then GUISetState(@SW_HIDE, $hGUI) ; show GUI TrayItemSetText($hHide_Tray, "Show") ; change tray menu text $fShow = False ; set flag Else GUISetState(@SW_SHOW, $hGUI) TrayItemSetText($hHide_Tray, "Hide") $fShow = True EndIf EndFunc Func _About() MsgBox(0, "About", "Melba23 wrote a lot of this code!") EndFunc Func _On_Exit() Exit EndFunc config file: [config] var1=message 1 var2=message 2 var3=message 3 var4=message 4 i put it, to get your opinion if everything is good. it works for me, but maybe u will give me some tips for the future Edited May 6, 2010 by drax Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 6, 2010 Moderators Share Posted May 6, 2010 drax,And so this is a bot for Diablo II - did you read the announcement at the top of the forum about game bots?End of help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
drax Posted May 6, 2010 Author Share Posted May 6, 2010 (edited) I have read this. This is not a bot. This is just a script that write simple message, to help people with trading. I can't see any connection with bots. E: It can be use in various situations, not only ingame. if this thread broke rules of this forum. I am very sorry, I didn't realised Edited May 6, 2010 by drax Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2010 Developers Share Posted May 6, 2010 I have read this.This is not a bot.This is just a script that write simple message, to help people with trading. I can't see any connection with bots.So what is according to your "dictionary" a bot? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
drax Posted May 6, 2010 Author Share Posted May 6, 2010 So what is according to your "dictionary" a bot?bot is a third party program, that plays for you, when u are making other things. like mm.bot that is wrriten in autoitThis script cannot be used without human, so its not a bot. Link to comment Share on other sites More sharing options...
Developers Jos Posted May 6, 2010 Developers Share Posted May 6, 2010 bot is a third party program, that plays for you, when u are making other things. like mm.bot that is wrriten in autoitThis script cannot be used without human, so its not a bot.A Bot is a program that automates tasks. Your script does that and as such qualifies.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts