Jump to content
RyukShini

loop my entire script

Recommended Posts

RyukShini
Opt("WinDetectHiddenText",1)

#include <IE.au3>
#include <Array.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <clear.au3>
#include <ColorConstants.au3>; Including required files
#include <GUIConstantsEx.au3>
#include <file.au3>
#include <string.au3>
Sleep(5000)


Local $emails = "email.txt" ;sets file path
Local $pwd = "pwd.txt" ;sets file path
Local $name = "name.txt"
Local $ArrayEmail[57], $ArrayPwd[57], $ArrayName[57] ;declares array

_FileReadToArray($emails, $ArrayEmail) ;converts file to array
_FileReadToArray($pwd, $ArrayPwd);converts file to array
_FileReadToArray($name, $ArrayName);converts file to array


Local $url= "https://localhost/signup"
Local $oIE = _IECreate($url, 1)

$tags = $oIE.document.GetElementsByTagName("a")
For $tag in $tags
$class_value = $tag.GetAttribute("class")
If string($class_value) = "badge-signup-email-link" Then
    $oCorrectObj = $tag
    ExitLoop

EndIf
Next

If IsObj ( $oCorrectObj ) Then

_IEAction ($oCorrectObj, "click")

EndIf

Local $name = _IEGetObjByName ($oIE, "fullname")
Local $email = _IEGetObjByName ($oIE, "email")
Local $password = _IEGetObjByName ($oIE, "password")

_IEFormElementSetValue($name, $ArrayName[1])
_IEFormElementSetValue($email, "" & ++1 & $Arrayemail[1])
_IEFormElementSetValue($password, $ArrayPwd[1])


$colTags = _IETagNameGetCollection($oIE, "input")
For $oTag In $colTags
If $oTag.value = "Sign Up" Then
    sleep(15000)
    _IEAction($oTag, "click")
_IENavigate($oIE,"javascript:void(0);") ; javascript:void is triggered.
EndIf
Next

I coded this script and silly me forgot to create it in a loop to begin with -.-
now I have tried While & For loop with counters and what not, but I just can't seem to get it to work.

Could someone be of assistance?

Thanks in advance.

Share this post


Link to post
Share on other sites
water

Define "can't seem to get it to work".
Does this mean you get an error message? No results? The wrong results?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RyukShini
On 17/06/2016 at 10:09 AM, water said:

Define "can't seem to get it to work".
Does this mean you get an error message? No results? The wrong results?

Thank you for your reply.
I ran a while loop and it just seemed to make the script loop forever.
I used

$counter = 0
While $counter <= 5
;ALL MY CODE HERE
$counter = $counter + 1
WEnd

 

Share this post


Link to post
Share on other sites
water

Can't test at the Moment but I'm sure the code you posted Ends after 5 iterations. Test:

$counter = 0
While $counter <= 5
    $counter = $counter + 1
    ConsoleWrite("Loop: " & $counter & @CRLF)
WEnd

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RyukShini
21 minutes ago, water said:

Can't test at the Moment but I'm sure the code you posted Ends after 5 iterations. Test:

$counter = 0
While $counter <= 5
    $counter = $counter + 1
    ConsoleWrite("Loop: " & $counter & @CRLF)
WEnd

 

Will test it later, thanks a lot @water
You sure work your butt off :>

Share this post


Link to post
Share on other sites
water

Not really :) I'm sitting at an Airport waiting for my flight to become ready ;) 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RyukShini
6 minutes ago, water said:

Not really :) I'm sitting at an Airport waiting for my flight to become ready ;) 

Well I meant in means of helping us newbies :)

If you are bored feel free to give me a suggestion here:

Thanks buddy o:)

Share this post


Link to post
Share on other sites
water
On 20.6.2016 at 4:05 PM, RyukShini said:

Well I meant in means of helping us newbies :)

Yes, I'm working my butt off to help newbies ;)
But on the other side I learn something new every day  :)

  • Like 1

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
RyukShini
3 minutes ago, water said:

Yes, I'm working my butt off to help newbies ;)
But on the other side I learn something new every day  :)

I am very grateful, if it weren't for amazing users such as yourself, I would have a hard time learning!

Thanks again:sweating:

Share this post


Link to post
Share on other sites
water

