Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/24/2021 in all areas

  1. I use the post url. In the example as you see in the action html page source. I'll check the site that you post above and let you know. Saludos
    1 point
  2. Hello I think using https://www.newocr.com/ it will be a little complex because it use probably some cookies etc it also upload the image first then process it. maybe using the API it would be better/easier. here is a sample using other web site. You don't need to use same code than vbs You're using AutoIt so please take advantage of its own functions. Global $oErrorHandler = ObjEvent("AutoIt.Error", _ErrFunc) _TestUploadIE() Func _TestUploadIE() FileDelete("FileExample.txt") FileWrite("FileExample.txt", "Hello World-" & Random(1000000, 9999999, 1)) Local $oIE = ObjCreate("InternetExplorer.Application") ; You can uncoment Next line To see form results $oIE.Visible = True Local $sBOUNDARY = "---------------------------24464570528145" Local $sUrl = "https://cgi-lib.berkeley.edu/ex/fup.cgi" Local $sPostHeaders = "Content-Type: multipart/form-data; boundary=" & $sBOUNDARY & @CRLF Local $sPost = "--" & $sBOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="upfile"; filename="CompatibilityView.txt"' & @CRLF & _ 'Content-Type: text/plain' & @CRLF & @CRLF & _ BinaryToString(FileRead("FileExample.txt")) & @CRLF & _ "--" & $sBOUNDARY & @CRLF & _ 'Content-Disposition: form-data; name="note"' & @CRLF & @CRLF & @CRLF & _ "--" & $sBOUNDARY & "--" & @CRLF Local $bPost = StringToBinary($sPost) ConsoleWrite($sPost) $oIE.Navigate($sUrl, Null, Null, $bPost, $sPostHeaders) While $oIE.Busy Wait(1, "Upload To " & $sUrl) WEnd EndFunc ;==>_TestUploadIE Func Wait($i_Seconds, $s_Message) MsgBox(0, '', $s_Message, $i_Seconds) EndFunc ;==>Wait ; User's COM error function. Will be called if COM error occurs Func _ErrFunc(ByRef $oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Saludos
    1 point
  3. KindEbook Wishlist has been updated to v8.3. See Post #2 on Page 1 for download. MAJOR SPEED IMPROVEMENT (v8.3) Significant speed increase for loading the List in sort mode, along with a small correction to code changes made in v8.2. Clicking on HIGH column header now does nothing, while clicking the LAST column header just jumps and selects last list entry (what HIGH previously did because there was no LAST column at the time that feature was added, and unknowingly it had been overlooked until now). Clicking on START column header jumps to first entry on the list. I also added some timed dialogs to give better clarity about column sorting.
    1 point
  4. KindEbook Wishlist has been updated to v8.2. See Post #2 on Page 1 for download. MAJOR SPEED IMPROVEMENT (v8.2) Significant speed increase for loading the List in non sort mode.
    1 point
  5. Ok ... next "try": New Beta is available which is a revert of the previous version and this time simply uses the original filename in the RUN function.
    1 point
  6. The problem that you encountered is found in the internal AutoIt code that converts proprietary AutoIt variables to standard COM data types that can be transferred to an object method. The vast majority of data types are handled correctly. However, there are still several examples of data that are not handled correctly and therefore give rise to data type mismatch errors as in your example. There are a few examples of solving the problems. These examples are all based on the VTable interface of the object and the ObjCreateInterface() function. Ie. your object must be dual interface. And the techniques are far from trivial and based on a manual handling of variants and safearrays. But because your object works in VBScript code, there is a much simpler solution, which is demonstrated in this post here. In the example in the post a data type mismatch error means that an object method cannot be executed in AutoIt code. Instead, data is passed to a VBScript as global variables through a ROT object. Then the object method can be executed successfully in the VBScript code. If necessary, method output data can be passed back to the AutoIt code through the same ROT object.
    1 point
  7. BugFix

    Abbrev Management in SciTE

    Hi, you know that SciTE includes a lot of abbreviations. I've made an management tool for abbrevs. All existing abbrevs will shown in an Listview, left side the abbrev, right side the abbrev code. What can you do: - Add own abbrevs - Edit abbrevs - Delete abbrevs - Click on an Item shows an GUI with AutoIt-code of this abbrev - Insert an new abbrev in the Input. By hitting button 'Add' you got an GUI to copy in or write AutoIt-code for this abbrev. The abbrev will saved by closing GUI. All your changes will integrated in abbrev-file: "@UserProfileDir & '\abbrev.properties'" and will saved for restore in "@UserProfileDir & '\abbrev.properties.my'". The keywords will integrated in keyword-file: "..\SciTE\properties\au3.keywords.abbreviations.properties" and will saved for restore in "@UserProfileDir & '\au3.keywords.my'". If you update or reinstall SciTE all your own abbrevs and changes are lost. Because that, i save all abbrevs and keywords in own files. So you can reset all with menu entry "Restore". Note: To take effect new or edited abbrevs you need an restart of SciTE. Edit: Thanks Jos for the reload function. Also there was an bug by Edit and Delete, now fixed. #include-once #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <ListViewConstants.au3> #include <StaticConstants.au3> #include <StructureConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <GUIListView.au3> #include <GuiEdit.au3> Opt("GUIOnEventMode", 1) Global $ScitePath = RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\SciTE.exe", "") Global $KeyWordPath = StringReplace($ScitePath, "SciTE.exe", "properties\au3.keywords.abbreviations.properties") Global $MyKeyWordPath = @UserProfileDir & '\au3.keywords.my' Global $Abbr_Path = @UserProfileDir & '\abbrev.properties' Global $MyAbbrevPath = @UserProfileDir & '\abbrev.properties.my' If Not FileExists($MyAbbrevPath) Then Local $fh = FileOpen($MyAbbrevPath, 1) FileWriteLine($fh, '; >> My own abbrevs <<') FileClose($fh) EndIf Global $Start_STR = '#; -- Gui Variables --', $start = False, $edit = False Global $Last_STR = '#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#-#' Global $txt, $aTitel[2] = ['Code for new abbrev', 'Code edit'] Global $aLabel[2] = [ _ 'Please insert code for your abbrev. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _ 'To set cursor position use pipe: | . Code will saved by closing window.', _ 'Edit here your code. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _ 'To set cursor position use pipe: | . Code will saved by closing window.'] Global $aAbbrev _FileReadToArray($Abbr_Path, $aAbbrev) $Form1 = GUICreate("Abbrev Management [" & $Abbr_Path & ']', 800, 620, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $mnu = GUICtrlCreateMenu('Restore') $mnu_restore = GUICtrlCreateMenuItem('Restore own Abbrevs', $mnu) GUICtrlSetOnEvent(-1, '_Restore') $iSearch = GUICtrlCreateInput('', 15, 10, 90, 20) $bSearch = GUICtrlCreateButton('Search', 125, 10, 150, 20, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, '_Search') $bCreate = GUICtrlCreateButton('Add', 295, 10, 150, 20) GUICtrlSetOnEvent(-1, '_Create') $bEdit = GUICtrlCreateButton('Edit', 465, 10, 150, 20) GUICtrlSetOnEvent(-1, '_Edit') $bDelete = GUICtrlCreateButton('Delete', 635, 10, 150, 20) GUICtrlSetOnEvent(-1, '_Delete') $ListView1 = GUICtrlCreateListView("Abbrev|Code", 15, 40, 770, 545, BitOR($LVS_SHOWSELALWAYS, $LVS_SINGLESEL, $WS_HSCROLL, $WS_VSCROLL)) GUICtrlSetOnEvent(-1, "ListView1Click") GUICtrlSetBkColor(-1, 0xFF9E00) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) GUICtrlSendMsg(-1, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_ONECLICKACTIVATE, $LVS_EX_ONECLICKACTIVATE) _GUICtrlListView_SetColumnWidth(-1, 0, 90) _GUICtrlListView_SetColumnWidth(-1, 1, $LVSCW_AUTOSIZE_USEHEADER) _LV_Fill() $Form2 = GUICreate('Abbrev - Code', 700, 400, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Form2Close") $Edit1 = GUICtrlCreateEdit('', 10, 10, 680, 380, BitOR($GUI_SS_DEFAULT_EDIT, $ES_READONLY)) GUICtrlSetBkColor(-1, 0x98FB98) $Form3 = GUICreate('Abbrev - New Code', 700, 400, -1, -1) GUISetOnEvent($GUI_EVENT_CLOSE, "Form3Close") $Label1 = GUICtrlCreateLabel('Please insert code for your abbrev. Indentation with <TAB> (inside edit with STRG+TAB).' & @LF & _ 'To set cursor position use pipe: | . Code will saved by closing window.' _ , 10, 5, 680, 30, $SS_SUNKEN + $SS_CENTER) GUICtrlSetBkColor(-1, 0x98FB98) $Edit2 = GUICtrlCreateEdit('', 10, 40, 680, 350, BitOR($WS_HSCROLL, $WS_VSCROLL, $ES_MULTILINE, $ES_WANTRETURN)) GUICtrlSetBkColor(-1, 0x98FB98) GUISetState(@SW_SHOW, $Form1) GUIRegisterMsg($WM_NOTIFY, "MY_WM_COMMAND") While 1 Sleep(100) WEnd Func Form1Close() Exit EndFunc ;==>Form1Close Func Form2Close() GUISetState(@SW_HIDE, $Form2) GUICtrlSetData($Edit1, '') EndFunc ;==>Form2Close Func Form3Close() GUISetState(@SW_HIDE, $Form3) If $edit Then _WriteEditedAbbrev() Else _WriteNewAbbrev() EndIf EndFunc ;==>Form3Close Func _Search() $txt = GUICtrlRead($iSearch) If $txt = '' Then Return Local $indx = _LV_FindInSubItem($ListView1, $txt, 0) If $indx = -1 Then MsgBox(0, 'Search Abbrev', 'Abbrev: "' & $txt & '" not exists.') Else _GUICtrlListView_EnsureVisible($ListView1, $indx) _GUICtrlListView_SetItemSelected($ListView1, $indx) EndIf EndFunc ;==>_Search Func _Create() $txt = GUICtrlRead($iSearch) If $txt = '' Then Return MsgBox(16, 'Error', 'No abbrev inserted.') Local $indx = _LV_FindInSubItem($ListView1, $txt, 0) If $indx > -1 Then Return MsgBox(16, 'Error', 'Abbrev always exists.') $edit = False WinSetTitle($Form3, '', $aTitel[0]) GUICtrlSetData($Label1, $aLabel[0]) GUISetState(@SW_SHOW, $Form3) EndFunc ;==>_Create Func _Edit() $txt = GUICtrlRead($iSearch) If $txt = '' Then Return MsgBox(16, 'Error', 'No abbrev selected.') $edit = True WinSetTitle($Form3, '', $aTitel[1]) GUICtrlSetData($Label1, $aLabel[1]) GUICtrlSetData($Edit2, _Abbrev2Code(_GUICtrlListView_GetItemText($ListView1, _LV_FindInSubItem($ListView1, $txt, 0), 1))) GUISetState(@SW_SHOW, $Form3) EndFunc ;==>_Edit Func _Restore() Local $aMyAbbrev, $split_a, $split_f _FileReadToArray($MyAbbrevPath, $aMyAbbrev) For $i = 2 To UBound($aMyAbbrev) - 1 $start = False For $j = 1 To UBound($aAbbrev) - 1 If $aAbbrev[$j] = $Start_STR Then $start = True If (Not $start) Or (StringLeft($aAbbrev[$j], 1) = '#') Or ($aAbbrev[$j] = '') Then ContinueLoop $split_a = _SplitOnce($aAbbrev[$j]) If @error Then ContinueLoop $split_f = _SplitOnce($aMyAbbrev[$i]) If @error Then ContinueLoop If $split_a[0] = $split_f[0] Then ConsoleWrite($split_f[0] & @CRLF) $aAbbrev[$j] = $split_f[0] & '=' & $split_f[1] WinSetTitle($Form1, '', 'Restore Abbrev: ' & $split_f[0]) $aMyAbbrev[$i] = -1 ExitLoop EndIf Next Next For $i = 2 To UBound($aMyAbbrev) - 1 If $aMyAbbrev[$i] = -1 Then ContinueLoop $split_f = _SplitOnce($aMyAbbrev[$i]) WinSetTitle($Form1, '', 'Restore Abbrev: ' & $split_f[0]) Sleep(20) ReDim $aAbbrev[UBound($aAbbrev) + 1] $aAbbrev[UBound($aAbbrev) - 1] = $aMyAbbrev[$i] For $j = UBound($aAbbrev) - 1 To 1 Step -1 If $aAbbrev[$j] = $Last_STR Then ExitLoop Next _ArraySwap($aAbbrev[UBound($aAbbrev) - 1], $aAbbrev[$j]) Next FileMove($Abbr_Path, $Abbr_Path & '.BAK', 1) _FileWriteFromArray($Abbr_Path, $aAbbrev, 1) If FileExists($MyKeyWordPath) Then Local $aMyKeyWord _FileReadToArray($MyKeyWordPath, $aMyKeyWord) For $i = 1 To UBound($aMyKeyWord) - 1 WinSetTitle($Form1, '', 'Restore Keyword: ' & $aMyKeyWord[$i]) Sleep(20) _KeyWordSet($aMyKeyWord[$i], 1) Next EndIf _FileReadToArray($Abbr_Path, $aAbbrev) WinSetTitle($Form1, '', 'Restore') MsgBox(64, 'Restore', 'Restore finished.', 1.5) WinSetTitle($Form1, '', "Abbrev Management [" & $Abbr_Path & ']') _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1)) _LV_Fill() EndFunc ;==>_Restore Func _LV_FindInSubItem($hWnd, $2Find, $SubIndex) Local $out = -1 For $i = 0 To _GUICtrlListView_GetItemCount($hWnd) - 1 If _GUICtrlListView_GetItemText($hWnd, $i, $SubIndex) = $2Find Then $out = $i Next Return $out EndFunc ;==>_LV_FindInSubItem Func ListView1Click() Local $indx = _GUICtrlListView_GetHotItem($ListView1) GUICtrlSetData($iSearch, _GUICtrlListView_GetItemText($ListView1, $indx, 0)) GUICtrlSetData($Edit1, _Abbrev2Code(_GUICtrlListView_GetItemText($ListView1, $indx, 1))) GUISetState(@SW_SHOW, $Form2) EndFunc ;==>ListView1Click Func _LV_Fill() GUISetState(@SW_LOCK, $Form1) Local $k = 0 $start = False For $i = 1 To UBound($aAbbrev) - 1 If $aAbbrev[$i] = $Start_STR Then $start = True If (Not $start) Or (StringLeft($aAbbrev[$i], 1) = '#') Or ($aAbbrev[$i] = '') Then ContinueLoop $var = _SplitOnce($aAbbrev[$i]) If @error Then ContinueLoop GUICtrlCreateListViewItem('|', $ListView1) GUICtrlSetBkColor(-1, 0xFFF278) _GUICtrlListView_SetItemText($ListView1, $k, $var[0], 0) _GUICtrlListView_SetItemText($ListView1, $k, $var[1], 1) $k += 1 Next GUISetState(@SW_UNLOCK, $Form1) EndFunc ;==>_LV_Fill Func _SplitOnce($STRING, $DELIM = '=') If Not StringInStr($STRING, $DELIM) Then Return SetError(1, 0, 1) Local $out[2] Local $len = StringLen($STRING) Local $pos = StringInStr($STRING, $DELIM, 1, 1) $out[0] = StringLeft($STRING, $pos - 1) $out[1] = StringRight($STRING, $len - $pos) Return $out EndFunc ;==>_SplitOnce Func _Abbrev2Code($ABBREV) Local $out = '' $var = StringSplit($ABBREV, '\n', 1) For $i = 1 To UBound($var) - 1 If StringInStr($var[$i], '\t', 1) Then $var[$i] = StringReplace($var[$i], '\t', @TAB) If $i = UBound($var) - 1 Then $out &= $var[$i] Else $out &= $var[$i] & @CRLF EndIf Next Return $out EndFunc ;==>_Abbrev2Code Func _Code2Abbrev() Local $out = '', $count = _GUICtrlEdit_GetLineCount($Edit2), $line If @error Then Return SetError(1) For $i = 0 To $count - 1 $line = _GUICtrlEdit_GetLine($Edit2, $i) If StringInStr($line, @TAB, 1) Then $line = StringReplace($line, @TAB, '\t') If $i = $count - 1 Then $out &= $line Else $out &= $line & '\n' EndIf Next Return $out EndFunc ;==>_Code2Abbrev Func _WriteNewAbbrev() If GUICtrlRead($Edit2) = '' Then Return Local $abbr = _Code2Abbrev() Local $fh = FileOpen($MyAbbrevPath, 1) FileWriteLine($fh, $txt & '=' & $abbr) FileClose($fh) ReDim $aAbbrev[UBound($aAbbrev) + 1] $aAbbrev[UBound($aAbbrev) - 1] = $txt & '=' & $abbr For $i = UBound($aAbbrev) - 1 To 1 Step -1 If $aAbbrev[$i] = $Last_STR Then ExitLoop Next _ArraySwap($aAbbrev[UBound($aAbbrev) - 1], $aAbbrev[$i]) FileMove($Abbr_Path, $Abbr_Path & '.BAK', 1) _FileWriteFromArray($Abbr_Path, $aAbbrev, 1) _KeyWordSet($txt) $fh = FileOpen($MyKeyWordPath, 1) FileWrite($fh, $txt & @CRLF) FileClose($fh) _FileReadToArray($Abbr_Path, $aAbbrev) _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1)) GUICtrlSetData($Edit2, '') $start = False $k = 0 _LV_Fill() Local $idx = _LV_FindInSubItem($ListView1, $txt, 0) _GUICtrlListView_EnsureVisible($ListView1, $idx) _GUICtrlListView_SetItemSelected($ListView1, $idx) Reload_Config() EndFunc ;==>_WriteNewAbbrev Func _WriteEditedAbbrev() If GUICtrlRead($Edit2) = '' Then Return Local $abbr = _Code2Abbrev() Local $fh = FileOpen($MyAbbrevPath, 0) Local $content = FileRead($fh) FileClose($fh) If Not StringRegExp($content, '\r\n' & $txt & '=') Then $fh = FileOpen($MyAbbrevPath, 1) FileWriteLine($fh, $txt & '=' & $abbr) FileClose($fh) Else $fh = FileOpen($MyAbbrevPath, 0) Local $line, $row = 2 While 1 $line = FileReadLine($fh, $row) If @error = -1 Then ExitLoop $split_f = _SplitOnce($line) If $txt = $split_f[0] Then ExitLoop $row += 1 WEnd FileClose($fh) _FileWriteToLine($MyAbbrevPath, $row, $txt & '=' & $abbr, 1) EndIf Local $line = _GetLine() - 1 Local $idx = _LV_FindInSubItem($ListView1, $txt, 0) $aAbbrev[$line] = $txt & '=' & $abbr _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1)) GUICtrlSetData($Edit2, '') $start = False $k = 0 _LV_Fill() _FileWriteToLine($Abbr_Path, $line, $txt & '=' & $abbr, 1) _GUICtrlListView_EnsureVisible($ListView1, $idx) _GUICtrlListView_SetItemSelected($ListView1, $idx) Reload_Config() EndFunc ;==>_WriteEditedAbbrev Func _Delete() $txt = GUICtrlRead($iSearch) If MsgBox(262180, 'Attention', 'You are sure that ' & @LF & '>> ' & $txt & ' <<' & @LF & ' should delete?') = 7 Then Return Local $idx = _GetLine() - 1 $aAbbrev[$idx] = '' _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($ListView1)) GUICtrlSetData($iSearch, '') $start = False $k = 0 _LV_Fill() _FileWriteToLine($Abbr_Path, $idx, '', 1) $fh = FileOpen($MyAbbrevPath, 0) Local $line, $row = 2 While 1 $line = FileReadLine($fh, $row) If @error = -1 Then ExitLoop $split_f = _SplitOnce($line) If @error Then ContinueLoop If $txt = $split_f[0] Then ExitLoop $row += 1 WEnd FileClose($fh) _FileWriteToLine($MyAbbrevPath, $row, '', 1) Local $keys = FileRead($KeyWordPath) $keys = StringReplace($keys, $txt & ' ', '', 1, 1) Local $fh = FileOpen($KeyWordPath, 2) FileWrite($fh, $keys) FileClose($fh) $keys = FileRead($MyKeyWordPath) $keys = StringReplace($keys, $txt & @CRLF, '', 1, 1) $fh = FileOpen($MyKeyWordPath, 2) FileWrite($fh, $keys) FileClose($fh) Reload_Config() EndFunc ;==>_Delete Func _GetLine() Local $var For $i = 1 To UBound($aAbbrev) - 1 $var = _SplitOnce($aAbbrev[$i], '=') If @error Then ContinueLoop If $var[0] = $txt Then Return $i + 1 Next EndFunc ;==>_GetLine Func _KeyWordSet($KEYWORD, $CHECK = 0) Local $txtZeile, $len If $CHECK Then Local $fh = FileOpen($KeyWordPath, 0) Local $read = FileRead($fh) FileClose($fh) If StringInStr($read, $KEYWORD & ' ', 1) Then Return EndIf $zeile = _FileCountLines($KeyWordPath) $txtZeile = FileReadLine($KeyWordPath, $zeile) $len = StringLen($txtZeile) + 4 If $len + StringLen($KEYWORD) > 100 Then _FileWriteToLine($KeyWordPath, $zeile, $txtZeile & "\" & @CRLF, 1) _FileWriteToLine($KeyWordPath, $zeile + 1, @TAB & $KEYWORD & " ", 1) Else _FileWriteToLine($KeyWordPath, $zeile, $txtZeile & $KEYWORD & " ", 1) EndIf EndFunc ;==>_KeyWordSet Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) Switch $wParam Case $ListView1 Local $tagNMHDR = DllStructCreate("int;int;int", $lParam) If @error Then Return $GUI_RUNDEFMSG If DllStructGetData($tagNMHDR, 3) = $NM_CLICK Then ListView1Click() EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>MY_WM_COMMAND ; Thanks to Jos for following functions: Func Reload_Config() ;Send SciTE Director my GUI handle so it will report info back from SciTE SendSciTE_Command("reloadproperties:") EndFunc ;==>Reload_Config ; Send command to SciTE Func SendSciTE_Command($sCmd, $Wait_For_Return_Info = 0) Local $WM_COPYDATA = 74 Local $WM_GETTEXT = 0x000D Local $WM_GETTEXTLENGTH = 0x000E224 Local Const $SCI_GETLINE = 2153 Local $Scite_hwnd = WinGetHandle("DirectorExtension") ; Get SciTE DIrector Handle Local $My_Hwnd = GUICreate("AutoIt3-SciTE interface") ; Create GUI to receive SciTE info Local $My_Dec_Hwnd = Dec(StringTrimLeft($My_Hwnd, 2)) ; Convert my Gui Handle to decimal $sCmd = ":" & $My_Dec_Hwnd & ":" & $sCmd ; Add dec my gui handle to commandline to tell SciTE where to send the return info ConsoleWrite('SciTE Command --> ' & $sCmd & @LF) Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']') DllStructSetData($CmdStruct, 1, $sCmd) Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr') DllStructSetData($COPYDATA, 1, 1) DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1) DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct)) DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $Scite_hwnd, _ 'Int', $WM_COPYDATA, 'HWnd', $My_Hwnd, _ 'Ptr', DllStructGetPtr($COPYDATA)) GUIDelete($My_Hwnd) EndFunc ;==>SendSciTE_CommandAbbrevManagement.au3
    1 point
×
×
  • Create New...