dascondor Posted April 25, 2017 Share Posted April 25, 2017 Okay so I know its me that's doing it wrong but let me see if you guys can figure it out. So this is the Error I'm getting: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Dlex\Dropbox\New folder\IPfolder\math.au3" "C:\Users\Dlex\Dropbox\New folder\IPfolder\math.au3" (33) : ==> Variable used without being declared.: _ReplaceStringInFile($sFilePath, $replace2) _ReplaceStringInFile(^ ERROR >Exit code: 1 Time: 1.713 I can't figure out what is what is happening with the Variable. Please Help if you can. IP_List.txt math.au3 Link to comment Share on other sites More sharing options...
dascondor Posted April 25, 2017 Author Share Posted April 25, 2017 Okay so I know its me that's doing it wrong but let me see if you guys can figure it out. So this is the Error I'm getting: >"C:\Program Files (x86)\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Dlex\Dropbox\New folder\IPfolder\math.au3" "C:\Users\Dlex\Dropbox\New folder\IPfolder\math.au3" (33) : ==> Variable used without being declared.: _ReplaceStringInFile($sFilePath, $replace2) _ReplaceStringInFile(^ ERROR >Exit code: 1 Time: 1.713 I can't figure out what is what is happening with the Variable. Please Help if you can. Link to comment Share on other sites More sharing options...
dascondor Posted April 25, 2017 Author Share Posted April 25, 2017 (edited) expandcollapse popup#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #Region ### START Koda GUI section ### Form=c:\users\dlex\documents\koda_1.7.3.0\forms\dascondorstart.kxf $DasCondor = GUICreate("DasCondor", 509, 242, -1, -1) GUISetBkColor(0xFFFF00) $Store = GUICtrlCreateLabel("What Store Are You Working At?", 112, 40, 311, 33) GUICtrlSetFont(-1, 18, 800, 0, "Arial Narrow") GUICtrlSetColor(-1, 0x000000) $gobutton = GUICtrlCreateButton("GO", 88, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FF00) $clearbutton = GUICtrlCreateButton("Clear ", 224, 184, 75, 25) GUICtrlSetBkColor(-1, 0x00FFFF) $exitbutton = GUICtrlCreateButton("Exit", 384, 184, 75, 25) GUICtrlSetBkColor(-1, 0xFF0000) $data1 = GUICtrlCreateInput("1", 144, 112, 89, 36, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetFont(-1, 18, 400, 0, "Arial Rounded MT Bold") $data2 = GUICtrlCreateInput("23", 254, 115, 89, 36, BitOR($GUI_SS_DEFAULT_INPUT,$ES_CENTER)) GUICtrlSetFont(-1, 18, 400, 0, "Arial Rounded MT Bold") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $gobutton _ReplaceStringInFile($sFilePath, $replace2) Case $exitbutton exit EndSwitch WEnd Global $replace2= "Second" Global $sFilePath = 'C:\Users\Dlex\Dropbox\New folder\IPfolder\IP_List.txt' Func replace() _ReplaceStringInFile ( $sFilePath, $replace2,$data1,0) Global $replace2= "Second" Global $sFilePath = 'C:\Users\Dlex\Dropbox\New folder\IPfolder\IP_List.txt' EndFunc Edited April 25, 2017 by JLogan3o13 Link to comment Share on other sites More sharing options...
BrewManNH Posted April 25, 2017 Share Posted April 25, 2017 Move these lines to the top of your script. Global $replace2= "Second" Global $sFilePath = 'C:\Users\Dlex\Dropbox\New folder\IPfolder\IP_List.txt' Because they're after the While loop, they'll never get processed. Also, don't REDECLARE them inside the function, you're doing it wrong, just declare them once. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 25, 2017 Moderators Share Posted April 25, 2017 @dascondor in the future, please use code tags when posting your code - keeps our collective eyes from bleeding while trying to read it. See here how to do it "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
dascondor Posted April 26, 2017 Author Share Posted April 26, 2017 Is there Anyway to tell "_ReplaceStringinFile" to not touch certain numbers that it might select? Link to comment Share on other sites More sharing options...
BrewManNH Posted April 26, 2017 Share Posted April 26, 2017 Just now, dascondor said: Is there Anyway to tell "_ReplaceStringinFile" to not touch certain numbers that it might select? No, you'd have to create your own version of it that takes more parameters, or use a RegEx on the file instead that does what you're looking to do. dascondor 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
ViciousXUSMC Posted April 26, 2017 Share Posted April 26, 2017 Still some errors to clean up. _ReplaceStringInFile() has at least 3 required parameters. Case $gobutton _ReplaceStringInFile($sFilePath, $replace2) I think you meant to call your Replace() function? Else I do not see anywhere in the script its actually being called/used? When I was brand new to this, what I usually did was write a script that ran once until I got it working, then added the GUI after. This may help you get where you need to be as well. 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