:)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

  • Similar Content

    • SkysLastChance
      By SkysLastChance
      I was wondering how I read data inside of a iframe. I would like to be able to click something inside a iframe. However, I can't even find the tag. 
      The id and name change all the time so I can't use those. 
      The code highlighted in blue is what I am trying to click. (second picture)
      Here is what I have tried.
      $target = "" $tags = $oIE.document.GetElementsByTagName("div") For $tag in $tags $class_value = $tag.GetAttribute("class") If string($class_value) = "s_92 altstyle s_93 s_94" Then $target = $tag ConsoleWrite("Tag Found " & $target.outerText&@CRLF) ExitLoop EndIf Next  

       
       

    • SkysLastChance
      By SkysLastChance
       
      WinActivate("MEDITECH - Internet Explorer") Sleep (500) $oIE = _IEAttach("MEDITECH") $oDiv1 = _IEGetObjById($oIE, "sysmenu-searchbarbutton") _IEAction($oDiv1, "click") I am just trying to click the little magnifying glass, next to the gear button with no luck. I was hoping someone might have an idea why this is not working?
       

    • SkysLastChance
      By SkysLastChance
      I am trying to type a name in patient summary search box. How should I go about doing this. I am clearly not doing it right. (Attached Picture of HTML code.)
      This is what I have tried. I assume this is not working because it is not a form? 
      WinActivate("MEDITECH - Internet Explorer")       Sleep (500)    $oIE = _IEAttach("MEDITECH")    $oForm = _IEFormGetObjByName($oIE, "systemMenu")    $oText = _IEFormElementGetObjByName($oForm, "sysmenu-searchbarinput") _IEFormElementSetValue($oText, "Hey! This works!")
    • aiter
      By aiter
      Just want to report a warning I get when using IE udf and running from F5 in scite

      -> IE.au3 T3.0-2 Warning from function internal function __IEIsObjType, Cannot register internal error handler, cannot trap COM errors (Use _IEErrorHandlerRegister() to register a user error handler)
      When I look at IE.au3 I see a comment that this function has been removed as there are no more fatal errors.
       
    • boomingranny
      By boomingranny
      ;****************************************************************** ;Spotify Automation: Start spotify and play a playlist ;v1.01 27/04/2018 ;------------------------------------------------------------------ ;by Daniel Barnes ;------------------------------------------------------------------ ;v1.01 27/04/2018 ;restarts spotify if it fails the first time ;works on computers that minimize Spotify to tray ;instead of closing it, and have a different ui element selected ;such as the Devices available option when spotify is started ;------------------------------------------------------------------ ;v1.00 25/04/2018 ;initial version ;------------------------------------------------------------------ ;Replace the below with the Spotify URI ;If you right click the playlist> share> copy spotify uri ;you can find the uri $spotifyURI = "spotify:user:12177300374:playlist:0iaTAvHRSaIkD23ofl2tck" ;****************************************************************** ;if this script breaks in the future, figure this out using the AutoIt Window Info Tool Const $SpotifyWindowIdentifier = "[Title:Spotify;Class:Chrome_WidgetWin_0]" ;NOTE ABOUT SHUFFLE: ;I couldn't automate turning shuffling on or off ;I can toggle it, but I cannot figure out the current state ;If you want to shuffle, turn on shuffle in Spotify prior ;to running this script PlaySpotifyPlaylist($spotifyURI) Func PlaySpotifyPlaylist($spotifyURI,$retry = 0) ;terminate spotify process on subsequent attempts If $retry Then echo ("Closing existing Spotify process") ProcessClose("Spotify.exe") endif echo ("Launching Spotify URI") ShellExecute($spotifyURI) ;Pause any existing song playing (if there is any) ;this is because Spotify's window title is only 'Spotify' when it is not playing any songs If Not WinExists($SpotifyWindowIdentifier) Then echo ("Pausing existing song (To find spotify window)") $timer = TimerInit() While Not WinExists($SpotifyWindowIdentifier) Send("{MEDIA_PLAY_PAUSE}") Sleep(500) If TimerDiff($timer) > 5 * 1000 Then ErrorMsg ("Timed out trying pause existing song") WEnd endif ;Get Spotify Window Handle $hwndSpotify = WinGetHandle($SpotifyWindowIdentifier) echo ("Attempting to play playlist") $timer = TimerInit() While WinGetTitle($hwndSpotify) = "Spotify" ;once it is playing the song, the title changes to the name of the song WinActivate($hwndSpotify) ControlSend($hwndSpotify,"","","{ENTER}") ;space will play what was previously playing (even another playlist or song), enter will play the playlist ;) Sleep(1000) If TimerDiff($timer) > 5 * 1000 Then If $retry Then ErrorMsg ("Timed out trying to play playlist") else Return PlaySpotifyPlaylist($spotifyURI,$retry+1) endif endif WEnd EndFunc Func echo($text) ConsoleWrite ($text&@CRLF) EndFunc Func ErrorMsg($text) MsgBox(16,StringTrimRight(@ScriptName,4),$text) Exit EndFunc  
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.