ssah8

Display loop count

38 posts in this topic

#1 ·  Posted (edited)

So im creating a bot that logs in on a website. The website got a dropdown menu, and I have to choose the right one to login (Student)

#include <IE.au3>
#inculude <Inet.au3>

$oIE = _IECreate("https://sms14.schoolsoft.se/engelska/jsp/Login.jsp?eventMessage=ERR_Not_Logged_In")

$Name = _IEGetObjByName($oIE, "ssusername")
$Pass = _IEGetObjByName($oIE, "sspassword")
$dropdown = _IEGetObjByName($oIE, "usertype")

_IEPropertySet($Name, 'innerText', 'censored')
_IEPropertySet($Pass, 'innerText', 'censored')
_IEPropertySet($dropdown, 'innerText', 'Student') <------ How do I make the dropdown list select "Student"?

 

Website: https://sms14.schoolsoft.se/engelska/jsp/Login.jsp?eventMessage=ERR_Not_Logged_In

Edited by JLogan3o13

Share this post


Link to post
Share on other sites



59 minutes ago, ssah8 said:

_IEPropertySet($Name, 'innerText', 'censored')

_IEPropertySet($Pass, 'innerText', 'censored')

Does this even work? Normally you would want to us _IEFormElementSetValue.

Quote

The website got a dropdown menu, and I have to choose the right one to login (Student)

Take a look at _IEFormElementOptionSelect.

Share this post


Link to post
Share on other sites

It didn't work. Im new to AutoIT. Can you please write an example?

Share this post


Link to post
Share on other sites

_IEFormElementOptionSelect($dropdown, 'innerText', 'Student')

That didn't work either.

Share this post


Link to post
Share on other sites
1 hour ago, ssah8 said:

It didn't work. Im new to AutoIT. Can you please write an example?

"Didn't work" isn't sufficient feedback. Next time, post the results from the Scite output window.

1 hour ago, ssah8 said:

_IEFormElementOptionSelect($dropdown, 'innerText', 'Student')

That didn't work either.

Here's a working example using the proper _IE functions --

#include <IE.au3>

$oIE = _IECreate("https://sms14.schoolsoft.se/engelska/jsp/Login.jsp?eventMessage=ERR_Not_Logged_In")

$oForm = _IEFormGetObjByName($oIE, 'userForm')
$Name = _IEFormElementGetObjByName($oForm, "ssusername")
$Pass = _IEFormElementGetObjByName($oForm, "sspassword")
$dropdown = _IEFormElementGetObjByName($oForm, "usertype")

_IEFormElementSetValue($name, 'censored')
_IEFormElementSetValue($Pass, 'censored')
_IEFormElementOptionSelect($dropdown, 'Student', 1, 'byText')
_IEFormSubmit($oForm)

 

Share this post


Link to post
Share on other sites

And how do I make that a loop?

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

If you want further assistance, please provide a detailed explanation of how you would be using this code in a loop.

Share this post


Link to post
Share on other sites

I want it all to be repeated over and over again. I have now copy and pasted everything like 100 times, it works, but not as efficient.

Share this post


Link to post
Share on other sites

#10 ·  Posted

There are plenty of loop examples on the forum and in your help file.

I'm still not getting the big picture.  There shouldn't be any need to have to login hundreds of times.  Why not login once an pull all the data you need while in the single session?

Share this post


Link to post
Share on other sites

#11 ·  Posted

Yeah... why do you need to continuously log into the same website multiple times?

Share this post


Link to post
Share on other sites

#12 ·  Posted

1 hour ago, ssah8 said:

 

I want it all to be repeated over and over again. I have now copy and pasted everything like 100 times, it works, but not as efficient.

 

Please explain clearly why this is needed at all before asking any other question.

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#13 ·  Posted

10 hours ago, Jos said:

Please explain clearly why this is needed at all before asking any other question.

Jos

Well, on my profile page on the website,there is a login count. I want to boost that login count to a higher number. Anything more I have to explain?

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Exactly which one website - do you mean AutoIt Forum ?

 

Edited by mLipok

NEW:     ADO.au3 UDF     POP3.au3 UDF     XML.au3 UDF    How to use IE.au3  UDF with  AutoIt v3.3.14.x  for other useful stuff click the following button:

Spoiler

Last update: 2016-11-12
Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. 

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft Components * TeamViewer API -UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF *

My contribution to others projects: * _sql.au3 UDF  *

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Best coding practices * 

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities *

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, The Art of Computer Programming
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

 

Share this post


Link to post
Share on other sites

#15 ·  Posted

@mLipok He wants to boost his login count on his school's website.   Is that accurate @ssah8 ?  

