EddieBoy Posted August 9, 2011 Share Posted August 9, 2011 I'm pretty much new to programming of any sort and I've been reading through several of the helpful tutorials around. But, I want to do a few specific operations that I can't find information on. I'm trying to make a GUI editor for a game's AI config files. There is some text in the config file (Enemy name etc) but most of it is binary number values as in "00 @ 0x30 = defending off" "01 @ 0x30 = defending on). One main thing I need to do is 'send' assembled data to a generic data file (aka save the new config file to disk). I've seen the tutorials on saving a txt file through simulated keystrokes, but I doubt that is the best way to go for text/binary data. Any advice or tutorial links would be greatly appreciated- Thanks! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 9, 2011 Share Posted August 9, 2011 (edited) Hi and Welcome to the forums! Look at FileOpen() and FileWrite() in the helpfile, there's examples there too Edited August 9, 2011 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
EddieBoy Posted August 9, 2011 Author Share Posted August 9, 2011 Hi and Welcome to the forums!Look at FileOpen() and FileWrite() in the helpfile, there's examples there too Thank you! They look promising. I'll do some testing and see if I can get it figured out Link to comment Share on other sites More sharing options...
EddieBoy Posted August 10, 2011 Author Share Posted August 10, 2011 Thanks again AdmiralAlkex, you narrowing down where to look has really helped. Now I'm starting to understand some of the lingo enough to where I can mentally process the help file's info. I've gotten the bare-bones load/save functions outlined and working- yay! One more question- can someone point me to the functions for limiting how much text the user can type into a GUI 'input' box. There are 30 characters available for enemy names so I need to restrict the input to that length. Thanks! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted August 10, 2011 Share Posted August 10, 2011 One more question- can someone point me to the functions for limiting how much text the user can type into a GUI 'input' box. There are 30 characters available for enemy names so I need to restrict the input to that length. Thanks! If you are referring to GUICtrlCreateInput() then look at GUICtrlSetLimit(). GUICreate(@ScriptName, 640, 240) GUICtrlCreateInput("Write here", 10, 10, 400, 30) GUICtrlSetLimit(-1, 30) GUISetState() Do Until GUIGetMsg() = -3 ; -3 = $GUI_EVENT_CLOSE .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
EddieBoy Posted August 10, 2011 Author Share Posted August 10, 2011 Perfect! Thank you. This programming stuff is kind of fun; I feel like a kid on Christmas morning every time I run the code to see if my changes did what I hope. I keep bugging my wife- making her come and see, "Look hon, I made a data file with "00" in it!!!" She kind of rolls her eyes, pats me on th head and goes back to what she was doing ha ha. Link to comment Share on other sites More sharing options...
EddieBoy Posted August 12, 2011 Author Share Posted August 12, 2011 (edited) I ran into another quandary. My GUI has two Input Boxes for numbers entered by the user. The value in Box2 needs to be at least as big as Box1 so I'm using this: If GUICtrlRead( $InputBox1) > GUICtrlRead( $InputBox2) Then GUICtrlSetData($InputBox2, GUICtrlRead($InputBox1)) EndIf Problem is, it's treating the input boxes values like an alphabetized list- namely "8 > 7" comes out true but "18 >7" fails because 18 starts with a 1. Is there a fix/workaround for this? Thanks Edited August 12, 2011 by EddieBoy Link to comment Share on other sites More sharing options...
JohnOne Posted August 12, 2011 Share Posted August 12, 2011 If Int(GUICtrlRead( $InputBox1)) > Int(GUICtrlRead( $InputBox2)) Then GUICtrlSetData($InputBox2, GUICtrlRead($InputBox1)) EndIf Assuming the values are int of course. AutoIt Absolute Beginners  Require a serial  Pause Script  Video Tutorials by Morthawt  ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
EddieBoy Posted August 12, 2011 Author Share Posted August 12, 2011 That fixed it! I did try Int( ), but I guess I put it in the wrong order like so, because it didn't work that way. If GUICtrlRead(int( $InputBox1)) > GUICtrlRead(int( $InputBox2)) Then GUICtrlSetData($InputBox2, GUICtrlRead($InputBox1)) EndIf Thanks tons John, you're the king! Link to comment Share on other sites More sharing options...
EddieBoy Posted August 20, 2011 Author Share Posted August 20, 2011 Ran into another quandary. Tried all day to figure it out but no luck so hope someone can help. I'm trying to delete the selected line from the list when the 'delete' button is pushed but I can't get it to work. expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <ListViewConstants.au3> #include <ListboxConstants.au3> $GUI_Main= GUICreate("GUI", 600, 510) $List = GUICtrlCreateListView("1|2|3", 25, 45, 150, 100) $Delete_Button = GUICtrlCreateButton("Delete Selected Entry", 25, 145, 150, 25) $Input = GUICtrlCreateInput("000,0000,1", 25, 175, 80, 20) GUICtrlSetLimit ($Input, 10) $Add_Button= GUICtrlCreateButton("Add", 105, 175, 60, 25) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Input If StringRegExp(GUICtrlRead($Input), "[^\d\,]") Then GUICtrlSetData($Input, StringRegExpReplace(GuiCtrlRead($Input), "[^\d\,]", "")) EndIf Case $Add_Button $Temp = GUICtrlRead($Input) $Temp = StringRegExpReplace($Temp, ",", "|") GUICtrlCreateListViewItem($Temp,$List) ; PROBLEM! Case $Delete_Button $Selected = GuiCtrlRead($List) $Item_To_Delete = ControlCommand ( $GUI_Main, "", $List, "FindString", $Selected ) ControlCommand ( $GUI_Main, "", $List, "DelString", $Item_To_Delete ) Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
EddieBoy Posted August 20, 2011 Author Share Posted August 20, 2011 ArgHHH!! Nevermind. Just found out I was researching the wrong type of control. I am using a 'List View' but was using delete commands for a 'List Box'. Which explains why I couldn't get anything to work. Anyways, the answer couldn't be simpler! _GUICtrlListView_DeleteItemsSelected($hWnd) Hopefully my stupidity will help someone else. Link to comment Share on other sites More sharing options...
EddieBoy Posted August 20, 2011 Author Share Posted August 20, 2011 A related question. Is there style etc that auto-sorts list view entries numerically? My list view will only have numbers but $LVS_SORTASCENDING sorts lines as 'letters' as in: 1, 10, 100, 2, 20 etc I tried GUICtrlCreateListViewItem(int ($num [1]) & "|" & int ($num [2]) & "|" & int ($num [3]) ,$List) but it still sorts lines as if alphabetized. I can probably figure how to do it manually by reading the listview's lines and rearranging them, but just wondering if there's a 'prefabricated' method. Thanks Link to comment Share on other sites More sharing options...
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