-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsample_usage.bat
More file actions
126 lines (108 loc) · 4.18 KB
/
sample_usage.bat
File metadata and controls
126 lines (108 loc) · 4.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
@echo off
REM ============================================================================
REM Windows Dialog Handler - Sample Batch File
REM This batch file demonstrates how to use WindowsDialogHandler.exe
REM Author: Meij Racpan
REM ============================================================================
REM Set the path to the executable
SET HANDLER_EXE=.\x64\Release\WindowsDialogHandler.exe
REM Check if the executable exists
IF NOT EXIST "%HANDLER_EXE%" (
echo Error: WindowsDialogHandler.exe not found at %HANDLER_EXE%
echo Please build the project in Release mode for x64 platform.
pause
exit /b 1
)
echo.
echo ============================================================================
echo Windows Dialog Handler - Sample Usage
echo ============================================================================
echo.
REM Example 1: Using Default Values
echo Example 1: Using Default Values
echo Command: %HANDLER_EXE%
echo This will use the built-in default values:
echo - Window Class: #32770
echo - Window Title: Choose File to Upload
echo - Edit Box ID: 0x47C
echo - File Path: C:\WorkingFolder\Programming\IE2\ForUpload.txt
echo - Delay: 500ms
echo.
REM Uncomment to run:
REM "%HANDLER_EXE%"
echo.
echo ============================================================================
echo.
REM Example 2: Custom Window Class and Title
echo Example 2: Custom Dialog Parameters
echo Command: %HANDLER_EXE% #32770 "Choose File to Upload" 1148 "C:\Users\Username\Desktop\file.txt" 1000
echo This specifies custom parameters for a specific dialog window.
echo.
REM Uncomment to run:
REM "%HANDLER_EXE%" #32770 "Choose File to Upload" 1148 "C:\Users\Username\Desktop\file.txt" 1000
echo.
echo ============================================================================
echo.
REM Example 3: File Upload Dialog with Custom Delay
echo Example 3: Using Variables for File Path
setlocal enabledelayedexpansion
set "FILE_TO_UPLOAD=C:\MyDocuments\report.pdf"
set "DIALOG_TITLE=Upload File"
set "DIALOG_CLASS=#32770"
set "CONTROL_ID=1148"
set "DELAY_MS=500"
echo Command: %HANDLER_EXE% "%DIALOG_CLASS%" "%DIALOG_TITLE%" %CONTROL_ID% "%FILE_TO_UPLOAD%" %DELAY_MS%
echo.
REM Uncomment to run:
REM "%HANDLER_EXE%" "%DIALOG_CLASS%" "%DIALOG_TITLE%" %CONTROL_ID% "%FILE_TO_UPLOAD%" %DELAY_MS%
echo.
echo ============================================================================
echo.
REM Example 4: Batch Processing Multiple Files
echo Example 4: Processing Multiple Files (Advanced)
echo This example shows how to process multiple files:
echo.
setlocal enabledelayedexpansion
set "DIALOG_CLASS=#32770"
set "DIALOG_TITLE=Choose File to Upload"
set "CONTROL_ID=1148"
set "DELAY_MS=1000"
REM Uncomment and modify the file list to process multiple files
REM for %%F in (C:\Files\*.txt) do (
REM echo Processing: %%F
REM "%HANDLER_EXE%" "%DIALOG_CLASS%" "%DIALOG_TITLE%" %CONTROL_ID% "%%F" %DELAY_MS%
REM timeout /t 2
REM )
echo Example commented out to prevent accidental execution.
echo Uncomment the FOR loop in the batch file to enable batch processing.
echo.
echo ============================================================================
echo.
REM Example 5: Error Handling
echo Example 5: With Error Handling
echo.
echo set "FILE_PATH=C:\Path\To\File.txt"
echo if exist "!FILE_PATH!" (
echo "%HANDLER_EXE%" #32770 "Choose File to Upload" 1148 "!FILE_PATH!" 500
echo if errorlevel 0 (
echo echo File upload initiated successfully
echo ) else (
echo echo Error occurred during file upload
echo )
echo ) else (
echo echo Error: File not found at !FILE_PATH!
echo )
echo.
echo ============================================================================
echo.
echo NOTES:
echo - Replace file paths with your actual file paths
echo - Dialog title and window class must match exactly
echo - Control ID can be in decimal (e.g., 1148) or hexadecimal (e.g., 0x47C)
echo - Delay is in milliseconds (1000ms = 1 second)
echo - The dialog window must be already open when the command runs
echo - Administrator privileges may be required for some operations
echo.
echo For more information, see README.md
echo ============================================================================
pause