You wouldn't by chance be required to login so many times a week/period and/or get perks the higher your login count is...do you?  Artificially raising the login count still doesn't seem right to me.  There's got to be a reward for you doing so, otherwise you'd use some other web server.

Share this post


Link to post
Share on other sites

#16 ·  Posted

28 minutes ago, spudw2k said:

@mLipok He wants to boost his login count on his school's website.   Is that accurate @ssah8 ?  

You wouldn't by chance be required to login so many times a week/period and/or get perks the higher your login count is...do you?  Artificially raising the login count still doesn't seem right to me.  There's got to be a reward for you doing so, otherwise you'd use some other web server.

It's just a fun thing to do, and why do you care? I get to do whatever I want to, I just needed help with that.

 

Share this post


Link to post
Share on other sites

#18 ·  Posted

Pop this in before the function, adjust the sleep time to whatever exceeds your needs. Example, you know the cycle duration to log in and bump the counter is 3 minutes. adjust the timer to three minute value

While 1
   Sleep (50)

WEnd
Per help details.... Amount of time to pause (in milliseconds).

Share this post


Link to post
Share on other sites

#19 ·  Posted

10 hours ago, ssah8 said:

Well, on my profile page on the website,there is a login count. I want to boost that login count to a higher number. Anything more I have to explain?

.. and why is that important? Doesn't sound as a very "smart" thing to do as it is likely logged. 

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#20 ·  Posted

Hello.

I was wondering how I could make a status info box in autoit. I can explain it in a sentence.

Let's say there is a number on a website (1). After some minutes, that number updates to another number (5). How do an status box that updates that number aswell in autoit? I am thinking of a GUI.

 

