Jump to content
RyukShini

Uploading files with AutoIT in Wordress

Recommended Posts

RyukShini

Hello everyone!

I am trying to make a script that uploads files for me in wordpress(All I need to do is to manually choose which files to upload)
Here is my script so far:
 

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

Upload()

Func Upload()
    
    $sPD = "log=username&pwd=mypassword&wp-submit=Log+ind&redirect_to=http%3A%2F%2Fmyurl.com%2Fwp-admin%2F&testcookie=1"
oHTTP = ObjCreate("winhttp.winhttprequest.5.1")
$oHTTP.Open("POST", "http://myurl.com/wp-login.php " & $sUSR, False) ; Post url
$oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
$oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.5")
$oHTTP.SetRequestHeader("User-Agent", "User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.52 YaBrowser/15.12.2490.3614 (beta) Yowser/2.5 Safari/537.36")
$oHTTP.SetRequestHeader("Referer", "http://myurl.com/wp-login.php?redirect_to=http%3A%2F%2Fmyurl.com%2Fwp-admin%2F&reauth=1")
$oHTTP.SetRequestHeader("Cookie", "wordpress_test_cookie=WP+Cookie+check")
$oHTTP.SetRequestHeader("Connection", "keep-alive")
$oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") ; Header data >


$oHTTP.Send($sPD)
$oHTTP.Open("GET", "http://myurl.com/wp-admin/media-new.php", False) ; Post url
$oHTTP.SetRequestHeader("Host", "myurl.com")
$oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0")
$oHTTP.SetRequestHeader("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8")
$oHTTP.SetRequestHeader("Accept-Language", "en-US,en;q=0.5")
$oHTTP.SetRequestHeader("Referer", "http://myurl.com/wp-admin/")
$oHTTP.Send()

Endfunc

The upload button = "Choose Files"

Example code from:

https://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm

#include <FileConstants.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    ; Create a constant variable in Local scope of the message to display in FileOpenDialog.
    Local Const $sMessage = "Select a single file of any type."

    ; Display an open dialog to select a file.
    Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "All (*.*)", $FD_FILEMUSTEXIST)
    If @error Then
        ; Display the error message.
        MsgBox($MB_SYSTEMMODAL, "", "No file was selected.")

        ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.
        FileChangeDir(@ScriptDir)
    Else
        ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder.
        FileChangeDir(@ScriptDir)

        ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog.
        $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF)

        ; Display the selected file.
        MsgBox($MB_SYSTEMMODAL, "", "You chose the following file:" & @CRLF & $sFileOpenDialog)
    EndIf
EndFunc   ;==>Example

The HTML:
 

<p class="drag-drop-buttons"><input style="position: relative; z-index: 1;" id="plupload-browse-button" value="Choose Files" class="button" type="button"></p>

Some header info in the HTTP request:
 

POST http://myurl.com/wp-admin/async-upload.php HTTP/1.1
Host: myurl.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://myurl.com/wp-admin/media-new.php
Content-Length: 4555551
Content-Type: multipart/form-data; boundary=---------------------------12345678910
Cookie: LONG COOKIE HERE!
DNT: 1
Connection: keep-alive

-----------------------------102062144610664
Content-Disposition: form-data; name="name"

hdfhfg.jpg
-----------------------------102062144610664
Content-Disposition: form-data; name="post_id"

0
-----------------------------102062144610664
Content-Disposition: form-data; name="_wpnonce"

123456
-----------------------------102062144610664
Content-Disposition: form-data; name="type"


-----------------------------102062144610664
Content-Disposition: form-data; name="tab"


-----------------------------102062144610664
Content-Disposition: form-data; name="short"

1
-----------------------------102062144610664
Content-Disposition: form-data; name="async-upload"; filename="hdfhfg.jpg"
Content-Type: image/jpeg

This wouldn't be much of a problem if I just had some simple post data, but this makes my head spin....

Thanks in advance Masters!

(I could probably easily do this with IE, but I'd rather not use IE, I am not a big fan of it)
 

Share this post


Link to post
Share on other sites
JLogan3o13

@RyukShini you posted what you want to do, and where you pulled your code from, but I see nothing regarding what is not working for you. Are you getting an error? Are the files just not uploading? How about some actual detail rather than having us guess ;)

 


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
RyukShini
3 hours ago, JLogan3o13 said:

