Jump to content
xiantez

FileReadLine not returning all characters in a line

Recommended Posts

xiantez
Posted (edited)

Hello Everyone, 

I am having a bit of trouble getting my FileReadLine function to read all the characters in a specific text file. Here is my code. 

Func PastePassword() ;Paste Password
        $file = ('C:\Text\Logins\MacroPWList.txt')
        FileOpen($file, 0)
        For $i = 2 to _FileCountLines($file)
            $line = FileReadLine($File, 2)
            GUISetState(@SW_HIDE, $wsi_form)
            Sleep(350)
            Send($line)
            Sleep(150)
            Send("{Enter}")
            ExitLoop
        Next
EndFunc

$line should return the following string "EY@RdJ5S}#<r8rh"

However, instead $line is returning "EY@RdJ5S}<r8rh"

For some reason it is leaving out the # sign in the string. Does anyone know why that is?

 

Thanks for all your help!

Edited by xiantez

Share this post


Link to post
Share on other sites
jdelaney
Posted (edited)
Send($line, 1)

Click the Send link, above, to read why in the helpfile

Edited by jdelaney

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
xiantez
12 minutes ago, jdelaney said:
Send($line, 1)

Click the Send link, above, to read why in the helpfile

*facepalm*

 

Thanks so much!

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

    • ubelong2matt
      By ubelong2matt
      I'm hoping someone can help me.  I have a script that grabs the source of an XML page, parses it using _XMLDomWrapper, writes to an INI, and compares that with preparation to use "send" commands to post to a Twitter account.  The problem is, when trying to send the title of the XML, message boxes display it correctly but the sent information omits the first character, posts second, then omits two more before posting the rest of it.
       
      For instance, the title is stored in a variable and is displayed as when passing it to a message box:
      #Phishing: Phishing: It Help Desk However, when it is passed to the send command to be typed into a Twitter post, it turns into:
      ishing: Phishing: It Help Desk It sounds confusing so here's my code.  The XML file and INI file will generate automatically.  I would suggest, since that's a live feed of XML that you use the XML provided below and opt NOT to update the XML file when asked.  Also, each time you run the program, you'll want to delete the INI file so it actually runs the functions to send the information.
       
      WARNING:  I am not good at coding.  I learn by example and most of the code I write is sloppy and could probably be done in vastly fewer lines of code and easier with different functions or techniques.  You have been warned that this will be ugly.
       
      Script:
      #include <_XMLDomWrapper.au3> #include <Inet.au3> Opt("SendKeyDelay", 10) ;============================================== ; VARIABLES ;============================================== Global $xmlFile = @ScriptDir & "\alerts.xml" Global $alertINI = @ScriptDir & "\alert.ini" ;============================================== If FileExists($xmlFile) Then Switch MsgBox(36,"File Exists","The XML file exists." & @CRLF & "Should it be deleted and a new one downloaded?") Case 6 ;yes FileDelete($xmlFile) _getXML() _parseXML() _iniCompare() Case 7 ;no _parseXML() _iniCompare() EndSwitch Else _getXML() _parseXML() _iniCompare() EndIf ;============================================== ; FUNCTION _getXML ;============================================== Func _getXML() Local $xmlSource = _INetGetSource('http://alerts.illinoisstate.edu/xml/',True) FileWrite($xmlFile,$xmlSource) EndFunc ;============================================== ;============================================== ; FUNCTION _parseXML ;============================================== Func _parseXML() _XMLFileOpen($xmlFile, 'xmlns:isuoa="http://alerts.illinoisstate.edu/xml/oa.dtd"') Local $title = _XMLGetValue("//title") Global $alertTitle = "#" & $title[3] MsgBox(0,"test",$alertTitle) Global $alertLink = _XMLGetValue("//link") $alertLink = StringReplace($alertLink[3],"http://","") $alertLink = StringReplace($alertLink,"illinoisstate","ilstu") $alertLink = StringReplace($alertLink,"#_","") ;MsgBox(0,"test",$alertLink) Global $alertUpdate = _XMLGetValue("//isuoa:updatecount") $alertUpdate = $alertUpdate[1] ;MsgBox(0,"test",$alertUpdate) EndFunc ;============================================== ;============================================== ; FUNCTION _iniCompare ;============================================== Func _iniCompare() If $alertTitle = IniRead($alertINI,"OPTS","Title",0) And $alertLink = IniRead($alertINI,"OPTS","Link",0) Then If $alertUpdate > 0 Then If $alertUpdate <> IniRead($alertINI,"OPTS","Update",0) Then ;_twitterLogin() _postUpdate() EndIf EndIf Else ;_twitterLogin() _postAlert() EndIf EndFunc ;============================================== ;============================================== ; FUNCTION _twitterLogin ;============================================== Func _twitterLogin() ;MsgBox(0,"test","lets log into twitter") ShellExecute("http://twitter.com") Sleep(2000) Send("{ENTER}") Sleep(5000) Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}") EndFunc ;============================================== ;============================================== ; FUNCTION _postAlert ;============================================== Func _postAlert() Sleep(2000) Send("{ASC 35}" & $alertTitle & @CRLF & $alertLink) ;Send($alertTitle & @CRLF & $alertLink) IniWrite($alertINI,"OPTS","Title",'"' & $alertTitle & '"') IniWrite($alertINI,"OPTS","Link",'"' & $alertLink & '"') IniWrite($alertINI,"OPTS","Update",$alertUpdate) Sleep(2000) ;MsgBox(0,"test",$alertTitle & @CRLF & $alertLink) EndFunc ;============================================== ;============================================== ; FUNCTION _postUpdate ;============================================== Func _postUpdate() Sleep(2000) Send("[UPDATE] {ASC 35}" & $alertTitle & @CRLF & $alertLink) ;Send("[UPDATE] " & $alertTitle & @CRLF & $alertLink) IniWrite($alertINI,"OPTS","Update",$alertUpdate) ;make this last Sleep(2000) ;MsgBox(0,"test",$alertTitle & @CRLF & $alertLink) EndFunc ;============================================== XML:
      <?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0" xmlns:isuoa="http://alerts.illinoisstate.edu/xml/oa.dtd" xmlns:atom="http://www.w3.org/2005/Atom"> <channel> <title>Tech Alerts at Illinois State University</title> <link>http://alerts.illinoisstate.edu/</link> <description>Technology Alerts that affect Illinois State University</description> <language>en-us</language> <copyright>Copyright 2013, Illinois State University</copyright> <webMaster>alerts@illinoisstate.edu (Tech Alerts at Illinois State)</webMaster> <atom:link href="http://alerts.illinoisstate.edu/xml/" rel="self" type="application/rss+xml" /> <image> <url>https://alerts.illinoisstate.edu/templates/images/rss-logo.png</url> <title>Tech Alerts at Illinois State University</title> <link>http://alerts.illinoisstate.edu/</link> <description>Tech Alerts</description> <width>102</width> <height>102</height> </image> <item> <title>Phishing: Phishing: It Help Desk</title> <link>http://alerts.illinoisstate.edu/#_2614</link> <description><![CDATA[<p>The following phishing email has been reported to the Help Desk. This email was not sent by Illinois State University.</p> <p><span style="color: rgb(255, 0, 0); font-weight: 700;">Important:</span> If you clicked the link in this email and &quot;logged in&quot; with your ULID and password, you should change your password and security question immediately.</p> <p>For more information, refer to <a href="http://helpdesk.illinoisstate.edu/kb/1364/">[1364] How to recognize phishing emails targeting Illinois State University</a>.</p><blockquote><p>Your mailbox is almost full.</p><p>465MB&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 500MB</p><p>Current size&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Maximum size</p><p>Please increase your mailbox quota size automatically by clicking HERE&lt;http://valmessage.jigsy.com/&gt; and fill-out the necessary requirements to automatically increase your mailbox quota size.</p><p>IMPORTANT NOTE: You won&#39;t be able to send and receive mail messages at 480MB .</p><p>ITS help desk</p><p>ADMIN TEAM</p><p>=A9Copyright 2013 Microsoft</p></blockquote>]]></description> <pubDate>Tue, 22 Oct 2013 12:15:00 -0500</pubDate> <category>Active</category> <isuoa:updatecount>0</isuoa:updatecount> <author>alerts@illinoisstate.edu (Tech Alerts at Illinois State)</author> <guid isPermaLink="true">http://alerts.illinoisstate.edu/archive/2614/</guid> </item> <item> <title>Network: Network Maintenance</title> <link>http://alerts.illinoisstate.edu/#_2343</link> <description><![CDATA[<p><span style="color: rgb(0, 0, 0); font-family: Tahoma, sans-serif; ">Telecommunications &amp; Networking have scheduled network maintenance for this date. More details will be posted as they become available.</span></p>]]></description> <pubDate>Sun, 17 Nov 2013 00:00:00 -0600</pubDate> <category>Upcoming</category> <isuoa:updatecount></isuoa:updatecount> <author>alerts@illinoisstate.edu (Tech Alerts at Illinois State)</author> <guid isPermaLink="true">http://alerts.illinoisstate.edu/archive/2343</guid> </item> </channel> </rss> I scoured the internet and these forums/site for anything that could explain what it's doing.  If this is a stupid question/problem all I ask is that you go easy on me and forgive my ignorance.   Thank you for your time, Matt
    • nitekram
      By nitekram
      Can someone explane the following: Missing chars when using code?

      ps - looks like you can no longer paste your code with TIDY???

      #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Example1() MsgBox('', '', 'Why is the ampersand sign missing? & DEC 38') Example2() MsgBox('', '', 'Why is the Plus, Exclamation Mark, and Pound Sign missing? + DEC 43, # DEC 35, ! DEC 33') ; example 1 Func Example1() ; In this example the & is missing? Local $msg, $Left = 10, $Down = 0 GUICreate("My GUI", 100, 960) ; will create a dialog box that when displayed is centered For $x = 32 To 64 GUICtrlCreateLabel(Chr($x), $Left, $Down) $Down += 30 Next GUISetState(@SW_SHOW) ; will display an empty dialog box ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd GUIDelete() EndFunc ;==>Example1 ; example 2 Func Example2() ; In this example the # and + and ! signs are missing? Run('notepad.exe') Sleep(1000) For $x = 32 To 64 Send(' ' & Chr($x)) Send("{Enter}") Next EndFunc ;==>Example2
×