EmptySpace Posted January 4, 2012 Posted January 4, 2012 (edited) Just need some advices for future. In my code is big mess... When I try to make something I get error. In this one I have error too. While 1 _IELinkClickByText($oIE, "text") ;every this click page refreshes Sleep(1000) $body = _IEBodyReadHTML($oIE) If StringInStr($body, "Text") Then _IELinkClickByText($oIE, "link text") ElseIf StringInStr($body, "other text") Then _IELinkClickByIndex($oIE, 3) ;I want to add StringInStr even more... ElseIf StringInStr($body, "text 2") Then _IENavigate($oIE, "link") ;------------------ $i = 0 Do $oTags = _IETagNameGetCollection($oIE, 'input') If Not @error Then For $oTag In $oTags If $oTag.type == 'submit' And $oTag.value == 'valuei' Then _IEAction($oTag, 'click') _IELoadWait($oIE) If Not @error Then ExitLoop EndIf Next EndIf $i = $i + 1 Until $i = 30 ;-------------------------------------- EndIf Next ; too much something here. When I remove, I get error... EndIf WEnd Edited January 26, 2012 by Edgaras
Moderators Melba23 Posted January 4, 2012 Moderators Posted January 4, 2012 sirfearless, When I try to make something I get errorAnd so do the rest of us - all the time! I suggest you download SciTE4AutoIt3 from here and install it. You then get lots of extra utilities to help you code more efficiently in AutoIt. One of these is Tidy which nicely formats your code and, among other things, lets you know if you have missing loop elements. When I run your code above through Tidy I get this: While 1 _IELinkClickByText($oIE, "text") ;every this click page refreshes Sleep(1000) $body = _IEBodyReadHTML($oIE) If StringInStr($body, "Text") Then _IELinkClickByText($oIE, "link text") ElseIf StringInStr($body, "other text") Then _IELinkClickByIndex($oIE, 3) ;I want to add StringInStr even more... ElseIf StringInStr($body, "text 2") Then _IENavigate($oIE, "link") ;------------------ $i = 0 Do $oTags = _IETagNameGetCollection($oIE, 'input') If Not @error Then For $oTag In $oTags If $oTag.type == 'submit' And $oTag.value == 'valuei' Then _IEAction($oTag, 'click') _IELoadWait($oIE) If Not @error Then ExitLoop EndIf Next EndIf $i = $i + 1 Until $i = 30 ;-------------------------------------- EndIf ;### Tidy Error -> "next" is closing previous "while" on line 1 Next ; too much something here. When I remove, I get error... ;### Tidy Error: next line creates a negative tablevel. ;### Tidy Error: next line creates a negative tablevel for the line after it. EndIf ;### Tidy Error: next line creates a negative tablevel. ;### Tidy Error: next line creates a negative tablevel for the line after it. WEnd So you can see at once that you have a Next and and EndIf too many. 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
EmptySpace Posted January 4, 2012 Author Posted January 4, 2012 (edited) Woooo.... I have SciTE4AutoIt3 already. Used tidy but got other errors lol... Anyway I will find my solution somehow... Going to spend few hrs on reading examples. I just need few advices how I can make my script better. Maybe I should learn functions? Edited January 23, 2012 by sirfearless
Moderators Melba23 Posted January 4, 2012 Moderators Posted January 4, 2012 sirfearless, Maybe I should learn functions?That would be an excellent idea. Have you read the excellent AutoIt tutorials that you will find here and here? They will help you a lot. 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
somdcomputerguy Posted January 4, 2012 Posted January 4, 2012 @sirfearless - when I became aware of AutoIt several years ago, one of the first things I did was read the Help file. You should browse thru it at least; come to be familiar with the AutoIt native functions and what they do, know what AutoIt can do. Then read thru the Help file again. Don't forget about the tutorials M23 has mentioned. Good luck with your projects. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
EmptySpace Posted January 23, 2012 Author Posted January 23, 2012 I have one question, didnt wanted to create new topic. Its possible to make code to work when for example IE window is closed? Process would be open but without showing browser window?
somdcomputerguy Posted January 23, 2012 Posted January 23, 2012 Its possible to make code to work when for example IE window is closed?If you mean minimized then yes. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
EmptySpace Posted January 25, 2012 Author Posted January 25, 2012 Not minimized... Closed. Like you cant find it anywhere in deskop. You can only see it in working processes.
somdcomputerguy Posted January 25, 2012 Posted January 25, 2012 (edited) Then see the WinSetState() function, with the @SW_HIDE parameter. Edited January 25, 2012 by somdcomputerguy - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
EmptySpace Posted January 29, 2012 Author Posted January 29, 2012 Also its possible to make script to work in IE tabs? Like you make 3tabs and diffrent scripts work on it?
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