@RyukShini you posted what you want to do, and where you pulled your code from, but I see nothing regarding what is not working for you. Are you getting an error? Are the files just not uploading? How about some actual detail rather than having us guess ;)

 

Everything is working, I made all this happen without a problem.
Now my problem is that I don't have a clue about this form of data on how to implement it in a http request with AutoIT:
 

-----------------------------102062144610664
Content-Disposition: form-data; name="name"

hdfhfg.jpg
-----------------------------102062144610664
Content-Disposition: form-data; name="post_id"

0
-----------------------------102062144610664
Content-Disposition: form-data; name="_wpnonce"

123456
-----------------------------102062144610664
Content-Disposition: form-data; name="type"


-----------------------------102062144610664
Content-Disposition: form-data; name="tab"


-----------------------------102062144610664
Content-Disposition: form-data; name="short"

1
-----------------------------102062144610664
Content-Disposition: form-data; name="async-upload"; filename="hdfhfg.jpg"
Content-Type: image/jpeg

Normally a post data would simple look like this:
File=image.jpg&somedata=oakdoaksd
or in another script I made at some point:
fileurl=http://imur.com/oksokasd.png&somedata=blabla

But this is not the case here, I am not sure what to do with this sort of data.


Thanks in advance @JLogan3o13

(I coded all of it, learned from this forum and brugbart.dk, made many other web based scripts like these, but never with such HTTP Headers/Post info)

Share this post


Link to post
Share on other sites
trancexx

May I suggest WinHttp.au3 from the examples forum. It's made for this stuff, _WinHttpSimpleFormFill() function in particular.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
On 24/06/2016 at 6:54 PM, trancexx said:

May I suggest WinHttp.au3 from the examples forum. It's made for this stuff, _WinHttpSimpleFormFill() function in particular.

Thanks a lot @trancexx!
Will definitely look in to that first thing Monday morning!

 

Share this post


Link to post
Share on other sites
trancexx

np

It could be like this:

#include "WinHttp.au3"


$sDomain = "http://myurl.com/"
$sLoginPage = "/wp-login.php"
$sUploadPage = "/wp-admin/media-new.php"

$sLoginName = "username"
$sPassword = "mypassword"

; Choose file to upload
$sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)")
If $sFileToUpload Then
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $sDomain)

    ; Login first
    _WinHttpSimpleFormFill($hConnect, _
            $sLoginPage, _
            "loginform", _
            'user_login', $sLoginName, _
            'user_pass', $sPassword)

    ConsoleWrite('! Error for login = ' & @error & @LF)

    _WinHttpSimpleFormFill($hConnect, _
            $sUploadPage, _
            "file-form", _
            'async-upload', $sFileToUpload)

    ConsoleWrite('! Error for upload = ' & @error & @LF)


    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
EndIf

 

  • Like 1

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
19 hours ago, trancexx said:

np

It could be like this:

#include "WinHttp.au3"


$sDomain = "http://myurl.com/"
$sLoginPage = "/wp-login.php"
$sUploadPage = "/wp-admin/media-new.php"

$sLoginName = "username"
$sPassword = "mypassword"

; Choose file to upload
$sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)")
If $sFileToUpload Then
    $hOpen = _WinHttpOpen()
    $hConnect = _WinHttpConnect($hOpen, $sDomain)

    ; Login first
    _WinHttpSimpleFormFill($hConnect, _
            $sLoginPage, _
            "loginform", _
            'user_login', $sLoginName, _
            'user_pass', $sPassword)

    ConsoleWrite('! Error for login = ' & @error & @LF)

    _WinHttpSimpleFormFill($hConnect, _
            $sUploadPage, _
            "file-form", _
            'async-upload', $sFileToUpload)

    ConsoleWrite('! Error for upload = ' & @error & @LF)


    _WinHttpCloseHandle($hConnect)
    _WinHttpCloseHandle($hOpen)
EndIf

 

Makes perfectly sense @trancexx
Thank you so much, I will try to finish my script now!

 

