Jump to content
Sign in to follow this  
dannymcf2

I need some help with my script please. Thank u

Recommended Posts

dannymcf2

Hey!

Im just going to say that im new to autoit and this is my first successful script ! :) 

anyway i have a little problem that does not

make sense at all to me.... Maybe you can help me out? Anyone please?? :)

What i have the SCRIPT do is this : 

The script finds a text box (on the screen) then it clicks the text box, then it sends "guess what...."

but after it has sent "guess what...." FOR SOME REASON IT SCROLLS DOWN THEN ENDS THE SCRIPT WITH AN ERROR.... (see below for error...)

"C:\Users\yolo\Desktop\bot\best.au3" (47) : ==> Illegal text at the end of statement (one statement per line).:
mousewheel("down"), 3)
mousewheel("down")^ ERROR

HERE IS MY SCRIPT BELOW... That im having problems with.

func ns3()
     $pixel = PixelSearch(416, 295, 882, 315, 0x707070)
    if IsArray($pixel) = true then
    MouseClick("left", $pixel[0], $pixel[1])
       tn()
          EndIf
       EndFunc

    func tn()
       send ("guess{SPACE}what.....")
       sleep ($interval)
       sleep ($interval)
       findcombox()
    EndFunc

So what happens is it searches for the text box, then if it's true then mouse click then Func tn() runs

 

Then func tn sends "guess what...."

then sleeps

THEN IS SCROLLS DOWN AND AN ERROR COMES UP?!!?!?!? what the heck ?!

oh BTW i have a few "Scroll func's" (See Below)

Func scroll()
     mousewheel("down", 2)
  EndFunc

func scroll3t()
   mousewheel("down"), 3)
EndFunc

func scrollup()
   mousewheel("up"), 20)
EndFunc

scroll () - scrolls twice down

scroll3t() - scrolls 3 times

scrollup() - YOU GUESSED IT! scrolls up :)

SO?! What the heck is happening?! im so confused why it's scrolling down twice for no reason.... it's not like i have the scroll() in the tn() ??

 

Edited by dannymcf2
  • Like 1

Share this post


Link to post
Share on other sites
SadBunny

True. Every opening parenthesis should have exactly one closing parenthesis. Change mousewheel("down"), 3) to mousewheel("down", 3) and you should be fine..

Also, next time you open a topic, please choose a more descriptive title. The forum is called "General Help and Support", meaning that virtually all posts on this forum are posts where someone needs some help with a script :) Try to hint at the sort of problem you are experiencing, and it will be more likely to get a good answer quickly.

/edit: lastly, as a final tip: don't write "THEN IS SCROLLS DOWN AND AN ERROR COMES UP?!!?!?!?", but rather "Then it scrolls down and an error comes up." ALLCAPS is considered yelling and generally frowned upon by people who try to communicate in a grown-up manner, and as such is better avoided in general. It is unnecessarily irritating.

Edited by SadBunny

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
dannymcf2

Okay thanks a lot guys, I'll try harder next time, thanks again.

When I'm home I'll change it.

i spent 2 hours writing my script so it's just I made a mistake right ? Like in places of my script I forgot to Endif haha and end Funcs.

 

i want to thank autoit for creating this great program! I freakin love it :)

Share this post


Link to post
Share on other sites
dannymcf2

Guys, is there a way to show a debug in the console or something like that? 

Ni need to know what my script is doing .

Edited by dannymcf2

Share this post


Link to post
Share on other sites
dannymcf2

Hey danp2,

ive split these Funcs up because...

in some Funcs I need mouse to scroll up twice and sometimes them to scroll 3 times or more and so on, so I decided to make multiple Funcs because I simply don't know what else i should do.also I made a little script where it scans small areas of the screen for a colour, and if it finds it, its continues to the next Func and if it doesn't find the colour it searches for another part of the screen area and...... Its keeps doing that until it finds something :P I thought of the idea when was at work and as soon as I got home I worked on it for like 2 hours and it actually worked! I think I should reward my self ;)

 

Share this post


Link to post
Share on other sites
Danp2

For debugging, check out the ConsoleWrite command in the help file.

in some Funcs I need mouse to scroll up twice and sometimes them to scroll 3 times or more and so on, so I decided to make multiple Funcs because I simply don't know what else i should do.

Again, this could all be handled with a single function. Perhaps like this:

Func Scroll($direction = 'down', $count = 1)

Then your code would use the values of $direction and $count to control the action to be performed. Here are some examples of calling this function:

scroll() ; uses the defaults of down and 1

scroll('up') ; overrides the direction

