momar33 Posted June 27, 2007 Share Posted June 27, 2007 I am trying to set the value of an input, It works fine except that i get to junk characters after the correct data. I beive it is a character return. Here is my code: (see line 94, near bottom) CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.4.9 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- #include <GUIConstants.au3> #include <database.au3> #include <A3LToolbar.au3> Global Enum $idNew=1000, $idOpen, $idSave, $idHelp ; Script Start - Add your code below here $main = GUICreate("Spell Inventory", 800, 500, -1,-1, $WS_OVERLAPPEDWINDOW) GUISetState () $dbname = "C:\Documents and Settings\sjraisbe\Desktop\SI\database.mdb" $tblname = "Spells" $fldname = "Spell" ;MI = menu item ;-----File Menu----- $fileMenu = GuiCtrlCreateMenu ("File") $importMI = GuiCtrlCreateMenuitem ("Import File",$filemenu) $separator = GuiCtrlCreateMenuitem ("",$filemenu) $ppOptionsMenu = GuiCtrlCreateMenu ("Print Preview Options",$filemenu) $separator = GuiCtrlCreateMenuitem ("",$filemenu) $exitMI = GuiCtrlCreateMenuitem ("Exit",$filemenu) ;-----Tools Menu----- $toolsMenu = GuiCtrlCreateMenu ("Tools") $manageSpellbooksMI = GuiCtrlCreateMenuitem ("Manage Spellbooks",$toolsMenu) $manageSchoolsMI = GuiCtrlCreateMenuitem ("Manage Schools",$toolsMenu) $manageSpellsMI = GuiCtrlCreateMenuitem ("Manage Spells",$toolsMenu) $separator = GuiCtrlCreateMenuitem ("",$toolsMenu) $manageScrollsMI = GuiCtrlCreateMenuitem ("Manage Scrolls",$toolsMenu) $separator = GuiCtrlCreateMenuitem ("",$toolsMenu) $searchMI = GuiCtrlCreateMenuitem ("Search",$toolsMenu) ;-----Window Menu----- $windowMenu = GuiCtrlCreateMenu ("Window") $tileMI = GuiCtrlCreateMenuitem ("Tile",$windowMenu) $separator = GuiCtrlCreateMenuitem ("",$windowMenu) $cascadeMI = GuiCtrlCreateMenuitem ("Cascade",$windowMenu) ;-----About Menu----- $aboutMenu = GuiCtrlCreateMenu ("About") $helpTopicsMI = GuiCtrlCreateMenuitem ("Help Topics",$aboutMenu) $separator = GuiCtrlCreateMenuitem ("",$aboutMenu) $aboutMI = GuiCtrlCreateMenuitem ("About SI",$aboutMenu) ;$hToolbar = _Toolbar_Create($main) ; Add standard system bitmaps ;_Toolbar_AddBitmap($hToolbar, 1, -1, $IDB_STD_LARGE_COLOR) ; Add buttons ;_Toolbar_AddButton ($hToolbar, $idNew , $STD_FILENEW) ;_Toolbar_AddButton ($hToolbar, $idOpen, $STD_FILEOPEN) ;_Toolbar_AddButton ($hToolbar, $idSave, $STD_FILESAVE) ;_Toolbar_AddButtonSep($hToolbar) ;_Toolbar_AddButton ($hToolbar, $idHelp, $STD_HELP ) $viewSpell = GUICtrlCreateButton ("1", 0,0,30,30,$BS_ICON) GUICtrlSetImage (-1, "shell32.dll",134) do $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $exitMI ExitLoop Case $msg = $viewSpell $child = GUICreate("View Spells", 200, 200, 40, 0, $WS_OVERLAPPEDWINDOW) DllCall("user32.dll", "int", "SetParent", "hwnd", WinGetHandle($child), "hwnd", WinGetHandle($main)) GUISetState () $Lspell = GUICtrlCreateLabel ("Spell", 10, 35, 70) GUICtrlSetResizing (-1,$GUI_DOCKALL) $IBspell = GUICtrlCreateInput ("", 40, 35, 100, 20) GUICtrlSetResizing (-1,$GUI_DOCKALL) $query = "SELECT " & $tblname & "." & $fldname & " FROM " & $tblname & " WHERE " & $tblname & ".ID=2" $strData = _ReadOneFld($query, $dbname, $fldname) GUICtrlSetData($IBspell, $strData) Case $msg = $aboutMI Msgbox(0,"About","Spell Inventory") EndSelect until $msg = $GUI_EVENT_CLOSE GUIDelete() Exit Link to comment Share on other sites More sharing options...
martin Posted June 27, 2007 Share Posted June 27, 2007 I am trying to set the value of an input, It works fine except that i get to junk characters after the correct data. I beive it is a character return.Why not just delete the @CR and @LF characters and see if that gets rid of the problem then? 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. Link to comment Share on other sites More sharing options...
momar33 Posted June 28, 2007 Author Share Posted June 28, 2007 I did not add any charachters, they just showed up. If you are talking about deleting them using code, please explain how to. Link to comment Share on other sites More sharing options...
Richard Robertson Posted June 28, 2007 Share Posted June 28, 2007 It looks like your problem is in the database, either the file or the function reading it. Check the UDF and database to see if there are any invalid characters there. Link to comment Share on other sites More sharing options...
martin Posted June 28, 2007 Share Posted June 28, 2007 I did not add any charachters, they just showed up. If you are talking about deleting them using code, please explain how to. Here is a rather long-winded example of getting rid of characters in a string $f = 'start' & @CR & 'MIDDLE' & Chr(14) & 'end' $wrong = '' MsgBox(0,'string is',$f) For $n = 1 To StringLen($f) $fmid = StringMid($f,$n,1) If (Not StringIsAlNum($fmid)) Then $wrong = $wrong & $fmid Next If $wrong <> '' Then For $n = 1 To StringLen($wrong) $f = StringReplace($f,StringMid($wrong,$n,1),'') Next EndIf MsgBox(0,'corrected string is',$f) 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. Link to comment Share on other sites More sharing options...
momar33 Posted June 28, 2007 Author Share Posted June 28, 2007 I figured it out. For some reason the function _ReadOneFld was adding @CRLF to the end of whatever value i brought in. Thanks for the help. 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