EDIT:
 

! Error for login = 4
! Error for upload = 3

I am looking through WinHTTP.au3 now to find out what this error means, but any help is appreciated.

Using simpleformfill is it possible to add costum headers?
I don't really see an example in the help file with costum Headers.

Thanks in advance @trancexx

Edited by RyukShini
error for login & upload

Share this post


Link to post
Share on other sites
trancexx

Of course it's possible, but shouldn't really be needed in case of usual wordpress installation.

 

Check addresses. Maybe there's specific htaccess configuration on the server in place which redirects in case of .php access.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
21 hours ago, trancexx said:

Of course it's possible, but shouldn't really be needed in case of usual wordpress installation.

 

Check addresses. Maybe there's specific htaccess configuration on the server in place which redirects in case of .php access.

Okay, I will be sure to check the redirects and what not.
Thanks a lot! ;)

 

I changed something in the wp-login.php?redirect thingy
but still no luck I get errors
! Error for login = 4
! Error for upload = 3 (This error being understandable since we aren't logged in)

What does 4 error in "Error for login = 4????" stand for?
Thanks in advance @trancexx

Edited by RyukShini

Share this post


Link to post
Share on other sites
trancexx
21 hours ago, RyukShini said:

Okay, I will be sure to check the redirects and what not.
Thanks a lot! ;)

 

I changed something in the wp-login.php?redirect thingy
but still no luck I get errors
! Error for login = 4
! Error for upload = 3 (This error being understandable since we aren't logged in)

What does 4 error in "Error for login = 4????" stand for?
Thanks in advance @trancexx

It means server isn't serving you for some reason. Could you create new user and send me credentials via mail, I would like to see it first hand. I won't touch anything else, no worries.


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
3 hours ago, trancexx said:

It means server isn't serving you for some reason. Could you create new user and send me credentials via mail, I would like to see it first hand. I won't touch anything else, no worries.

Sorry I am not able to do so.
It is not my company, but I have another wordpress site I personally own, same principle?
you could try using that if you want.

You have messages disabled?
I can't sent it to you.

e80780a4c9d755054e33b32c941cf25e.png

Edited by RyukShini
Cannot receive messages

Share this post


Link to post
Share on other sites
trancexx

Use email. Mine is at top of the UDF.


♡♡♡

.

eMyvnE

Share this post


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

Use email. Mine is at top of the UDF.

Replied, thanks in advance.

Share this post


Link to post
Share on other sites
trancexx
2 hours ago, RyukShini said:

Replied, thanks in advance.

Well, it works for me.
If you check uploads you'll see mine. I used this exact code (with my credentials):

#include "WinHttp.au3"

$sLoginPage = '/wp-login.php'
$sUploadPage = '/wp-admin/media-new.php'


$sDomain = 'theyogapants.club'
$sLogin = 'that_username'
$sPassword = 'that_passwrd'


$sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)")


$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sDomain)

; Login first
_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword)

ConsoleWrite('! Error for login = ' & @error & @LF)


$sResponse = _WinHttpSimpleFormFill($hConnect, _
        $sUploadPage, _
        "file-form", _
        'async-upload', $sFileToUpload)

ConsoleWrite('! Error for upload = ' & @error & @LF)


_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

 


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
3 hours ago, trancexx said:

Well, it works for me.
If you check uploads you'll see mine. I used this exact code (with my credentials):

#include "WinHttp.au3"

$sLoginPage = '/wp-login.php'
$sUploadPage = '/wp-admin/media-new.php'


$sDomain = 'theyogapants.club'
$sLogin = 'that_username'
$sPassword = 'that_passwrd'


$sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)")


$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sDomain)

; Login first
_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword)

ConsoleWrite('! Error for login = ' & @error & @LF)


$sResponse = _WinHttpSimpleFormFill($hConnect, _
        $sUploadPage, _
        "file-form", _
        'async-upload', $sFileToUpload)

ConsoleWrite('! Error for upload = ' & @error & @LF)


_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

 

First of all, amazing support, second of all so simple!
will do this first thing in the morning, thanks.

Share this post


