rizwanahmed24 Posted April 20, 2009 Posted April 20, 2009 Hi i am writing a script that 1. takes time stamp 2. open folder 3. select all files, perform right click 4. select 'encrypt' from context menu (third party tool is used here. the tool encrypts all files one by one) 5. take time stamp after step 4 is finished. the problem is, i am unable to identify when step 4 ends. since the encryption process is from third party, and performs encryption of files one by one, how can i make my script wait for it, and make it know when the encryption ends?
rizwanahmed24 Posted April 20, 2009 Author Posted April 20, 2009 sorry for the title, it doesnt fully reflect the content.
Moderators Melba23 Posted April 20, 2009 Moderators Posted April 20, 2009 rizwanahmed24,If the 3rd party tool exits when it is finished, you could look to see if its process has terminated by looping ProcessExists. If it restarts for each new file, you might have to make sure it remains closed for a longer period before deeming the whole list to have been completed.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
rizwanahmed24 Posted April 21, 2009 Author Posted April 21, 2009 (edited) Can U share ur code which is written yet by U? i dont think the code will help here. but here it is anyways, this is my first code in autoit, therefore..... yes u understand wht.. expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> ;decalartoin Global $margin_label_left = 10 Global $margin_button_left = 100 Global $height = 20 Global $button_width = 50 GUICreate("Test-Secure File", 300, 150) ;create count label and text box $btn = GUICtrlCreateLabel("Count", $margin_label_left, 10) Global $tbx_Count = GUICtrlCreateInput("5", $margin_button_left, 10, 70, $height); ;create size label and text box GUICtrlCreateLabel("Size in KBs", $margin_label_left, 32) Global $tbx_Size = GUICtrlCreateInput("5", $margin_button_left, 32, 70, $height); ;perform and exit buttons $btn_Perform = GUICtrlCreateButton("Perform", $margin_button_left, 100,$button_width, $height); $btn_Exit = GUICtrlCreateButton("Exit", $margin_button_left + $button_width + 20, 100, $button_width, $height) GUISetState(@SW_SHOW) while 1 $GUImsg = GUIGetMsg() Select case $GUImsg = $btn_Perform Local $p = GenerateRandomFiles(GUICtrlRead($tbx_Count), GUICtrlRead($tbx_Size)) $timeStart = TimerInit() SecureFiles($p) if ProcessExists("SecureFile") Then Else MsgBox(0, "securing ended", "securing ended") EndIf $time = TimerDiff($timeStart) $timeEnd = $time / 1000 ;MsgBox(0, "time taken in seconds", $time) case $GUImsg = $btn_Exit ExitLoop EndSelect WEnd Func SecureFiles($dirPath) ShellExecuteWait($dirPath) send("{Down}") Send("^a") send("+{F10}") send("{Down 2}") send ("{enter}") EndFunc #cs u dont need to look at it, its a small program to generate random files #ce Func GenerateRandomFiles( $count, $size) $fileGeneratorProcess = ShellExecute("FileGeneratorTool.exe") WinWaitActive("File Generator Tool") Local $dirPath = @ScriptDir & "\test data" DirCreate($dirPath) Send($dirPath) Send("{TAB 2}") Send($count) Send("{TAB}") Send($size) Send("{TAB}") Send("{ENTER}") ProcessWait("FileGeneratorTool.exe") Send("!{F4}") return $dirPath EndFunc Edited April 21, 2009 by rizwanahmed24
rizwanahmed24 Posted April 21, 2009 Author Posted April 21, 2009 rizwanahmed24,If the 3rd party tool exits when it is finished, you could look to see if its process has terminated by looping ProcessExists. If it restarts for each new file, you might have to make sure it remains closed for a longer period before deeming the whole list to have been completed.M23thanks Melba23. 'ProcessExists' did the trick
torels Posted April 21, 2009 Posted April 21, 2009 just to give a different solution for further reference you could make an MD5 hash of the files while they aren't encrypted and then make hashes every 5 seconds or so and check until all the hashes are different or only the hash of the last file is different from the hash once it's encrypted Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now