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

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

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

Share this post


Link to post
Share on other sites
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
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

Wondering who uses AutoIT and what it can be used for ?


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: 2017-05-23
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.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAPPOP3.au3 UDF *  RTF Printer - UDF * XML.au3 - BETA * ADO.au3 UDF SMTP Mailer UDF * WinSCP UDF * GitHub API UDF - modest begining *

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 * _IEquerySelectorAll() (by uncommon) * 

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

@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
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

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
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

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

    • IamKJ
      By IamKJ
      So I have a lot of different functions in the little program I'm making.  Most of them use the Do statement, such as finding images, clicking buttons, etc.
       
      The question I have is how would I be able to both
      1) Create a hotkey to pause whatever I am doing at the moment.  If I have to put something into every function in the program, I don't mind.
      2) Create a hotkey to exit whatever I am doing and stop all loops or commands and bring back the main GUI?
    • nlta1992
      By nlta1992
      I want creat GUI, have button 1 to 10, but only use loop for ... to ... step ... next.
      Thanks.
    • SkysLastChance
      By SkysLastChance
      I keep losing the count of my $r varable when I go into the dropdown () function and call the same function.
      #include <Excel.au3> #include <AutoItConstants.au3> #include<GUIConstantsEx.au3> #include<EditConstants.au3> #include<GUIConstants.au3> Global $iBox, $oExcel, $oWorkbook, $r = 1, $x = 3 HowMany() Excel () Dropdown () Sleep (500) Func Dropdown () $list = GUICreate("Chart", 225, 80) $combobox = GUICtrlCreateCombo("Clinic 1", 10, 10, 120, 20) GUICtrlSetData(-1, "Clinic 2|Clinic 3|Clinic 4") $button = GUICtrlCreateButton("Select", 10, 40, 60, 20) GUISetState(@SW_SHOW) While 1 $guibox = GUIGetMsg() Select Case $guibox = $button Select Case GUICtrlRead($combobox) = "Clinic 1" GUIDelete($list) Auto () EndSelect Case $guibox = $GUI_EVENT_CLOSE EndSelect WEnd EndFunc Func HowMany() Local $iMsg While 1 ;~ Turn input into a number $iBox = Number(InputBox ("Regestration", "How Many Patients are there total?")) ;~ If user enters a string or cancels then get them to try again If $iBox = 0 Then $iMsg = MsgBox(1,'Regestration', 'Please enter a valid number') If $iMsg = 2 Then Exit Else ExitLoop EndIf WEnd EndFunc Func Excel() While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") If $ms=2 Then Exit ;~ Doesn't require sleep since the script is paused by the MsgBox above ;~ Sleep(250) WEnd ;~ Shouldn't use Global Scope inside functions moved to top of script Local $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") If FileExists($sExcelFile) Then ;~ Shouldn't use Global Scope inside functions moved to top of script $oExcel = _Excel_Open () $oWorkbook = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file. Else $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel, 2);this is here to create the xls file if it does not exist. EndIf EndFunc Func Auto() Local $aArray1 = _Excel_RangeRead($oWorkbook) ;~ If $iBox is greater than no. of rows in $aArray then $iBox equals the number of rows in $aArray If $iBox > (UBound($aArray1) - 1) Then $iBox = UBound($aArray1) - 1 For $i = 2 To UBound($aArray1) - 1 ;$i =0 Start from row A If $aArray1[$i][1] = "" Then Continueloop $sR0 = $aArray1[$i][0] ;status $sR1 = $aArray1[$i][1] ;Last Name $sR2 = $aArray1[$i][2] ;First Name $sR3 = $aArray1[$i][3] ;DOB $sR4 = $aArray1[$i][4] ;Sex $sR5 = $aArray1[$i][5] ;Mailling Address $sR6 = $aArray1[$i][6] ;Zip $sR7 = $aArray1[$i][7] ;Phone # $sR8 = $aArray1[$i][8] ;Visit Reason $sR9 = $aArray1[$i][9] ;Insurance $sR10 = $aArray1[$i][10] ;Clinic $sR11 = $aArray1[$i][11] ;Provider $sR12 = $aArray1[$i][12] ;Appt Time $sR13 = $aArray1[$i][13] ;Appt Date WinWaitActive ("Untitled - Notepad") ControlSend("Untitled - Notepad", "", "", $sR1 & ',' & $sR2 & @CR) $r += 1 If $r > $iBox Then Exit Dropdown () Next EndFunc so the second time I choose clinic 1 I want it to go to the next row which would be Champ brett in my example excel.
       
      Test.xlsx
      Example Format.xlsx
    • kevin42036
      By kevin42036
      Hi All,

      I am new to AutoIt and programming in general so any help would be greatly appreciated! 

      I am trying to create a script mainly using MouseClick and WinWait in order to automate some web processes. However, due to the lag time of the web pages and fields, sometimes my script does not run properly and I need to rerun it. I am trying to create a script that will check to see if the final line of the script was properly executed and if not, rerun the program and increase a count. Ultimately I would like some sort of report that tells me how many times it took to run to completion and total time. 

      Does anyone have any suggestions as to which functions I can use to accomplish this? I am also open to any suggestions on a better process to ensure that my program runs to completion.

      Thanks in advance!

      Kevin
    • SkysLastChance
      By SkysLastChance
      I know this code is not pretty by any means, but it will not loop. I have used this loop several diffrend times. 
      When I take out the this if statment it loops forever so I am guessing ti has to do with this.
      Any ideas on cleaning up code is appreciated too.
      If $r > $sBox Then Exit Endif #include <Excel.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> $sBox = InputBox ("Vital Site", "How Many Times") Excel () Logon () Sleep (2000) Auto () Func FormatDate($DATE) $SPLIT = StringSplit($DATE," ") $MM = StringMid($SPLIT[1],5,2) $YYYY = StringLeft($SPLIT[1],4) $DD = StringMid($SPLIT[1],7,2) Return $MM & "/" & $DD & "/" & $YYYY EndFunc Func Terminate() Exit EndFunc HotKeySet(("{ESC}"),"Terminate") Func Excel () While ProcessExists("EXCEL.EXE") $ms = MsgBox(5,"","Process error. You have an Excel sheet open. You must close it in order to let this program work. Please close it now.") If $ms=2 Then Exit Sleep(250) WEnd Global $sExcelFile = FileOpenDialog("Choose/Create Excel File", @ScriptDir, "(*.xlsx)") If FileExists($sExcelFile) Then Global $oExcel = _Excel_Open () $oExcel = _Excel_BookOpen($oExcel,$sExcelFile) ;this will open the chosen xls file. Else $oExcel = _Excel_Open() $oWorkbook = _Excel_BookNew($oExcel, 2);this is here to create the xls file if it does not exist. EndIf EndFunc Func Logon () $portal = ShellExecute ("C:\Program Files (x86)\MEDITECH\SSDWEB.Universe\SSDWEB.LIVEF.Ring\Client.mtad") ;MediTech WinWaitActive ("[CLASS:MagicFS]", "", "MagicFS Dispaly5") Sleep (300) ControlSend("[CLASS:MagicFS]", "", "", ("{F12}")) Sleep (700) ControlSend("[CLASS:MagicFS]", "", "", ("{RIGHT}")) Sleep (700) ControlSend("[CLASS:MagicFS]", "", "", ("{DOWN}")) Sleep (700) ControlSend("[CLASS:MagicFS]", "", "", ("{RIGHT}")) Sleep (700) ControlSend("[CLASS:MagicFS]", "", "", ("{RIGHT}")) Sleep (700) ControlSend("[CLASS:MagicFS]", "", "", ("{RIGHT}")) EndFunc WinWaitActive ("[CLASS:MagicFS]", "", "MagicFS Dispaly6") Func Auto () $r = 1 Local $aArray = _Excel_RangeRead($oExcel, Default, Default,1) For $i = 1 To UBound($aArray) - 1 ;$i =0 Start from row A $sR0 = $aArray[$i][0] ;status $sR1 = $aArray[$i][1] ;first name $sR2 = $aArray[$i][2] ;Last name $sR3 = $aArray[$i][3] ;Last 4 SSN $sR4 = $aArray[$i][4] ;DOB $sR5 = $aArray[$i][5] ;Email Address $sR6 = $aArray[$i][6] ;Mailling Address $sR7 = $aArray[$i][7] ;City $sR8 = $aArray[$i][8] ;state $sR9 = $aArray[$i][9] ;Zip Code $sR10 = $aArray[$i][10] ;Gender $sR11 = $aArray[$i][11] ;Phone ControlSend("[CLASS:MagicFS]", "", "", ("{F8}")) Sleep (500) ControlSend("[CLASS:MagicFS]", "", "", ("{F8}")) Sleep (500) ControlSend("[CLASS:MagicFS]", "", "", ("N")) ControlSend("[CLASS:MagicFS]", "", "", ("{TAB}")) Sleep (3000) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR1 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR2 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR6& @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("{TAB}")) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR7 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR8 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR9 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR11& @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR5 & @CR) ;Email7 Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR5 & @CR) ;Email Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", (FormatDate($sR4) & @CR)) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR10 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "Edit1", $sR3 & @CR) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("{F8}")) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("P")) Sleep (200) $sBox = MsgBox($MB_OK & $MB_TOPMOST,"Patient Portal","After you have entered the patient push OK") Sleep (300) ControlSend("[CLASS:MagicFS]", "", "", ("{F8 3}")) Sleep (200) ControlSend("[CLASS:MagicFS]", "", "", ("{ESC}")) Sleep (200) ControlSend("[CLASS:MagicFS Modal(3)]", "", "", ("{ENTER}")) $r = $r + 1 If $r > $sBox Then Exit Endif Next EndFunc