scroll('up', 12) ; overrides both default values

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • Marcvde
      By Marcvde
      Hello people, 
      I want to open a website but i don't know how... I tried..
      Here is my script, can someone write the code in it (thanks)
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $BProxy = GUICreate("Choose Proxywebsite ", 426, 235, 199, 138) $Label1 = GUICtrlCreateLabel("Press a Button for a Proxy Website", 18, 8, 209, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUISetBkColor(0xA0A0A4) $Button1 = GUICtrlCreateButton("Proxy1", 16, 32, 105, 41) $Button2 = GUICtrlCreateButton("Proxy2", 16, 81, 105, 41) $Button3 = GUICtrlCreateButton("Proxy3", 16, 128, 105, 41) $Button4 = GUICtrlCreateButton("Proxy4", 16, 177, 105, 41) $Button5 = GUICtrlCreateButton("Proxy5", 137, 32, 105, 41) $Button6 = GUICtrlCreateButton("Proxy6", 137, 81, 105, 41) $Button7 = GUICtrlCreateButton("Proxy7", 137, 128, 105, 41) $Button8 = GUICtrlCreateButton("Proxy8", 137, 177, 105, 41) $Button9 = GUICtrlCreateButton("Fuck it! Google now!", 256, 128, 153, 89) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetOnEvent($Button1, "Proxy1") #EndRegion ### END Koda GUI section ### While 1 Sleep(100) WEnd Func _Exit() Exit EndFunc Func Proxy1() ShellExecute("http://www.google.com/") EndFunc  
    • SkythekidRS
      By SkythekidRS
      hello guys  i have a problem..
      how can i set hotkey with unicode char?
      Example: hotkeyset('á','function') 
      Please Help me. 
    • xinx
      By xinx
      I'm have a working program that displays the users in Active Directory. When a user's name is clicked on it displays their details (profile folder, work folder, etc). However, what I'd really like to do is be able to eliminate using the mouse as much as possible, so instead of having to click on each user's name, you can use the UP and DOWN arrows and it will act as though their name has been clicked on (if that makes any sense?).

      Here's some of the code so far:


      $ADListView = GUICtrlCreateListView("Login Name|Display Name", 140, 60, 220, 280);A ListView to display the users ; Adjust the ADListView column headers _GUICtrlListView_SetColumnWidth($ADListView, 0, 100) _GUICtrlListView_SetColumnWidth($ADListView, 1, 116)

      Func UpdateUserList() _AD_Open() $SelectedUserType = GUICtrlRead($UserTypeCombo) ;Get the base OU for the user type $SelectedUserTypeBaseOU = IniRead("iniUsers.ini", $SelectedUserType, "BaseOU", "NotFound") ;Get the filtered results from the AD using base OU $ADData = _AD_GetObjectsInOU($SelectedUserTypeBaseOU, "(&(objectclass=user)(name=*))", 2, "sAMAccountName,distinguishedName,displayname", "displayname") GUICtrlSetData($ADListView, $ADData) _GUICtrlListView_DeleteAllItems($ADListView) GUICtrlSetData($UserPropertiesEditBox, "Properties of Selected User") $SelectedUser = "" ;For each AD user, add an item in in the ListView For $i = 1 To UBound($ADData) - 1 GUICtrlCreateListViewItem($ADData[$i][0] & "|" & $ADData[$i][2], $ADListView) GUICtrlSetOnEvent(-1, "ListClicked") ; For each item, add the required event Next _AD_Close() EndFunc ;==>UpdateUserList


      Func ListClicked() $ItemString = GUICtrlRead(@GUI_CtrlId) $ItemArray = StringSplit($ItemString, "|") $SelectedUser = $ItemArray[1] _AD_Open() $givenName = _AD_GetObjectAttribute($SelectedUser, "givenName") $SN = _AD_GetObjectAttribute($SelectedUser, "SN") $displayName = _AD_GetObjectAttribute($SelectedUser, "displayName") $profilePath = _AD_GetObjectAttribute($SelectedUser, "profilePath") $homeDirectory = _AD_GetObjectAttribute($SelectedUser, "homeDirectory") $homeDrive = _AD_GetObjectAttribute($SelectedUser, "homeDrive") $GroupArray = _AD_GetUserGroups($SelectedUser) GUICtrlSetData($UserPropertiesEditBox, "") _GUICtrlEdit_AppendText($UserPropertiesEditBox, "Properties of Selected User") _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "First Name: " & $givenName) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Last Name: " & $SN) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Login Name: " & $SelectedUser) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Profile Directory: " & $profilePath) _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Home Directory: " & $homeDirectory & " (" & $homeDrive & ")") _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & @CRLF & "Group Membership:") For $i = 1 To UBound($GroupArray) - 1 _GUICtrlEdit_AppendText($UserPropertiesEditBox, @CRLF & _AD_FQDNToDisplayname($GroupArray[$i])) Next _AD_Close() EndFunc ;==>ListClicked
      Any help would be great, thank you!
    • PoojaKrishna
      By PoojaKrishna
      Hi,

      I'm trying to click on a button on IE but I failed to do so using IEAction and IEFormSubmit. I'm trying to click on the 'Login' button on URL: https://briefing.met.ie/login.php. Please see the source code of page below


      <form id="login" action="./login-result.php" method="post"> <div class="section"> <h1>Authentication</h1> <div id="login_section"> <p> <input type="hidden" name="action" value="login"/> <label for="username">Username:</label> <input type="text" id="username" name="username" /> </p> <p> <label for="password">Password:</label> <input type="password" id="password" name="password" /> </p> </div> </div> <div class="section"> <input class="navButton" type="submit" value="Login" /> </div> </form>
      Is there any specific method to click on button of class navButton? Please help me.
×