5 posts in this topic
Hello AutoIT masters
I am gonna start writing a fun little script to resize X amount of images with the Horizontal/Vertical aspects to 15/15 instead of the standard 100/100
I need to be able to do this with X amount of images and after changing the dimensions I need to save all the images in a path.
so to keep things simple.
1: File open prompt
2: Choose X amount of images
3: Automatically choose 15/15 for all images
4: Save in path chosen by user
5: Might be more to come.
6: the faster the better!
I am gonna start this project tomorrow, any help/references is highly appreciated!
Thanks in advance and Wish me luck
#### I Hit a bump on the road ###
I successfully manage to do what I want to do and I successfully manage to rewrite names but 3 of the image names won't rename?
So lets say I have 10 images that all get resized, then 7 of them gets renamed but not the last three, confuses me quite a bit?
Thanks in advance!
Func renameall() local $path = @ScriptDir & "\" & $nymappe & "\" local $ret Local $hSearch = FileFindFirstFile($path & "*.jpg") $i = 1 While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop if FileMove($path & $sFileName, $path & String("NewName" & +$i) & ".jpg", 0) = 1 then ConsoleWrite($path & $sFileName & ' renamed to ' & $path & String("NewName" & +$i) & ".jpg" & @LF) Else ConsoleWrite('File rename failed for file = ' & $path & $sFileName & @LF) endif $i += 1 WEnd FileClose($hSearch) EndFunc Full script:
#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=car.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GDIPlus.au3> #include <File.au3> #include <Array.au3> #include <ColorConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ProgressConstants.au3> ; Declare array Dim $Images ; Gets all JPG files in the current directory (@ScriptDir). Local $search = FileFindFirstFile("*.jpg") ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No JPG files could be found.") Exit EndIf ; Resize array While 1 If IsArray($Images) Then Local $Bound = UBound($Images) ReDim $Images[$Bound+1] EndIf $Images[$Bound] = FileFindNextFile($search) If @error Then ExitLoop WEnd ; Close the search handle FileClose($search) ; Create directory "resized" if not there yet $nymappe = InputBox("Mappe / Bil Navn", "Mappe / Bil Navn") If NOT FileExists(@ScriptDir & "\" & $nymappe & "\") Then DirCreate(@ScriptDir & "\" & $nymappe & "\") EndIf ; Loop for JPGs - gets dimension of JPG and calls resize function to resize to 50% width and 50% height For $i = 1 to Ubound($Images)-1 If $Images[$i] <> "" AND FileExists(@ScriptDir & "\" & $Images[$i]) Then Local $ImagePath = @ScriptDir & "\" & $Images[$i] _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($ImagePath) Local $ImageWidth = _GDIPlus_ImageGetWidth($hImage) Local $ImageHeight = _GDIPlus_ImageGetHeight($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() ;MsgBox(0,"DEBUG", $ImageWidth & " x " & $ImageHeight) Local $NewImageWidth = ($ImageWidth / 100) * 15 Local $NewImageHeight = ($ImageHeight / 100) * 15 ;MsgBox(0,"DEBUG: " & $i,$Images[$i]) _ImageResize(@ScriptDir & "\" & $Images[$i], @ScriptDir & "\" & $nymappe & "\" & $Images[$i], $NewImageWidth, $NewImageHeight) EndIf Next ; Resize function Func _ImageResize($sInImage, $sOutImage, $iW, $iH) Local $hWnd, $hDC, $hBMP, $hImage1, $hImage2, $hGraphic, $CLSID, $i = 0 ;OutFile path, to use later on. Local $sOP = StringLeft($sOutImage, StringInStr($sOutImage, "\", 0, -1)) ;OutFile name, to use later on. Local $sOF = StringMid($sOutImage, StringInStr($sOutImage, "\", 0, -1) + 1) ;OutFile extension , to use for the encoder later on. Local $Ext = StringUpper(StringMid($sOutImage, StringInStr($sOutImage, ".", 0, -1) + 1)) ; Win api to create blank bitmap at the width and height to put your resized image on. $hWnd = _WinAPI_GetDesktopWindow() $hDC = _WinAPI_GetDC($hWnd) $hBMP = _WinAPI_CreateCompatibleBitmap($hDC, $iW, $iH) _WinAPI_ReleaseDC($hWnd, $hDC) ;Start GDIPlus _GDIPlus_Startup() ;Get the handle of blank bitmap you created above as an image $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP) ;Load the image you want to resize. $hImage2 = _GDIPlus_ImageLoadFromFile($sInImage) ;Get the graphic context of the blank bitmap $hGraphic = _GDIPlus_ImageGetGraphicsContext ($hImage1) ;Draw the loaded image onto the blank bitmap at the size you want _GDIPLus_GraphicsDrawImageRect($hGraphic, $hImage2, 0, 0, $iW, $iH) ;Get the encoder of to save the resized image in the format you want. $CLSID = _GDIPlus_EncodersGetCLSID($Ext) ;Generate a number for out file that doesn't already exist, so you don't overwrite an existing image. Do $i += 1 Until (Not FileExists($sOP & $i & "_" & $sOF)) ;Prefix the number to the begining of the output filename $sOutImage = $sOP & $i & "_" & $sOF ;Save the new resized image. _GDIPlus_ImageSaveToFileEx($hImage1, $sOutImage, $CLSID) ;Clean up and shutdown GDIPlus. _GDIPlus_ImageDispose($hImage1) _GDIPlus_ImageDispose($hImage2) _GDIPlus_GraphicsDispose ($hGraphic) _WinAPI_DeleteObject($hBMP) _GDIPlus_Shutdown() Call("renameall") EndFunc Func renameall() local $path = @ScriptDir & "\" & $nymappe & "\" local $ret Local $hSearch = FileFindFirstFile($path & "*.jpg") $i = 1 While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop if FileMove($path & $sFileName, $path & String("NewName" & +$i) & ".jpg", 0) = 1 then ConsoleWrite($path & $sFileName & ' renamed to ' & $path & String("NewName" & +$i) & ".jpg" & @LF) Else ConsoleWrite('File rename failed for file = ' & $path & $sFileName & @LF) endif $i += 1 WEnd FileClose($hSearch) EndFunc
Hello, I decided to start a new project of a web browser. I saw someone already did a good job but I figured out a TAB MANAGEMENT System
The latest AutoIt Web Browser,
The search section in autoit forums offered me the answer from my question: CAN YOU MAKE A WEB BROWSER IN AUTOIT?
So, I started up a new source, trying to improve from the old but the good, Gecko Web Browser.
But, here's my question: Can someone who knows that can improve the current version of my web browser, enter my team and work together at the project?
Here's the website of the project: Armand IcyBlue Official Website
Here are some screenshots: Screenshots of Armand IcyBlue's development going along
Here's of course, the download page: Download Page of Armand IcyBlue
This web browser contains:
Any help would be gratefully accepted.
P.S.: Can't offer the web browser autoit code source for preventing stealing. Icons and images have been took from GECKO WEB BROWSER SOURCE.
New Release: 18.104.22.168 (beta 2) 17/02/2012
Minor bug fix, see change log
+: Add/Ajout, -: Remove/Retrait, *:Modified/Modifié, !: Corrected/Corrigé === Version: 22.214.171.124 == First public version === Version: 126.96.36.199 == +: First launch configuration - Search for AutoIt path - Set file associations - Select language according to the system - Ask for SciTE window adaptation +: It is now possible to deactivate the SciTE window adaptation +: Search functionality +: When a file is not found in the Projects/Workspaces history, it is deleted from the list *: File are now opened using SciTE Director Extension (smoother and faster) *: When minimizing SPM while SciTE is minimized, SciTE is not maximized *: File extension .lng is no longer displayed in language selection *: When opening files from Explorer, the are all opened in the current runing SPM instance *: Current working directory is now always set as the last activated project !: When item is renamed, if the name is the same as the old one, so the project is not set as Modified !: A file is now correctly renamed (change icon, correctly sorted) === Version: 188.8.131.52 === !: ShellNew file Template.auproj !: New files where created in bad folder
New Release: 1.2 (beta 2)
Here is the new version! lot of enhancements and bug corrections.
As always, all suggestions and comments are very welcome!
(See the link below for download)
PS: 1.2 because iv got a testing version (1.1) that i compiled just for me.
As a user of Programmer's Notepad, that i adapted to AutoIt, i really like it's Project Manager
But, SciTE has got really usefull thing/tools related to AutoIt that i couldn't adapt to Programmer's Notepad.
I suggested the devs to make a project manager to SciTE but no...
So i made it my self, and here it is!
Scite Project Manager is intended for who (like me!) like to divide his scripts into many script, each one related to a particulare aspect of the program you are making (Ex: a program can be splited into files like: gui.au3, database.au3, display.au3, events.au3 .....)
A program can also have other files, like documentation, to do list, bugs list, change log....
With SPM (Scite Project Manager) all the paths to all those files is stored in a single file .auproj (AutoIt Project), and you have to do, is open this file, and you have all your project's in a simple TreeView, and you can rearange them in folders if you want!!!
For example, SPM is made like this (many files, each one for a particular aspect of the program)
It's simple and beautiful, fully functionnal and well integrated with SciTE.
It's in beta test, and i'm searching for bugs and suggestions.
Hope you like it, and why not, if it become enought stable, it will be added to the official SciTE4AutoIt!!!
Hello, iam interested in buying a autoit script.
Please pm me your references.
Iam a serious buyer, so i need a serious programmer.