Jump to content

sbrady

Active Members
  • Posts

    228
  • Joined

  • Last visited

Recent Profile Visitors

181 profile views

sbrady's Achievements

Polymath

Polymath (5/7)

1

Reputation

  1. based on the attached image, what code would I use to delete the selected file. Nothing I try works. FileDelete "R:BUMP.mxf" FileDelete "1030_ViewFolderBUMP.mxf" FileDelete "apacefeatures2BUMP.mxf"
  2. is it possible to click on a file and get the file name so I can write code to rename the selected file.
  3. here is some code I have used but I am looking for an easier way. ; START SHAWN's CODE____________________________ ; repeat with the selected items For $File_Name = 1 To $aSelection $result = StringInStr($File_Name, "mix",0,1) If $result > 0 Then $filename2 = StringInStr ( $File_Name, "\" , 0 , -1) ; (last "\" is 47 chars in from righy) $the_folder_path = StringLeft ( $File_Name, $filename2 ) ; C:\Documents and Settings\sebrad\Desktop\shawn\ $file_path_len = StringLen($File_Name) ; 79 total characters $char_in_file_name = $file_path_len - $filename2 ;31 char in file name only $orig_file_name = StringRight ($File_Name, $char_in_file_name) ;AR123 Smith, Bob v1 FULL MIX.txt $new_file_name = StringRegExpReplace($orig_file_name, "(?i)(.*)(\sv.*)(\s.*\sMIX)(\.txt)", "$1$3$2$4") ;AR123 Smith, Bob FULL MIX v1.txt FileCopy ( $File_Name, ($the_folder_path & $new_file_name), 1 ) ; 1 = with overwright FileDelete ( $the_folder_path & $orig_file_name) EndIf
  4. would _ClipPutFile work, could I rename the file when I paste it back? I'm digging for anything that I think might work.
  5. can someone help me figure out how to rename selected files. Look at the before and after naming conventions. Can anyone help get me started in the right direction. before AR123 Smith, Bob Eye Surgery v1 Full mix.wav AR123 Smith, Bob Eye Surgery v1 SOT mix.wav AR123 Smith, Bob Eye Surgery v1 M&E mix.wav after AR123 Smith, Bob Eye Surgery Full mix v1.wav AR123 Smith, Bob Eye Surgery SOT mix v1.wav AR123 Smith, Bob Eye Surgery M&E mix v1.wav
  6. I just want to close all open folder windows I see on the desktop. I dont need to close any apps. Below is the code from the Help file. If I have 6 folders open, how do I close just those 6 open folders or windows. thanks for any help. #include <MsgBoxConstants.au3> Example() Func Example() ; Retrieve a list of window handles. Local $aList = WinList() ; Loop through the array displaying only visable windows with a title. For $i = 1 To $aList[0][0] If $aList[$i][0] <> "" And BitAND(WinGetState($aList[$i][1]), 2) Then MsgBox($MB_SYSTEMMODAL, "", "Title: " & $aList[$i][0] & @CRLF & "Handle: " & $aList[$i][1]) EndIf Next EndFunc ;==>Example
  7. below is code I have pulled from another script that involves a GUI. I thought I pulled everything I needed. But it is not working. It changes a file name as such. before AR123 Smith Bob v1 Full Mix.wav after AR123 Smith Bob Full Mix v1.wav is there some kind soul out there can help me figure out what is wrong. Thank you so much. see code below. #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <Array.au3> #include <File.au3> Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ComErrFunc") $aWinList=WinList("[REGEXPCLASS:^(Explore|Cabinet)WClass$]") For $i = 1 To $aWinList[0][0] ; Get base folder and selections $aSelection = _ExplorerWinGetSelectedItems($aWinList[$i][1]) ; Display as strings ConsoleWrite("Explorer Window: " & $aSelection[1] & " Selection(s)" & @CRLF) For $j = 2 To $aSelection[0] + 1 ConsoleWrite(@TAB & $aSelection[$j] & @CRLF) Next ; START SHAWN's CODE____________________________ ; repeat with the selected items For $File_Name = 1 To $aSelection $result = StringInStr($File_Name, "mix",0,1) If $result > 0 Then $filename2 = StringInStr ( $File_Name, "\" , 0 , -1) ; (last "\" is 47 chars in from righy) $the_folder_path = StringLeft ( $File_Name, $filename2 ) ; C:\Documents and Settings\sebrad\Desktop\shawn\ $file_path_len = StringLen($File_Name) ; 79 total characters $char_in_file_name = $file_path_len - $filename2 ;31 char in file name only $orig_file_name = StringRight ($File_Name, $char_in_file_name) ;AR123 Smith, Bob v1 FULL MIX.txt $new_file_name = StringRegExpReplace($orig_file_name, "(?i)(.*)(\sv.*)(\s.*\sMIX)(\.wav)", "$1$3$2$4") ;AR123 Smith, Bob FULL MIX v1.txt FileCopy ( $File_Name, ($the_folder_path & $new_file_name), 1 ) ; 1 = with overwright FileDelete ( $the_folder_path & $orig_file_name) EndIf Next ; END SHAWN's CODE________________________ Next ; end button 7 ; ========================================================================================================================== ; Func _ObjectSHFolderViewFromWin($hWnd) ; ; Returns an 'ShellFolderView' Object for the given Window handle ; ; Author: Ascend4nt, based on code by KaFu, klaus.s ; ========================================================================================================================== Func _ObjectSHFolderViewFromWin($hWnd) If Not IsHWnd($hWnd) Then Return SetError(1,0,0) Local $oShell,$oShellWindows,$oIEObject,$oSHFolderView ; Shell Object $oShell=ObjCreate("Shell.Application") If Not IsObj($oShell) Then Return SetError(2,0,0) ; Get a 'ShellWindows Collection' object $oShellWindows = $oShell.Windows() If Not IsObj($oShellWindows) Then Return SetError(3,0,0) ; Iterate through the collection - each of type 'InternetExplorer' Object For $oIEObject In $oShellWindows If $oIEObject.HWND = $hWnd Then ; InternetExplorer->Document = ShellFolderView object $oSHFolderView=$oIEObject.Document If IsObj($oSHFolderView) Then Return $oSHFolderView Return SetError(4,0,0) EndIf Next Return SetError(-1,0,0) EndFunc ; ========================================================================================================================== ; Func _ExplorerWinGetSelectedItems($hWnd) ; ; ; Author: klaus.s, KaFu, Ascend4nt (consolidation & cleanup, Path name simplification) ; ========================================================================================================================== Func _ExplorerWinGetSelectedItems($hWnd) If Not IsHWnd($hWnd) Then Return SetError(1,0,'') Local $oSHFolderView Local $iSelectedItems,$iCounter=2,$aSelectedItems[2] = [0, ""] $oSHFolderView=_ObjectSHFolderViewFromWin($hWnd) If @error Then Return SetError(@error,0,'') ; SelectedItems = FolderItems Collection object->Count $iSelectedItems = $oSHFolderView.SelectedItems.Count Dim $aSelectedItems[$iSelectedItems+2] ; 2 extra -> 1 for count [0], 1 for Folder Path [1] $aSelectedItems[0]=$iSelectedItems ; ShellFolderView->Folder->Self as 'FolderItem'->Path $aSelectedItems[1]=$oSHFolderView.Folder.Self.Path ; ShellFolderView->SelectedItems = FolderItems Collection object $oSelectedFolderItems = $oSHFolderView.SelectedItems #cs ; For ALL items in an Explorer window (not just the selected ones): $oSelectedFolderItems = $oSHFolderView.Folder.Items ReDim $aSelectedItems[$oSelectedFolderItems.Count+2] #ce For $oFolderItem In $oSelectedFolderItems $aSelectedItems[$iCounter] = $oFolderItem.Path $iCounter += 1 Next Return SetExtended($iCounter-2,$aSelectedItems) EndFunc ;==>_ExplorerWinGetSelectedItems Func _ComErrFunc($oError) ConsoleWrite("COM Error occurred:" & @CRLF & _ "Number: " & @TAB & $oError.number & @CRLF & _ "Windescription:" & @TAB & $oError.windescription & @CRLF & _ "Description is: " & @TAB & $oError.description & @CRLF & _ "Source is: " & @TAB & $oError.source & @CRLF & _ "Helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ "Helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ "Lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ "Scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ "Retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF) EndFunc ;==>_ComErrFunc
  8. is there a way to extract the code from an exe file.
  9. here is the code I am using to open 7 folders and place and size the windows when they open. Its not working. #include<Array.au3> #include <File.au3> ; month $the_month = @MON ;12 ;the day $the_day = @mday ;18 ;the year $the_year = @YEAR ;2012 $the_year2 = StringTrimLeft ($the_year,2);12 local $todays_date = $the_month & "-" & $the_day & "-" & $the_year2 ;12-18-12 ;------------------------------------ $promo_name_NPR = $todays_date & " Promos NPR" ;the NPR folder $open_exports_folder = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\" & $todays_date & " OPEN EXPORTS" $open_ndp_folder = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\" & $todays_date & " NDP EXPORTS" $open_bumper_Folder = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\" & $todays_date & " BUMPERS EXPORTS" ;------------------------------------- local $todays_date = $the_month & "-" & $the_day & "-" & $the_year2 ;12-18-12 ;MsgBox (4096, "The Date", $todays_date);12-18-12 ;DirCreate("E:\Nuendo_Projects_DAW3\700 Club Promos\" & $promo_name_NPR) ; EGR123 Schools v1 NPR $PM_exports = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports" $promo_AM_NPR_Folder = "E:\Nuendo_Projects_DAW3\700 Club Promos\Promo AMs" $1030view = "R:" $the_promos_NPR = "E:\Nuendo_Projects_DAW3\700 Club Promos\" $New_promo_NPR_Folder = "E:\Nuendo_Projects_DAW3\700 Club Promos\" & $promo_name_NPR ;open PM exports ShellExecute($PM_exports ) $thepath1 = ($PM_exports ) $hHandle1 = WinWait("", $thepath1) WinMove($hHandle1, "", 50, 600, 400, 500) ;open promos ShellExecute($the_promos_NPR ) $thepath2 = ($the_promos_NPR ) $hHandle2 = WinWait("", $thepath2) WinMove($hHandle2, "", 650, 600, 400, 500) ;open 1030view ShellExecute($1030view ) $thepath3 = ($1030view ) $hHandle3 = WinWait("", $thepath3) WinMove($hHandle3, "", 1250, 600, 400, 500) ;open AMs folder ShellExecute($promo_AM_NPR_Folder ) $thepath4 = ($promo_AM_NPR_Folder ) $hHandle4 = WinWait("", $thepath4) WinMove($hHandle4, "", 1850, 600, 400, 500) ; List the contents Local $FileList = _FileListToArray("\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\") For $i = 1 To $FileList[0] ; As explained the [0] element holds the count If StringInStr($FileList[$i], $todays_date & " OPEN EXPORTS") Then ; Does the name hold the string "OPEN EXPORTS"? ;open OPEN EXPORTS ShellExecute($open_exports_folder) $thepath5 = ($open_exports_folder) $hHandle5 = WinWait("", $thepath5) WinMove($hHandle5, "", 50, 80, 600, 500) ElseIf StringInStr($FileList[$i], $todays_date & " NDP EXPORTS") Then ;open NDP EXPORTS ShellExecute($open_ndp_folder) $thepath6 = ($open_ndp_folder) $hHandle6 = WinWait("", $thepath6) WinMove($hHandle6, "", 690, 80, 600, 500) ElseIf StringInStr($FileList[$i], $todays_date & " BUMPERS EXPORTS") Then ;open BUMPERS EXPORTS ShellExecute($open_bumper_Folder) $thepath7 = ($open_bumper_Folder) $hHandle7 = WinWait("", $thepath7) WinMove($hHandle7, "", 1320, 80, 600, 500) EndIf next ;ClipPut ( $todays_date & " Promos" ) ;Open Media Encoder ;ShellExecute("C:\Program Files\Adobe\Adobe Media Encoder CS5.5\Adobe Media Encoder.exe") ;Open FileZilla ;ShellExecute("C:\Program Files (x86)\FileZilla FTP Client\filezilla.exe") ;Open Premiere ;ShellExecute("E:\Docs from C\Premiere Templates\Templates foe AMs.prproj")
  10. I have a need to loop through a folder and open the folders contained within. the master folder is "10.10.44.160Daily 700 Club PromosAudio ExportsPM Exports the folders within are named as such: 03-27-14 OPEN EXPORTS 03-27-14 NDP EXPORTS here is code I used to: 1 get todays date 2. loop through the master folder 3. open and place the 2 folders from above ITS NOT WORKING.......any ideas. #include<Array.au3> #include <File.au3> ; month $the_month = @MON ;12 ;the day $the_day = @mday ;18 ;the year $the_year = @YEAR ;2012 $the_year2 = StringTrimLeft ($the_year,2);12 local $todays_date = $the_month & "-" & $the_day & "-" & $the_year2 ;12-18-12 MsgBox (4096, "The Date", $todays_date);12-18-12 ;------------------------------------ $open_exports_folder = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\" & $todays_date & " OPEN EXPORTS" ;------------------------------------- ; List the contents Local $FileList = _FileListToArray("\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports\") For $i = 1 To $FileList[0] ; As explained the [0] element holds the count If StringInStr($FileList[$i], $todays_date & " OPEN EXPORTS") Then ; Does the name hold the string "OPEN EXPORTS"? ;open OPEN EXPORTS ShellExecute($open_exports_folder) $thepath1 = ($open_exports_folder) $hHandle3 = WinWait("", $thepath1) WinMove($hHandle3, "", 50, 600, 400, 500) EndIf next
  11. can anyone tell me how to make an exe file of a script. thank you.
  12. here is the code that used when I started this project over a year ago but nerver finished. ;open daily promo folders #include <File.au3> #include <Array.au3> ; month $the_month = @MON ;12 ;the day $the_day = @mday ;18 ;the year $the_year = @YEAR ;2012 $the_year2 = StringTrimLeft ($the_year,2);12 local $todays_export = $the_month & "-" & $the_day & "-" & $the_year2 ;12-18-12 MsgBox (4096, "The Date", $todays_export);12-18-12 ;============================================================ $promo_list = "\\10.10.44.160\Daily 700 Club Promos\Audio Exports\PM Exports" $all_promos = _FileListToArray($promo_list) Local $todays_promo_list[1] Local $1030ViewFolder_list[1] For $i = 1 To $all_promos[0] ;the [0] element holds the count If StringInStr($all_promos[$i], $todays_export) Then ;NEXTDAY 12-18-12 ;_ArrayAdd($1030ViewFolder_list, $all_promos[$i]) _ArrayAdd($todays_promo_list, $all_promos[$i]) ElseIf StringInStr($all_promos[$i], "OPEN") Then _ArrayAdd($todays_promo_list, $all_promos[$i]) ElseIf StringInStr($all_promos[$i], "NEXTDAY") Then _ArrayAdd($todays_promo_list, $all_promos[$i]) ElseIf StringInStr($all_promos[$i], "NDP") Then _ArrayAdd($todays_promo_list, $all_promos[$i]) ElseIf StringInStr($all_promos[$i], "BUMP") Then _ArrayAdd($todays_promo_list, $all_promos[$i]) ElseIf StringInStr($all_promos[$i], "BMP") Then _ArrayAdd($todays_promo_list, $all_promos[$i]) EndIf Next ;_ArrayDisplay($todays_promo_list, "promos") ;this array has ALL promos MsgBox (4096, "The Date", "hi")
  13. I have a need to open multiple folders. The name changes everyday. Their names each include todays date. So the folder structure would look like this. PM Exports 03-25-14 OPEN Exports 03-25-14 NDP Exports 03-25-14 Bumper Exports I need to cycle through the PM Exports folder and open each folder that has the date in the folders name. I have working code to open and place a window ;open promo AM NPR folder ShellExecute($promo_AM_NPR_Folder ) $thepath2 = ($promo_AM_NPR_Folder ) $hHandle3 = WinWait("", $thepath2) WinMove($hHandle3, "", 500, 600, 400, 500) I have code to get todays date ; month $the_month = @MON ;12 ;the day $the_day = @mday ;18 ;the year $the_year = @YEAR ;2012 $the_year2 = StringTrimLeft ($the_year,2);12 local $todays_export = $the_month & "-" & $the_day & "-" & $the_year2 ;12-18-12 MsgBox (4096, "The Date", $todays_export);12-18-12 can someone help me loop through the PM EXports folder. Thanks.
×
×
  • Create New...