jimg Posted Monday at 06:56 PM Posted Monday at 06:56 PM Is there a way to get longer strings via InputBox? I assume I can resort to a GUI, but it changes a six line program into something much more complicated (and more likely to trigger anti-virus warnings).
water Posted Monday at 08:05 PM Posted Monday at 08:05 PM Not that I know of. InputBox is limited to 254 characters. Creating a GUI is quite easy. Open the help file (F1 in SciTE) and search for GUICtrlCreateInput. At the end of the page you will find a simple example that can be stripped down to just a few lines of code. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Nine Posted yesterday at 01:32 PM Posted yesterday at 01:32 PM (edited) It is possible but I am not sure you will like the solution. It requires a bit of additional code, however it's not that complicated. Anyway, here you go : expandcollapse popup; From Nine #include <GUIConstants.au3> #include <WinAPI.au3> #include <String.au3> Opt("MustDeclareVars", True) Global Const $HCBT_DESTROYWND = 4 Global $sAnswer, $hHook Example() Func Example() Local $hGUI = GUICreate("Test") Local $idBut = GUICtrlCreateButton("Show", 100, 100, 80, 20) Local $hStub = DllCallbackRegister(WH_CBT, "lresult", "int;wparam;lparam") $hHook = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hStub), 0, _WinAPI_GetCurrentThreadId()) GUISetState() While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBut ClipPut(_StringRepeat("1234567890", 30)) ; for testing longer than 254 characters InputBox("InputBox", "Enter value", "", "", 500, 140) If Not @error Then ConsoleWrite(StringLen($sAnswer) & "/" & $sAnswer & @CRLF) EndIf EndSwitch WEnd _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub) EndFunc ;==>Example Func WH_CBT($nCode, $wParam, $lParam) Local $hWnd = HWnd($wParam) If $nCode = $HCBT_DESTROYWND And _WinAPI_GetClassName($hWnd) = "#32770" And ControlGetHandle($hWnd, "", "Edit1") Then $sAnswer = ControlGetText($hWnd, "", "Edit1") EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>WH_CBT Edited yesterday at 01:52 PM by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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