icek93 Posted November 12, 2013 Share Posted November 12, 2013 Hi! I am new to AutoIT and I would like to ask a question about my simple script, which I have written. When I am Run it (F5) in SciTE Script Editor everything works great but when I build it to .exe (F7) and then open this file everything is ruined. Exe application starts over and over so in the end i have something about ~50 programs opened and my system crashes. What have I done wrong? PS. If there exist topic which could answer my questions i would be delighted if you can post it here. I have searched but everything i have seen did not answer my questions. expandcollapse popupRun("notepad.exe") WinWaitActive("Bez tytułu — Notatnik") WinActivate("Bez tytułu — Notatnik") Global $var2, $var1 ;WinSetState("Font", "Cancel", @SW_HIDE) ;WinSetState("Bez tytułu — Notatnik", "", @SW_MAXIMIZE) ;$format = GUICtrlCreateMe Func toType() For $i=0 To 1 Step 1 Send("Próba nr : " & $i & @CRLF) $var2="Próba nr : " & $i Next $var1 = "Próba nr : 2" $toCompare = StringCompare("$var1","$var2") If $toCompare==0 Then Send("Są równe") Sleep(1000) Else Send("Nie sa rowne "& @LF) Sleep(1000) EndIf EndFunc Func toPrint() Local $toTest $toTest = ClipPut($var1) Send("^v") Sleep(1000) EndFunc Func toChangeWords() Send("^h") WinWaitActive("Zamienianie","",0) Sleep(500) Send("Próba {TAB} Nastąpiła zamiana ") Sleep(500) ControlClick("Zamienianie", "",1025) Sleep(500) ControlClick("Zamienianie", "", 2) EndFunc Func font() Send("{LALT}") Send("{M}") Send("{DOWN} {ENTER}") Sleep(500) WinWaitActive("Czcionka","") Send("Papyrus {TAB} Pogrubiona Pochyła {TAB} 15") Sleep(500) ControlClick("Czcionka", "", 1) EndFunc Func rowsChange() Send("{LALT}") Send("{M} {ENTER}") EndFunc Func toSave() Send("^s") WinWaitActive("Zapisywanie jako") Send("Nazwa") Sleep(500) ControlClick("Zapisywanie jako", "", 1) Send("!{F4}") EndFunc font() toType() toPrint() toChangeWords() rowsChange() toSave() And second one, the same problems : expandcollapse popupRun("calc.exe") WinWaitActive("Kalkulator") WinActivate("Kalkulator") Func sciCalc() Send("{altdown}{2}{altup}") Sleep(1500) Send("{Enter}") EndFunc Func simpleMultiplication() ControlClick("Kalkulator", "", 131) Sleep(500) ControlClick("Kalkulator", "", 92 ) Sleep(500) ControlClick("Kalkulator", "", 135) Sleep(500) ControlClick("Kalkulator", "", 121) Sleep(1000) ControlClick("Kalkulator", "", 81 ) EndFunc Func simpleAdding() ControlClick("Kalkulator", "", 138) Sleep(500) ControlClick("Kalkulator", "", 93) Sleep(500) ControlClick("Kalkulator", "", 136) Sleep(500) ControlClick("Kalkulator", "", 121) Sleep(1000) ControlClick("Kalkulator", "", 81 ) EndFunc Func converUnits() Send("{CTRLDOWN}{F4}{CTRLUP}") Sleep(1000) Send("^u") For $i=0 To 8 Step 1 Send("{DOWN}") Sleep(450) Next Send("{TAB}") Send("150") Send("{TAB}") ControlClick("Kalkulator", "" ,224) For $i=0 To 2 Step 1 Send("{DOWN}") Sleep(450) Next Send("{ENTER}") $k=1 While $k >=0 Send("{TAB}") $k = $k - 1 WEnd $a = 2 While $a >0 Send("{DOWN}" & $a) $a = $a - 1 Sleep(500) WEnd Sleep(1000) EndFunc Func changeRadioButton() Send("{CTRLDOWN}{F4}{CTRLUP}") MsgBox(0,"Opis","Operacja, gdy argument funkcji podany w stopniach...") ControlClick("Kalkulator","",321) Sleep(500) ControlClick("Kalkulator", "", 139) Sleep(500) ControlClick("Kalkulator", "", 130) Sleep(500) ControlClick("Kalkulator", "", 102) Sleep(500) MsgBox(0,"Opis cd.","... w porównaniu do wyniku, gdy argument jest w radianach") ControlClick("Kalkulator","",322) Sleep(500) ControlClick("Kalkulator", "", 139) Sleep(500) ControlClick("Kalkulator", "", 130) Sleep(500) ControlClick("Kalkulator", "", 102) EndFunc Func cleanAfterWork() MsgBox(0,"Koniec", "Na koniec posprzątamy czyszcząc historię.") Send("{CTRLDOWN}{h}{CTRLUP}") WinActivate("Kalkulator") Local $param[4] = ["{ALT}", "{E}","{H}","{W}"] For $w = 0 To 3 Step 1 Send($param[$w]) Sleep(450) Next EndFunc sciCalc() simpleMultiplication() simpleAdding() converUnits() changeRadioButton() cleanAfterWork() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 12, 2013 Moderators Share Posted November 12, 2013 icek93,Welcome to the AutoIt forum. Are you naming these 2 scripts notepad.exe and calc.exe when you compile them? 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...
icek93 Posted November 12, 2013 Author Share Posted November 12, 2013 (edited) When I click Build(F7) in Calc script file named Calc is created.When I compiled (^F7) I havent changed anything. Should I ? Edited November 12, 2013 by icek93 Link to comment Share on other sites More sharing options...
Solution BrewManNH Posted November 12, 2013 Solution Share Posted November 12, 2013 If you name your script the same name as the program you're trying to run, when you compile it your script will run itself instead of the program you wanted to run. 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...
icek93 Posted November 13, 2013 Author Share Posted November 13, 2013 It works great! Thanks a lot man. I thought that the is no name problem when files are completely different types. 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