Link to post
Share on other sites
RyukShini
17 hours ago, trancexx said:

Well, it works for me.
If you check uploads you'll see mine. I used this exact code (with my credentials):

#include "WinHttp.au3"

$sLoginPage = '/wp-login.php'
$sUploadPage = '/wp-admin/media-new.php'


$sDomain = 'theyogapants.club'
$sLogin = 'that_username'
$sPassword = 'that_passwrd'


$sFileToUpload = FileOpenDialog("Choose something (Image better maybe?)", "", "All (*.*)")


$hOpen = _WinHttpOpen()
$hConnect = _WinHttpConnect($hOpen, $sDomain)

; Login first
_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword)

ConsoleWrite('! Error for login = ' & @error & @LF)


$sResponse = _WinHttpSimpleFormFill($hConnect, _
        $sUploadPage, _
        "file-form", _
        'async-upload', $sFileToUpload)

ConsoleWrite('! Error for upload = ' & @error & @LF)


_WinHttpCloseHandle($hConnect)
_WinHttpCloseHandle($hOpen)

 

Received this:

! Error for login = 1
! Error for upload = 3

:(

 

I checked the HTML/PHP on both pages and they are identical in the upload stage, no idea whats wrong.

Works for Yoga, does not work for other site(will check headers, cookies and everything)
Headers, Cookies are also identical(except for the domain of course)

 

Might be due to an extra layer of security and I may need to use user-agent in my header.
how would you add a costum header in the simpleformfill ?
Thanks in advance

Edited by RyukShini
user-agent

Share this post


Link to post
Share on other sites
trancexx
6 hours ago, RyukShini said:

Might be due to an extra layer of security and I may need to use user-agent in my header.
how would you add a costum header in the simpleformfill ?

If you want another user agent then do this:

$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586")

...and it will be added to all requests that use that $hOpen.

Also you can add whatever header with _WinHttpSimpleFormFill:

_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword, _
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586")

You can also add more than one, just use @CRLF to separate each other:

_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword, _
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586" & @CRLF & _
        "Referer: http://google.com" & @CRLF & _
        "DNT: 1")

 

Edited by trancexx

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
18 hours ago, trancexx said:

If you want another user agent then do this:

$hOpen = _WinHttpOpen("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586")

...and it will be added to all requests that use that $hOpen.

Also you can add whatever header with _WinHttpSimpleFormFill:

_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword, _
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586")

You can also add more than one, just use @CRLF to separate each other:

_WinHttpSimpleFormFill($hConnect, _
        $sLoginPage, _
        "loginform", _
        'user_login', $sLogin, _
        'user_pass', $sPassword, _
        "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586" & @CRLF & _
        "Referer: http://google.com" & @CRLF & _
        "DNT: 1")

 

Amazing I am gonna try.
However I found out it might not be the error afterall.
It may be due to the wordpress installation being in Danish on the other site, but still the IDs, Class, all of the HTML code is still in English of course, so I am not sure if WinHTTP takes that in to consideration?
Will try to fool around with it a bit.

 

<form name="loginform" id="loginform" action="http://url.dk/wp-login.php" method="post">
    <p>
        <label for="user_login">Brugernavn eller e-mail<br />
        <input type="text" name="log" id="user_login" class="input" value="" size="20" /></label>
    </p>
    <p>
        <label for="user_pass">Adgangskode<br />
        <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
    </p>
        <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever"  /> Husk mig</label></p>
    <p class="submit">
        <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Log ind" />
        <input type="hidden" name="redirect_to" value="http://url.dk/wp-admin/" />
        <input type="hidden" name="testcookie" value="1" />
    </p>
<form name="loginform" id="loginform" action="http://url.com/wp-login.php" method="post">
    <p>
        <label for="user_login">Username or Email<br />
        <input type="text" name="log" id="user_login" class="input" value="" size="20" /></label>
    </p>
    <p>
        <label for="user_pass">Password<br />
        <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
    </p>
        <p class="forgetmenot"><label for="rememberme"><input name="rememberme" type="checkbox" id="rememberme" value="forever"  /> Remember Me</label></p>
    <p class="submit">
        <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="Log In" />
        <input type="hidden" name="redirect_to" value="http://url.com/wp-admin/" />
        <input type="hidden" name="testcookie" value="1" />
    </p>

 

