Sign in to follow this  
Followers 0
myspacee

Paintize them

8 posts in this topic

hello to all,

want to open and save a lot of .jpg files using MSpaint

think this :

- list .jpg in given directoy

- for each file

- open

- save

- exit

- next file

then script this:

#include <file.au3>
#include <array.au3>

Dim $sourcedir

            
;Root folder
$sourceFolder = FileSelectFolder("Select folder with some images "  & @CRLF & "(*.*)", "", 0, @ScriptDir)
If StringRight($sourceFolder, 1) <> "\" Then $sourceFolder  &= "\"
            

If $sourceFolder <> "\" Then
            

    ;Gather files into an array
    $fileList = _FileListToArray($sourceFolder, "*.jpg", 1)


    ;Loop through array
    For $X = 1 to $fileList[0]
        $val = RunWait("mspaint.exe " & chr(34) & $sourceFolder & $fileList[$x] & chr(34), @WindowsDir, @SW_MAXIMIZE)
        
        Send("+{F12}")      ;shift+F12
        Sleep(1000)
        Send("!{F4}")   ;alt+F4    [close]

EndIf

but can't send shift+F12 [save] and then alt+F4 [close].

what i miss ?

m.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

RunWait. This function will run the application and wait for it to end before returning to your script.

You're also missing the Next keyword on the For loop.

I've also never heard of Shift+F12 being save in MSPaint.

Edited by Richard Robertson

Share this post


Link to post
Share on other sites

thank you,

now works. Yes check also Vista in european version MSpaint save with MAIUS+F12.

m.

Share this post


Link to post
Share on other sites

Looking for a script like this, but how to improve it ?

I would like to open any image or any directory containing images with the mouse right click and automatically reduce the size of one file or all files in directrory ?

Regards

Share this post


Link to post
Share on other sites

Looking for a script like this, but how to improve it ?

I would like to open any image or any directory containing images with the mouse right click and automatically reduce the size of one file or all files in directrory ?

Regards

Search Example scripts for Image Resizer and that should give you a good starting point.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Search Example scripts for Image Resizer and that should give you a good starting point.

Thank you for your answer

Found that :

http://www.autoitscript.com/forum/index.php?showtopic=88637&st=0&p=636878&hl=Image%20Resizer&fromsearch=1&#entry636878

But this doesn't explain to me how to make the script in this post work with right click ?

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Thank you for your answer

Found that :

http://www.autoitscript.com/forum/index.php?showtopic=88637&st=0&p=636878&hl=Image%20Resizer&fromsearch=1&#entry636878

But this doesn't explain to me how to make the script in this post work with right click ?

You will need to either add context handlers for the file types or compile your script and add a shortcut into SendTo Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

You will need to either add context handlers for the file types or compile your script and add a shortcut into SendTo

Come to AutoIt thinking it was easier than vbs scripting, here is my vbs script doing the job very well :

Set wshShell=WScript.CreateObject("wscript.shell")
Set args = Wscript.Arguments

' // wscript.echo "count= " & args.count & VBCRLF & "args[0]= " & args(0)

rc=WshShell.Run("C:\WINDOWS\system32\mspaint.exe " & chr(34) & args(0)& chr(34))
Wscript.Sleep 1500
wshShell.SendKeys "^s"
WshShell.SendKeys ("%{F4}")
Set wshShell=nothing

WScript.Quit(0)

I was looking around for better solution.

What you tell me to do is very complicated to me, i don't have the knowledge to do that, sorry.

Anyway thank you for your advice.

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
Sign in to follow this  
Followers 0