Thanks

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

  • Similar Content

    • harvester2001
      Refresh array after one loop
      By harvester2001
      Hi
      I need some help.
      I try ping computers from targets.txt (I have computer name in lines) if they ping I want do something and after that remove pc name from targets.txt. It`s working but problem is when I put this inside loop, because I need run script until all computers will not be removed from the list (targets.txt). I don`t know how to "refresh" array
      Please help
      #include <File.au3> #include <Array.au3> #include <MsgBoxConstants.au3> Local $PC_list = "\targets.txt" Local $bTargets = FileReadToArray(@ScriptDir& $PC_list) Do _check_ping() ;count_lines Local $file_count_lines = _FileCountLines(@ScriptDir& $PC_list) $i = $file_count_lines ConsoleWrite("na liście "&$i & @CRLF) Until $i = 0 ; IF &i = 0 then show MsgBox MsgBox(1, "xXx", "Finish") ;PING Func _check_ping() For $sPC In $bTargets $var = Ping($sPC, 250) If $var Then ConsoleWrite($sPC &"online"& @CRLF) ;Do something ;Delete $sPC from targets.txt Local $_Array _FileReadToArray ( @ScriptDir& "\targets.txt", $_Array ) $_Array = _DeleteArrayElementWithStringInstr ( $_Array, $sPC ) _FileWriteFromArray ( @ScriptDir& "\targets.txt", $_Array, 1 ) Sleep(200) Else ConsoleWrite($sPC &"offline"& @CRLF) EndIf Next EndFunc ;DELETE LINE FROM TXT Func _DeleteArrayElementWithStringInstr ( $_Array, $_String ) Local $_Item For $_Element In $_Array If StringInStr ( $_Element, $_String ) <> 0 Then _ArrayDelete ( $_Array, $_Item ) Else $_Item+=1 EndIf Next Return ( $_Array ) EndFunc ;==> _DeleteArrayElementWithStringInstr ( )  
    • harvester2001
      Variable must be of type "Object" inside loop
      By harvester2001
      Hi
      I need help, I found script to check computer model. I want use it in loop to chceck multiple pc`s (targets.txt with computer names).
      But when i try use inside loop i get error: Variable must be of type "Object" and I dont know how to fix this
      Plz help
       
      Local $targets = @ScriptDir& "\targets.txt" Local $log_name = "\scan.log" $msgBox = MsgBox(4, "Scan", "need tergets.txt") Example() Func Example() If $msgBox = 7 Then exit EndIf If Not FileExists($targets) Then MsgBox($MB_SYSTEMMODAL, "", "File: targets.txt - no exist !") Exit EndIf FileOpen($targets, 0) Global $arr[1000] ReDim $arr[_FileCountLines($targets)+1] For $i = 1 to _FileCountLines($targets) $line = FileReadLine($targets, $i) $arr[$i] = $line ; chceck if pc is online Local $iPing = Ping($arr[$i], 250) If $iPing Then ; ONLINE Local $strComputer = $arr[$i] $colItems = "" $Output="" $Output = $Output & "Computer: " & $strComputer & @CRLF $Output = $Output & "==========================================" & @CRLF $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", _ "0x10" + "0x20") If IsObj($colItems) then For $objItem In $colItems $Output = $Output & "Vendor: " & $objItem.Vendor & @CRLF $Output = $Output & "SN: " & $objItem.IdentifyingNumber & @CRLF $Output = $Output & "Name: " & $objItem.Name & @CRLF $Output = $Output & "UUID: " & $objItem.UUID & @CRLF if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop $Output="" Next Else Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_ComputerSystemProduct" ) Endif Else ;OFFLINE _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" OFFLINE") EndIf Next EndFunc  
       
    • mond1106
      help loop parameter
      By mond1106
      how do I break the loop if my program is stuck in it without exiting the whole program?
       
      i just want it to start from the beginning of the code here is my program
       
      While 1
      $picture = "target.png"
      $result = _ImageSearch($picture,1,$x1,$y1,0,0)
      If $result = 1 Then
         Send("{4}")
         MouseClick("left",$x1,$y1,1,1)
         Sleep(2000)

         Do
         $picture2 = "status.png"
         $result2 = _ImageSearch($picture2,1,$x1,$y1,0,0)
         
         Send("{2}")
         Send("{1}")
      Until $result2 = 1
       
       
      as you see if my program doesnt detect  or see picture2 then the loop wont stop.
       

       
    • harvester2001
      start 20 active downloads in one time after finish 1/20 start next download
      By harvester2001
      Hi I need your help
      I need download backup from 200 remote pc. I calculate that I can download 20 backups in one time. I need to create loop, take localizations from txt file and start 20 downloads in one time (i want use ShellExecute and robocopy), after finish one from running 20 take another localizations from txt file until localizations finish. And I need trigger if is 7:00 pause script. I hope you know what I mean
      Many thanks for help, sorry for my english.
      This is what I got:
      #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <FileConstants.au3> #include <File.au3> #include <Array.au3> #include <Date.au3> Local $targets = @ScriptDir& "\targets.txt" Local $log_name = "\autoit.log" MsgBox($MB_SYSTEMMODAL, "", "start copy", 1) Example() Func Example() If Not FileExists($targets) Then MsgBox($MB_SYSTEMMODAL, "", "The file targets.txt - doesn't exist!") Exit EndIf FileOpen($targets, 0) Global $arr[1000] ReDim $arr[_FileCountLines($targets)+1] For $i = 1 to _FileCountLines($targets) $line = FileReadLine($targets, $i) $arr[$i] = $line ; Check if is online Local $iPing = Ping($arr[$i], 250) If $iPing Then ; ONLINE $rc = FileCopy("\\"&$arr[$i]&"\e$\backup\", @ScriptDir&"\downloads\"&$arr[$i]&"\", $FC_CREATEPATH) If $rc = 0 Then _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" ONLINE error") Else _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" ONLINE done") EndIf Else ;OFFLINE _FileWriteLog(@ScriptDir & $log_name, $arr[$i]&" OFFLINE") EndIf Next EndFunc ;==>Example MsgBox($MB_SYSTEMMODAL, "", "Finish downloads backups") Exit  
    • Szmycu
      Ending Loop When found Pixel Color
      By Szmycu
      Hello i Have HP Bar in my game and it has 170px of width and then im gonna find start of this by mouse pos then i got $hpStart[0] = 661  $hpStart[1] = 230 ,  $hpEnd[0] = 839
      And there is from $hpStart[0] = 661 the same color - 0xCB423B but depends of my points of hp for example on pixel  $hpStart[0] = 745 would be another color not  0xCB423B and then i will know my my character got 50% of health points.
       
      I encountered problem here - for loop still looping to 839 and not founding this change in color for example on pixel $hpStart[0] = 745
      I would know actual $i counter and $hpEnd[0] then only i can calculate current health percent value 
       
      Please help me how to achieve that! Thanks for any help
       
      Func MouseCord() $MousePos = MouseGetPos() global $hpStart = $MousePos global $hpEnd = $hpStart $hpEnd[0] = $hpEnd[0] + 170 For $i = $hpStart[0] To $hpEnd[0] ; Looping from 661 to 839 $pixel = PixelGetColor($i,$hpStart[1]) If $pixel <> 0xCB423B Then $hpNowPer = ( $hpEnd[0] - $i ) / 170 $hpPoOdjeciu = 1 - $hpNowPer $hpNowPercent = Round($hpPoOdjeciu,2) ExitLoop ; - that not working EndIf Next EndFunc