Recently Browsing 0 members
No registered users viewing this page.
A process of mine opens a HML file, modifies it and then saves, closes it.
I then need to run an.exe that opens this file right after this.. However, nothing that I find on this forum works that supposedly tests to see if the fie is still open, ready to be used by another process.
Right now, I just Sleep(2000) .
I would like something cleaner than this.
This function, for example, returns False when nothing has it opened or if I open the file with notepad or any other editor.
I am running on a win7 laptop, if that has any bearing.
$File="C:\Utilities\test\report.hr5" MsgBox(0,"", _FileInUse($File)) Exit Func _FileInUse($sFilePath) ; By Nessie. Modified by guinness. Local Const $hFileOpen = _WinAPI_CreateFile($sFilePath, $CREATE_ALWAYS, $FILE_SHARE_WRITE) If $hFileOpen Then _WinAPI_CloseHandle($hFileOpen) Return False EndIf Local $fReturn = False If _WinAPI_GetLastError() = 32 Then $fReturn = True Return $fReturn EndFunc
I am Using Windows 10 on 32 Operating System
On typing I use Alt + Shift so to enable toggle typing in English and Greek
i find it impossible to achieve the same function using autoit3 using Send ("!+")
I would appreciate any help in solving this problem
Also I would appreciate any help in switching to Greek language using the CAPS Key
I am trying to automate a software called "LabelImg" (https://pypi.org/project/labelImg/).
My autoit-script is started once I selected a folder with images within LabelImg. Pressing the button "Next Image" or pressing the shortcut "d" (https://github.com/tzutalin/labelImg#Hotkeys) jumps to the next image in the selected folder. This shall happen once per second.
#include <Misc.au3> #include <MsgBoxConstants.au3> #include <AutoItConstants.au3> Opt("WinTitleMatchMode", 1) Local $hDLL = DllOpen("user32.dll") While 1 If _IsPressed("1B", $hDLL) Then ExitLoop Else Local $temp = WinActivate("labelImg") ConsoleWrite($temp & @CRLF) If WinActivate("labelImg") Then ConsoleWrite("All Set!" & @CRLF) EndIf ;Send("d") Local $temp = MouseClick($MOUSE_CLICK_RIGHT, 50, 200) If $temp <> 1 Then MsgBox(1, "$temp", $temp) ExitLoop EndIf Sleep(1000) EndIf WEnd DllClose($hDLL) So the Send ("d")-command and the MouseClick are alternative methods to jump to the next image. Both fail.
Both ConsoleWrite's deliver proper feedback (I continiously get the handle and "All set" ).
Could you tell me what I'm doing wrong?
$input = $CmdLine $bytes = 1000000 ; 1000000 for 1 MB, 1000 for 1 KB $size = FileGetSize($input) $file = fileopen($input, 16) $max = ceiling($size / $bytes) for $i = 1 to $max $data = fileread($file, $bytes) $output = $input & '_' & $i & 'of' & $max filewrite($output, $data) next ^file split
file path for a 20MB "video.mp4" is input, it will be output as "video.mp4_1of20", "video.mp4_2of20", etc. change $bytes to affect the split files size, this example made them 1MB (10^6 bytes)
$input = $CmdLine $name = stringtrimright($input, 1 + stringlen($input) - stringinstr($input, '_', 0, -1)) $split = stringsplit($input, 'of', 3) $max = $split[ubound($split) - 1] for $i = 1 to $max $in = $name & '_' & $i & 'of' & $max $file = fileopen($in, 16) $data = fileread($file) fileclose($file) filedelete($in) filewrite($name, $data) next ^ file join
file path for any of the "video.mp4_Xof20" segments is input. the "video.mp4_Xof20" segments are read and written to "video.mp4" and then deleted, leaving the newly joined "video.mp4" in the end
i made this today because i had a big file that i couldn't really open. i split it into 1000 chunks to make processing and stuff easier. i've also used it to split files to just under 25MB segments so i can attach and mail big files over gmail which is silly but it worked
I like and have been using TeraCopy, a third party program, for many years. Mostly it is a great program, but it does have some issues. On Windows XP for instance, Thumbs.db files could often hold up a copy or move process until the user manually responded to the error prompt. Some other issues I discuss below.
PLEASE NOTE - I am not related to or affiliated in any way with the 3rd party TeraCopy program developers.
ALSO NOTE - I myself have only tested TeraCopy Cure at this point, on Windows 7 (32 bit), and only with the free version of TeraCopy 2.27.
This program, TeraCopy Cure, is related to another one of my TeraCopy assistant programs, TeraCopy Timer, but aims at being simpler and quicker to use ... if lacking its more advanced features.
TeraCopy Cure is a frontend for TeraCopy and sets out to make up for its flaws and limitations.
One of those flaws is queuing order, and the limitation relates to a same destination issue.
You would think that queue order would be the same as add order, but that is not the case, and if you are doing a mix of COPY and MOVE then the COPY process could easily fail. It could fail with some source items, even if the COPY process has already started before the same source MOVE process begins ... especially if the destination folder is on the source drive ... only the currently copying file is locked to that process.
If you drag and drop another source for a same destination as an existing or impending COPY or MOVE process, then usually TeraCopy nicely adds it for you to that existing job. However, you might wish to avoid that, or it might occur during the testing phase of that active process, and then not be properly processed etc. But you are not given a choice and it just gets added.
HOW TO USE
See the right-click menu of the 'Batch List' (lowest field) and the right-click menu of the Tree field, for some useful options.
(1) If desired, enable 'Auto Start'. NOTE - Even if enabled, this can be bypassed.
(2) Set the destination folder, either by browsing on the tree or by dragging a folder to the Destination input field or label. Right-clicking on a folder in Explorer will also work, if enabled. The destination folder path will also show in the Tree if that right-click option is enabled.
(3) Then drag & drop source file or folder onto one of three five areas - Folder (Drive) Tree field, or COPY or MOVE buttons ... this now also includes the source input and label.
NOTE - If the Folder (Drive) Tree field is used, then you will additionally need to click either the COPY or MOVE button, to have that job added to the Batch List ... but this avoids 'Auto Start' if it is enabled. Drag & dropping to the buttons instead, saves on clicking, but starts the first job etc immediately if 'Auto Start' is enabled.
(4) If needed and ready, click the START button to run the first job and those that follow.
More information is included in program and in the NOTES etc sections below.
WARNING - Depending on the amount of content on your destination drive, and folder level depth, and the speed of your PC, display of the full path in the Folder (Drive) Tree can take a while to show ... if you have that (right-click) option enabled ... it isn't by default. I found this feature quite tricky to get right, and I'm still not 100% sure it is now full-proof.
TeraCopy Cure v1.5.zip (source is included)
TeraCopy Cure v1.6.zip (source is included)