Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/25/2013 in all areas

  1. Jon

    AutoIt v3.3.10.0 Released

    AutoIt v3.3.10.0 has been released. Big thanks to everyone involved in this release, including past and present contributors, beta testers, moderators and MVPs. It really is a massive group effort! There's still a lot to do in future releases, but at least we have got a stable release out there that we can build on There are too many changes and fixes to list here, but some highlights include: 90+ bugs fixes and additions to the main AutoIt executables. 90+ bug fixes and additions to the user defined functions (UDFs). Much improved Unicode support within the regular expression engine for non-English character sets. Extensive AutoItX changes, including an easy to use .NET Assembly interface and a set of PowerShell CmdLets. Download it here. Complete list of changes: History
    1 point
  2. AndreyS, If I were you I would use the latest release instead. M23
    1 point
  3. Saurabh2k26, You could also do it this way. #include <File.au3> Opt("MustDeclareVars", 1) Global $sPathToFiles = "D:\test\" Global $newFileName = 1000 Global $aFilesToRename = "" ;Get file names to rename $aFilesToRename = _FileListToArray($sPathToFiles, "*.jpg", 1) ;Loop through file names to Rename For $i = 1 To $aFilesToRename[0] ;increment new file name by 1 with each pass of loop. 1001.jpg, 1002.jpg etc $newFileName += 1 ;Rename files FileMove($sPathToFiles & $aFilesToRename[$i], $sPathToFiles & String($newFileName) & ".jpg", 0) Next - This version is a little bit more involved but not by much - here is the script with some error checking and user prompting. #include <GUIConstantsEx.au3> #include <File.au3> #include <Array.au3> Opt("MustDeclareVars", 1) Global $sPathToFiles = "D:\test\" Global $newFileName = 1000 Global $aFilesToRename = "" _Main() Func _Main() _GetFileNamesToRename() _ArrayDisplay($aFilesToRename) ;Show me found files _RenameTheFiles() EndFunc ;==> _Main() Func _GetFileNamesToRename() $aFilesToRename = _FileListToArray($sPathToFiles, "*.jpg", 1) ;Check if _FileListToArray() returned an error If $aFilesToRename = 0 Then Select Case @error = 1 Msgbox(48, "Error", "Path not found or invalid." & @CRLF & "Terminating script") Exit Case @error = 2 Msgbox(48, "Error", "Invalid file filter. [$sFilter]." & @CRLF & "Terminating script") Exit Case @error = 3 Msgbox(48, "Error", "Invalid Flag. [$iFlag]" & @CRLF & "Terminating script") Exit Case @error = 4 Msgbox(48, "Error", "No File(s) Found" & @CRLF & "Terminating script") Exit EndSelect EndIf EndFunc ;==> _GetFileNamesToRename() Func _RenameTheFiles() Local $iMsgboxReturn ;Alert user files are about to be renamed / Ask user for confirmation via buttons $iMsgboxReturn = Msgbox(64+1, "Confirm Rename", $aFilesToRename[0] & chr(32) _ & "File(s) in this directory:" & @CRLF & $sPathToFiles & chr(32) _ & @CRLF & "will be renamed.") ;Check confirmation (1 = ok btn, 2 = cancel btn) If $iMsgboxReturn = 2 Then Msgbox(16, "File Rename cancelled", "File Rename canceled." & @CRLF & "Click OK to terminate file rename.") Exit EndIf ;Loop through file names to Rename For $i = 1 To $aFilesToRename[0] ;increment new file name by 1 with each pass of loop $newFileName += 1 ;Rename files FileMove($sPathToFiles & $aFilesToRename[$i], $sPathToFiles & String($newFileName) & ".jpg", 0) ;Alert user files have been renamed If $i = $aFilesToRename[0] Then MsgBox(64, "Files Renamed", $i & chr(32) & "Files have been renamed.") Exit EndIf Next EndFunc ;==> _RenameTheFiles()
    1 point
  4. UEZ

    PNG button image

    Just tested in my WinXP VM and it works, too. I had something in mind that when disposed the bitmap just after sending it to the picture control the image was not shown. I'm not using WinXP anymore for a long time. Otherwise you have to dispose the image when you exit the script -> _WinAPI_DeleteObject($hHBitmap). Br, UEZ
    1 point
  5. This line "Filedelete("thefile on the desktop)" might have something to do with it, seeing as how you delete the file when you run the script, there's nothing there for the script to read from the second time. Unless you're reading from the site and recreating the file, which isn't clear from your lack of posted code.
    1 point
  6. UEZ

    PNG button image

    Use the same technique as shown but disable the background control. #include <Constants.au3> #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> _GDIPlus_Startup() Global Const $hGUI = GUICreate("Test", 300, 200), $STM_SETIMAGE = 0x0172 Global Const $iPic_Bg = GUICtrlCreatePic("", 0, 0, 1024, 768) GUICtrlSetState(-1, $GUI_DISABLE) SendImageToPicControl("c:\Program Files (x86)\AutoIt3\Examples\GUI\msoobe.jpg", $iPic_Bg) Global Const $iPic = GUICtrlCreatePic("", 10, 10, 128, 128) SendImageToPicControl(@ScriptDir & "\StepForwardDisabled.png", $iPic) GUISetState() Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _Exit() Case $iPic MsgBox($MB_APPLMODAL, "Test", "Button was pressed") EndSwitch Until False Func SendImageToPicControl($sImage, $iCtrlID) Local Const $hImage = _GDIPlus_ImageLoadFromFile($sImage) Local Const $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _WinAPI_DeleteObject(GUICtrlSendMsg($iCtrlID, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)) _WinAPI_DeleteObject($hHBitmap) _GDIPlus_ImageDispose($hImage) EndFunc Func _Exit() _GDIPlus_Shutdown() GUIDelete() Exit EndFunc Br, UEZ
    1 point
  7. Building on mikell's example...It might be better to fully qualify the file name and some error checking added... local $path = 'k:\test\mikell\' ; change to your target path local $ret Local $hSearch = FileFindFirstFile($path & "*.jpg") $i = 1 While 1 $sFileName = FileFindNextFile($hSearch) If @error Then ExitLoop if FileMove($path & $sFileName, $path & String(1000+$i) & ".jpg", 0) = 1 then ConsoleWrite($path & $sFileName & ' renamed to ' & $path & String(1000+$i) & ".jpg" & @LF) Else ConsoleWrite('File rename failed for file = ' & $path & $sFileName & @LF) endif $i += 1 WEnd FileClose($hSearch) kylomas
    1 point
  8. I have added the parameter for index to insert an item. Items could also be removed. I will soon add option to scroll by arrow buttons.Added! Check the original code Edit: also added support of ENTER key. Let me know for any bugs or further modifications. Regards Phoenix XL
    1 point
×
×
  • Create New...