Share this post


Link to post
Share on other sites
trancexx

Language shouldn't make difference.

So you can do it from your browser by navigating to http://url.dk/wp-login.php


♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites
RyukShini
On 01/07/2016 at 6:48 PM, trancexx said:

Language shouldn't make difference.

So you can do it from your browser by navigating to http://url.dk/wp-login.php

Everything works in the same way.
only difference is the language, I honestly don't understand why this happens.

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

    • nooneclose
      By nooneclose
      My program has to first search for names in Column D that do not match up with column C. I got that search to work using arrays. It was slow and I could not figure out how to delete them so I just manually put coded the names that do not belong. I found their cell location but I do not know how to store that location and delete it.
      This is what I have so far.
      Local $NameToDelete1[6]  = _Excel_RangeFind($OpenWorkbook, "Smith, Bill") _ArrayDisplay($NameToDelete1, "Excel UDF: _Excel_RangeFind Example 1", "", 0, "|", "Sheet|Name|Cell|Value|Formula|Comment") _Excel_RangeDelete($OpenWorkbook.ActiveSheet, $NameToDelete1[2], $xlShiftUp)  
      Please help, I wanted to have this program done yesterday but I did not see this problem until yesterday. 
    • TrashBoat
      By TrashBoat
      So Im trying to make a simple 2d game and make some sort of collision detection so why not to make a 2 dimensional array but i have no clue how  to write it in multiple lines
      Global $map[5,5] = [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0 _ [0,0,0,0,0] something like this but it doesn't work
    • Zein
      By Zein
      #include "..\Include\Array.au3" #include "..\Include\File.au3" #include "..\Include\AutoItConstants.au3" Local $aRetArray Local $sFilePath = "n.csv" _FileReadToArray($sFilePath, $aRetArray, ",") ; _FileReadToArray($sFilePath, $aRetArray, $FRTA_COUNT, ",") _ArrayDisplay($aRetArray, "Original", Default, 8) The above code shows two versions of _FileReadToArray and both don't work as expected.
      The first one doesn't use the comma as a delimiter. (so I get a single column array)  I tried adding "Default" between $aRetArray and "," then it told me it had an incorrect number of parameters. 

      I looked again at the documentation:
       
      #include <File.au3> _FileReadToArray ( $sFilePath, ByRef $vReturn [, $iFlags = $FRTA_COUNT [, $sDelimiter = ""]] )
      And I with or without the flags params I should be getting a 2D array due to my file being a csv. 
      I then tried a regular flag, $FRTA_COUNT, and it tells me that I'm using a variable $FRTA_COUNT while it's not declared. Tried putting in 1 instead and it told me again, incorrect number of params. 

       
    • nooneclose
      By nooneclose
      I need to perform a subtotal in excel and I would like to automate this process using Autoit if possible like always any and all help will be greatly appreciated. 
      I can not find a good example but the two from Microsoft. Here is one of the two from msdn.microsoft.com/en-us/vba/excel-vba/articles/range-subtotal-method-excel
      I do not really understand how to translate this into AutoIt, but I gave it a try and here is what I have.
      $OpenRange      = "A1:E200" $xlSum          = -4157 $Added_Array[2] = [2, 3] $OpenRange.Subtotal("B1", $xlSum, $Added_Array, True, False, True) I just need to perform a subtotal on a range based on a header called department, and then perform a sum on the results.
    • nooneclose
      By nooneclose
      How to use _Excel_RangeSort to sort my excel file by three different headers Column A1, B1, and C1 have headers on which I want to sort by. The headers on which I want to sort are department, employee type, and name.
      I still really new to AutoIt so I do not actually know how to properly start this line or lines of code, to be honest. The example code is the best I can do.
      _Excel_RangeSort($OpenWorkbook, Default, "A1:C1", "1:1", $xlDescending, Default, $xlYes, Default, $xlSortRows) I just need to sort by those three headers in that order of department, employee type, and name, plus in descending order.
       
      any and all help would be greatly appreciated.  Thank you!
×