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

    • DynamicRookie
      By DynamicRookie
      Hey there!
       
      Is there a way to detect movement only for 1 specific window?

      HWnd is not really working, it still detects movement in all the windows within the region

      This is my script:
       
      ;Checksum actual HotKeySet("{f2}", 'exit_') MsgBox(0, '', '0') Beep(500, 2000) $Hwnd = WinActive('') while 1 $Checksum = PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) If PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) <> $Checksum Then For $i = 1 To 100 Beep(1000, 50) Next MsgBox(0, '', 'New message!', 1) EndIf WEnd Func exit_() Beep(500, 1000) Exit 0 EndFunc I just want to check whenever a message comes because the app i use doesn't give notifications properly.

      Any help is really appreciated!
    • PramodR
      By PramodR
      Can you please see whats wrong im doing in the below code? i can read few registry entry but not all for eg, i am able to get value of "Shell" Key from the registry path  but not AutoAdminLogon which has the value of "1", is there any change i have to do to read numeric values?
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","Shell" )
       ConsoleWrite("This is Hello"& $shello)
      above command returns proper value , but same command with AutoAdminLogon returns null as shown in below ? infact registry has the value of 1.
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon" )
       ConsoleWrite("This is Hello"& $shello)
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
    • Trisha
      By Trisha
      Hello,
      I Have clicked on save as option to save a file, while doing that I need to rename a file appending with sysdate. I have searched in google find the below one line of code:
      FileMove("C:\somefile.txt", "C:\somefile1.txt"), When I am trying to append with sysdate. It is not happening. Please help me out  with the small issue.
    • TrashBoat
      By TrashBoat
      hey i would like to know if its possible to take a string like this
      $string = "onethousandninehundredeightyfive" and convert it into:
      $string = "one thousand nine hundred eighty five" i have something going on here but its no use
      $string = "onethousandninehundredeightyfive" Global $array[9] = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'] Global $array1[19] = ['onethousand', 'twothousand', 'threethousand', 'fourthousand', 'fivethousand', 'sixthousand', 'seventhousand', 'eightthousand', 'ninethousand','tenthousand','hundred', 'twohundred', 'threehundred', 'fourhundred', 'fivehundred', 'sixhundred', 'sevenhundred', 'eighthundred', 'ninehundred'] MsgBox(0, 0, AddSpaces($string)) Func AddSpaces($string) Local $finalStr $length = StringLen($string) For $x = 0 To $length Local $trim = StringTrimRight($string, $x) For $h = 0 To 18 If $trim = $array1[$h] Then $finalStr = $finalStr & " " & $trim $string = StringTrimLeft($string, $h) $length = StringLen($string) EndIf Next For $z = 0 To 8 If $trim = $array[$z] Then $finalStr = $finalStr & " " & $trim $string = StringTrimLeft($string, $z) $length = StringLen($string) EndIf Next Next Return $finalStr EndFunc ;==>AddSpaces  
×

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.