Jump to content

Help with a farily simply program


Recommended Posts

Alright, I've just written this program but for some reason it's not working. It will open a window and you can input how many pictures you want sized down and what percentage (used to keep down the size of digital pictures). It's able to copy the percentage so that it can put it in when it gets to paint. But for some reason it won't do the function the right number of times. It always does it 3 times when I have it the way it is now.

#include <GUIConstants.au3>
GUICreate("How many photos?", 220, 150, -1, -1)
GuiCtrlCreateLabel("Insert how many pictures you want resized" & @CRLF & "and then insert the percentage of the new" & @CRLF & "picture compared to the old picture.", 5, 5, 220, 40 )
$numpic = GuiCtrlCreateInput("", 20, 60, 25, 20)
GuiCtrlCreateLabel("Pictures", 50, 63)
GuiCtrlCreateInput("50", 20, 90, 25, 20)
GuiCtrlCreateLabel("% scaled", 50, 94)
GuiCtrlCreateButton("Exit", 10, 120, 60, 20)
GuiCtrlCreateButton("Back", 80, 120, 60, 20)
$ok= GuiCtrlCreateButton("OK", 150, 120, 60, 20)
GUISetState(@SW_SHOW)
$count = 1
While 1
    $msg = GUIGetMsg()
        Select
    Case $msg = $GUI_EVENT_CLOSE
        Exit
        Endselect
    If $msg = $ok then
        OpenMyPics()
        Do
        ResizePicture()
        $count = $count + 1
             Until $count = $numpic 
;this is the part that doesn't work. I tried "Until $count > $numpic but that made the function run 4 times and ;didn't make much of a difference.
      Exit
    Endif
Wend        

Func OpenMyPics()
    Send("{tab 2}")
    Send("^C")
    Send("#r")
    Sleep(500)
    Send("C:\Documents and Settings\test\My Documents\My Pictures\Resizing") 
;obviously if you want to try using it you have to create you own folder
    Send("{enter}")
    Send("{down}")
    Send("{up}")
    EndFunc

Func ResizePicture()
    Send("{enter}") 
    Sleep(1200) ; open top left picture
    Send("{alt}")
    Send("!is") 
    Sleep(500)
    Send("^V")
    Send("{tab}")
    Send("^V")
    Send("{enter}")
    Sleep(500)
    Send("!fs") 
    Send("{enter}")
    Sleep(100)
    Send("!fx") 
    Sleep(500)
    Send("{down}")
Endfunc

Any help or explanation of why this isn't working would be greatly appreciated.

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

Please check out [ code] [ /code] without the space. Also, you must read the input. Please check out GUICtrlRead in the help file.

I believe you want:

$Numpics2 = GUICtrlRead($Numpics)

You will need to do this for the percent as well.

Also you are missing an EndFunc at the end of your script. Please search of Tidy as well as SciTe and run Tidy when you post code, it will help us read it.

http://www.autoitscript.com/autoit3/scite/downloads.php

AutoIt Smith

Edited by AutoIt Smith
Link to comment
Share on other sites

Please check out without the space. Also, you must read the input. Please check out GUICtrlRead in the help file.

You will need to do this for the percent as well.

Also you are missing an EndFunc at the end of your script. Please search of Tidy as well as SciTe and run Tidy when you post code, it will help us read it.

I have one more question though... you say I should do the same thing for the "percent" part too. I tried sending something like "GUICtrlRead($Percent)" where it would input the scale percent in paint.exe but it didn't work. Is there a way you can have the computer type out the value of a variable?

Thanks for the help with helping get to know how to post and all that... I'll check into SciTe and Tidy

Edited by Piano_Man
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...