Wolfeinstein Posted January 15, 2011 Share Posted January 15, 2011 Why i get this error? "Badly formatted "Func" statement"Sorry for my bad english#include <GUIConstants.au3>#Region ### START Koda GUI section ### Form=$Form1 = GUICreate("Defcon0815 LogApp by epvp", 172, 247, 499, 116)$Button1 = GUICtrlCreateButton("Metin2", 8, 208, 153, 33, 0)GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")GUISetState(@SW_SHOW)#EndRegion ### END Koda GUI section ###While 1$nMsg = GUIGetMsg()Switch $nMsgCase $GUI_EVENT_CLOSEExitCase $F3run ("d:\Jocuri\Metin2 RO\bypass.bat","d:\Jocuri\Metin2 RO")EndSwitchHotKeySet ( "{F2}", "log" )WEndfunc log()send ("accountname")Send ("{Enter}")sleep (1000)send ("password")sleep (1000)Send ("{Enter}")sleep (5000)Send ("{Enter}")EndFunc Link to comment Share on other sites More sharing options...
UEZ Posted January 15, 2011 Share Posted January 15, 2011 (edited) Use [ autoit] your code [ /autoit] to format your code example properly when posting an example! Then you defined Log() as your function but Log() is already a build-in function (Calculates the natural logarithm of a number.)! Use a different name, e.g. _Log() #include <GUIConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Defcon0815 LogApp by epvp", 172, 247, 499, 116) $Button1 = GUICtrlCreateButton("Metin2", 8, 208, 153, 33, 0) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $F3 run ("d:\Jocuri\Metin2 RO\bypass.bat","d:\Jocuri\Metin2 RO") EndSwitch HotKeySet ( "{F2}", "_log" ) WEnd func _log() send ("accountname") Send ("{Enter}") sleep (1000) send ("password") sleep (1000) Send ("{Enter}") sleep (5000) Send ("{Enter}") EndFunc Br, UEZ Edited January 15, 2011 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
shanet Posted January 15, 2011 Share Posted January 15, 2011 Looks suspicious... What exactly is this for? I have fixed your code and commented it so you can tell what is wrong: #include <GUIConstants.au3> HotKeySet ( "{F2}", "_log" ) ;Hotkey decleration is not put in the while loop. #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Defcon0815 LogApp by epvp", 172, 247, 499, 116) $Button1 = GUICtrlCreateButton("Metin2", 8, 208, 153, 33, 0) GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") GUISetState() ;Does not need to contain @SW_SHOW #EndRegion ### END Koda GUI section ### While 1 ;properly indented to make code easier to read Switch GUIGetMsg() ;No need for $nMsg variable Case $GUI_EVENT_CLOSE Exit Case $Button1 ;Should be $Button1, not $F3 - That's the impression I get anyway run ("d:\Jocuri\Metin2 RO\bypass.bat","d:\Jocuri\Metin2 RO") EndSwitch WEnd func _log() ;Functions always start with an underscore send ("accountname") Send ("{Enter}") sleep (1000) send ("password") sleep (1000) Send ("{Enter}") sleep (5000) Send ("{Enter}") EndFunc shanet [font="Comic Sans MS"]My code does not have bugs! It just develops random features.[/font]My Projects[list][*]Live Streaming (Not my project, but my edited version)[right]AutoIt Wrappers![/right][/list]Pure randomness[list][*]Small Minds.......................................................................................................[size="1"]Simple progress bar that changes direction at either sides.[/size][*]ChristmasIt AutoIt Christmas Theme..........................................................[size="1"]I WAS BOOOORED![/size][*]DriveToy..............................................................................................................[size="1"]Simple joke script. Trick your friends into thinking their computer drive is haywire![/size][/list]In Development[list][*]Your Background Task Organiser[*]AInstall Second Generation[/list]BEFORE POSTING ON THE FORUMS, TRY THIS: %programfiles%/AutoIt3/autoit3.chm Link to comment Share on other sites More sharing options...
guinness Posted January 15, 2011 Share Posted January 15, 2011 UEZ makes a good point I always add "_" to the start of any Function e.g. _Custom() because this is what I read somewhere on the Forum. I was told it was good programming practice and now I understand why! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Wolfeinstein Posted January 15, 2011 Author Share Posted January 15, 2011 thank you all!what an epic fail=) Link to comment Share on other sites More sharing options...
GEOSoft Posted January 15, 2011 Share Posted January 15, 2011 You will always get that error when you name your function the same as one of the AutoIt built in functions. Func Run() would fail as would Func StringInStr(). By preceding the name with an underscore (or any legal character for that matter) will solve the problem. It's just an AutoIt convention that user defined functions start with an underscore but not absolutely required. 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!" 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