1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. BugFix

Beiträge von BugFix

  • SciTE-Interface

    • BugFix
    • 10. März 2013 um 15:16

    Wer gerne mit und an seinem SciTE rumbastelt (so wie ich :D) aber sich nicht mit LUA anfreunden kann, wird vielleicht mit dem integrierten SciTE-Interface besser klar kommen.
    Ich habe mal einige der möglichen Aktionen (Übersicht im Skript) in Einzelfunktionen ausgelagert. Das mächtigste Werkzeug ist dabei die Funktion _MenuCmd(), mit der sich alle SciTE-Menübefehle direkt ansprechen lassen.
    Viel Spaß beim Pimpen ;)

    Edit: Noch ein paar mehr Funktionen hinzugefügt

    NB: Bei den Dateifunktionen (FileOpen, SaveAs) habe ich es integriert, aber bei anderen Stringoperationen kann es natürlich auch auftreten und muß somit beachtet werden -- "\" als Stringbestandteil muß mit einem zusätzlichen "\" maskiert werden.

    SciTE_Interface (v0.2)
    [autoit]


    #Region - TimeStamp
    ; 2013-03-10 23:02:35 v 0.2
    #EndRegion - TimeStamp

    [/autoit] [autoit][/autoit] [autoit]

    #include "SciTE_Constants.au3"

    [/autoit] [autoit][/autoit] [autoit]

    #cs The actions understood by SciTE are:
    askfilename: Return the name of the file being edited.
    askproperty:<key> Return the value of a property.
    close: Close the current file.
    closing: Director is closing - SciTE closes if it was started by the director.
    currentmacro:<string> Set the current macro to name.
    cwd: Change the working directory.
    enumproperties:dyn|local|user|base|embed Enumerate all the properties in the argument set.
    exportashtml:<path> Save the document in HTML format as the indicated file.
    exportasrtf:<path> Save the document in RTF format as the indicated file.
    exportaspdf:<path> Save the document in PDF format as the indicated file.
    exportaslatex:<path> Save the document in LaTeX format as the indicated file.
    exportasxml:<path> Save the document in XML format as the indicated file.
    extender:<command> Call the extension interface with the given command.
    find:<string> Search for a string, select and show it.
    goto:<lineNumber>[,<columnNumber>] Move caret to a particular line and make it visible.
    If there is a column number then select the word at that column number or move the caret there if no word is present.
    identity:<hwndDirector> Sets the director window handle to which SciTE sends messages. The argument is in decimal.
    insert:<value> Display the value in the editor pane replacing the selection.
    loadsession:<path> Load a session as given by the indicated file.
    macrocommand:<command> Execute a macro command. See the SciTE source code for the syntax of the command argument.
    macroenable:<enable> If enable, display menu commands in SciTE for recording and playing macros.
    macrolist:<list> Display a list for the user to choose from.
    menucommand:<cmd> Execute a menu command based on numeric ID.
    open:<path> Open the indicated file.
    output:<value> Display the value in the output pane replacing the selection.
    property:<key>=<value> Set a property to a value.
    quit: Shut down SciTE.
    reloadproperties: Reload properties from files.
    replaceall:<search>\000<replace> Replace all instances of he search string in the document with the replace string.
    saveas:<path> Save the document as the indicated file.
    savesession:<path> Save a session as given by the indicated file.
    #ce

    [/autoit] [autoit][/autoit] [autoit]

    Global $SciTECmd
    GUIRegisterMsg(74, "MY_WM_COPYDATA") ; $WM_COPYDATA = 74

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _GetCurrentFile
    ; Description......: Gibt den Pfad der aktuell im Editor geöffneten Datei zurück
    ; Parameter(s).....: keine
    ; Return Value(s)..: Dateipfad
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _GetCurrentFile()
    SendSciTE_Command("askfilename:", 1)
    Return StringReplace(StringTrimLeft($SciTECmd,StringInStr($SciTECmd, ':', 1, 3)), '\\', '\')
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _GetProperty
    ; Description......: Gibt den Wert für eine Property zurück
    ; Parameter(s).....: Property
    ; Return Value(s)..: Wert der Property
    ; Docu.............: http://www.scintilla.org/SciTEDoc.html od. "SciTE-Hilfe" --> "SciTE Documentation"
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _GetProperty($_sProperty)
    SendSciTE_Command("askproperty:" & $_sProperty, 1)
    Return StringTrimLeft($SciTECmd,StringInStr($SciTECmd, ':', 1, 4))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _CloseCurrentFile
    ; Description......: Schließt die aktuell offene Datei im Editor
    ; Parameter(s).....: keine
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _CloseCurrentFile()
    SendSciTE_Command("close:")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _FindString
    ; Description......: Sucht nach einem übergebenen String und selektiert ihn, wenn
    ; .................: gefunden (erstes Vorkommen)
    ; Parameter(s).....: Suchstring
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _FindString($_sString)
    SendSciTE_Command("find:" & $_sString)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _GoToLineCol
    ; Description......: Setzt den Cursor auf die übergebene Zeilen und (optional)
    ; .................: Spaltenposition. Zeile: 1-basiert, Spalte: 0-basiert
    ; .................: Ist an dieser Position ein Wort, wird es selektiert
    ; Parameter(s).....: Zeile, optional Spalte
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _GoToLineCol($_iLine, $_iCol=-1)
    Local $iCol = ""
    If $_iCol > -1 Then $iCol = "," & $_iCol
    SendSciTE_Command("goto:" & $_iLine & $iCol)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _InsertValue
    ; Description......: Fügt an aktueller Cursorposition od. Selektion den übergebenen
    ; .................: wert ein
    ; Parameter(s).....: Einfügestring
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _InsertValue($_vValue)
    SendSciTE_Command("insert:" & $_vValue)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _MenuCmd
    ; Description......: Führt einen Menübefehl aus
    ; Parameter(s).....: Command-ID
    ; Requirement(s)...: SciTE_Constants.au3
    ; Return Value(s)..: keine
    ; Docu.............: http://www.scintilla.org/CommandValues.html
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _MenuCmd($_CmdID)
    SendSciTE_Command("menucommand:" & $_CmdID)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _FileOpen
    ; Description......: Öffnet eine Datei im Editor
    ; Parameter(s).....: Dateipfad
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _FileOpen($_sPath)
    SendSciTE_Command("open:" & StringReplace($_sPath, '\', '\\'))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _OutputToConsole
    ; Description......: Gibt einen Wert in die Konsole aus
    ; Parameter(s).....: auszugebender Wert, Zeilenumbruch mit "\n", Tab mit "\t"
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _OutputToConsole($_vValue)
    SendSciTE_Command("output:" & $_vValue)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _SetProperty
    ; Description......: Setzt den Wert einer Property
    ; Parameter(s).....: Property und Wert
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _SetProperty($_sProperty, $_sValue)
    SendSciTE_Command("property:" & $_sProperty & "=" & $_sValue)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _ReloadProperties
    ; Description......: Lädt die Properties neu
    ; Parameter(s).....: keine
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _ReloadProperties()
    SendSciTE_Command("reloadproperties:")
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _ReplaceAll
    ; Description......: Ersetzt alle Vorkommen eines Suchbegriffs
    ; Parameter(s).....: Suchwort und Ersetzung
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _ReplaceAll($_sSearch, $_sReplace)
    SendSciTE_Command("replaceall:" & $_sSearch & "\000" & $_sReplace)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _FileSaveAs
    ; Description......: Datei unter angegebenem Pfad speichern
    ; Parameter(s).....: Dateipfad
    ; Return Value(s)..: keine
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _FileSaveAs($_sPath)
    SendSciTE_Command("saveas:" & StringReplace($_sPath, '\', '\\'))
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    ; by Jos
    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
    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_Command

    [/autoit] [autoit][/autoit] [autoit]

    Func MY_WM_COPYDATA($hWnd, $msg, $wParam, $lParam)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr', $lParam)
    Local $SciTECmdLen = DllStructGetData($COPYDATA, 2)
    Local $CmdStruct = DllStructCreate('Char[255]', DllStructGetData($COPYDATA, 3))
    $SciTECmd = StringLeft(DllStructGetData($CmdStruct, 1), $SciTECmdLen)
    EndFunc ;==>MY_WM_COPYDATA

    [/autoit]
    SciTE_Constants.au3
    [autoit]

    #Region - TimeStamp
    ; 2013-03-10 13:39:29
    #EndRegion - TimeStamp

    [/autoit] [autoit][/autoit] [autoit]

    ; == Menu IDs.
    ; == These are located 100 apart. No one will want more than 100 in each menu ;)
    Global Const $IDM_MRUFILE = 1000
    ; ! Global Const $IDM_TOOLS = 1100
    ; ! -start-[ToolsMax]
    Global Const $IDM_TOOLS = 9000
    Global Const $IDM_TOOLSMAX = 9300
    ; ! -end-[ToolsMax]
    Global Const $IDM_BUFFER = 1200
    Global Const $IDM_IMPORT = 1300
    Global Const $IDM_LANGUAGE = 1400

    [/autoit] [autoit][/autoit] [autoit]

    ; == File
    Global Const $IDM_NEW = 101
    Global Const $IDM_OPEN = 102
    Global Const $IDM_OPENSELECTED = 103 ; == Open Selected Filename
    Global Const $IDM_REVERT = 104
    Global Const $IDM_CLOSE = 105
    Global Const $IDM_SAVE = 106
    Global Const $IDM_SAVEAS = 110
    Global Const $IDM_SAVEASHTML = 111
    Global Const $IDM_SAVEASRTF = 112
    Global Const $IDM_SAVEASPDF = 113
    Global Const $IDM_FILER = 114
    Global Const $IDM_SAVEASTEX = 115
    Global Const $IDM_SAVEACOPY = 116
    Global Const $IDM_SAVEASXML = 117
    Global Const $IDM_COPYPATH = 118
    Global Const $IDM_MRU_SEP = 120
    Global Const $IDM_PRINTSETUP = 130 ; == Page Setup
    Global Const $IDM_PRINT = 131
    Global Const $IDM_LOADSESSION = 132
    Global Const $IDM_SAVESESSION = 133
    Global Const $IDM_QUIT = 140
    Global Const $IDM_ENCODING_DEFAULT = 150 ; == Code Page Property
    Global Const $IDM_ENCODING_UCS2BE = 151 ; == UTF-16 Big Endian
    Global Const $IDM_ENCODING_UCS2LE = 152 ; == UTF-16 Little Endian
    Global Const $IDM_ENCODING_UTF8 = 153 ; == UTF-8 with BOM
    Global Const $IDM_ENCODING_UCOOKIE = 154 ; == UTF-8

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $MRU_START = 17
    Global Const $IMPORT_START = 20
    Global Const $TOOLS_START = 3

    [/autoit] [autoit][/autoit] [autoit]

    ; == Edit
    Global Const $IDM_UNDO = 201
    Global Const $IDM_REDO = 202
    Global Const $IDM_CUT = 203
    Global Const $IDM_COPY = 204
    Global Const $IDM_PASTE = 205
    Global Const $IDM_CLEAR = 206 ; == Delete
    Global Const $IDM_SELECTALL = 207
    Global Const $IDM_PASTEANDDOWN = 208
    Global Const $IDM_FIND = 210
    Global Const $IDM_FINDNEXT = 211
    Global Const $IDM_FINDNEXTBACK = 212 ; == Find Previous
    Global Const $IDM_FINDNEXTSEL = 213
    Global Const $IDM_FINDNEXTBACKSEL = 214
    Global Const $IDM_FINDINFILES = 215
    Global Const $IDM_REPLACE = 216
    Global Const $IDM_GOTO = 220
    Global Const $IDM_BOOKMARK_NEXT = 221
    Global Const $IDM_BOOKMARK_TOGGLE = 222
    Global Const $IDM_BOOKMARK_PREV = 223
    Global Const $IDM_BOOKMARK_CLEARALL = 224
    Global Const $IDM_BOOKMARK_NEXT_SELECT = 225
    Global Const $IDM_BOOKMARK_PREV_SELECT = 226
    Global Const $IDM_MATCHBRACE = 230
    Global Const $IDM_SELECTTOBRACE = 231
    Global Const $IDM_SHOWCALLTIP = 232
    Global Const $IDM_COMPLETE = 233
    Global Const $IDM_COMPLETEWORD = 234
    Global Const $IDM_EXPAND = 235 ; == Toggle current fold
    Global Const $IDM_TOGGLE_FOLDALL = 236
    Global Const $IDM_TOGGLE_FOLDRECURSIVE = 237
    Global Const $IDM_EXPAND_ENSURECHILDRENVISIBLE = 238
    Global Const $IDM_UPRCASE = 240 ; == Make Selection Uppercase
    Global Const $IDM_LWRCASE = 241 ; == Make Selection Lowercase
    Global Const $IDM_ABBREV = 242 ; == Expand Abbreviation
    Global Const $IDM_BLOCK_COMMENT = 243 ; == Block Comment or Uncomment
    Global Const $IDM_STREAM_COMMENT = 244
    Global Const $IDM_COPYASRTF = 245
    Global Const $IDM_BOX_COMMENT = 246
    Global Const $IDM_INS_ABBREV = 247 ; == Insert Abbreviation
    Global Const $IDM_JOIN = 248
    Global Const $IDM_SPLIT = 249
    Global Const $IDM_DUPLICATE = 250
    Global Const $IDM_INCSEARCH = 252 ; == Incremental Search
    Global Const $IDM_ENTERSELECTION = 256

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDC_INCFINDTEXT = 253
    Global Const $IDC_INCFINDBTNOK = 254
    Global Const $IDC_EDIT1 = 1000
    Global Const $IDC_STATIC = -1

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_PREVMATCHPPC = 260
    Global Const $IDM_SELECTTOPREVMATCHPPC = 261
    Global Const $IDM_NEXTMATCHPPC = 262
    Global Const $IDM_SELECTTONEXTMATCHPPC = 263

    [/autoit] [autoit][/autoit] [autoit]

    ; == Tools
    Global Const $IDM_COMPILE = 301
    Global Const $IDM_BUILD = 302
    Global Const $IDM_GO = 303
    Global Const $IDM_STOPEXECUTE = 304
    Global Const $IDM_FINISHEDEXECUTE = 305
    Global Const $IDM_NEXTMSG = 306
    Global Const $IDM_PREVMSG = 307

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_MACRO_SEP = 310
    Global Const $IDM_MACRORECORD = 311
    Global Const $IDM_MACROSTOPRECORD = 312
    Global Const $IDM_MACROPLAY = 313
    Global Const $IDM_MACROLIST = 314

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_ACTIVATE = 320

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_SRCWIN = 350
    Global Const $IDM_RUNWIN = 351
    Global Const $IDM_TOOLWIN = 352
    Global Const $IDM_STATUSWIN = 353
    Global Const $IDM_TABWIN = 354

    [/autoit] [autoit][/autoit] [autoit]

    ; == Options
    Global Const $IDM_SPLITVERTICAL = 401
    Global Const $IDM_VIEWSPACE = 402 ; == Whitespace
    Global Const $IDM_VIEWEOL = 403
    Global Const $IDM_VIEWGUIDES = 404 ; == Indentation Guides
    Global Const $IDM_SELMARGIN = 405
    Global Const $IDM_FOLDMARGIN = 406
    Global Const $IDM_LINENUMBERMARGIN = 407
    Global Const $IDM_VIEWTOOLBAR = 408
    Global Const $IDM_TOGGLEOUTPUT = 409
    Global Const $IDM_VIEWTABBAR = 410
    Global Const $IDM_VIEWSTATUSBAR = 411
    Global Const $IDM_TOGGLEPARAMETERS = 412
    Global Const $IDM_OPENFILESHERE = 413
    Global Const $IDM_WRAP = 414
    Global Const $IDM_WRAPOUTPUT = 415
    Global Const $IDM_READONLY = 416

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_CLEAROUTPUT = 420
    Global Const $IDM_SWITCHPANE = 421

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_EOL_CRLF = 430
    Global Const $IDM_EOL_CR = 431
    Global Const $IDM_EOL_LF = 432
    Global Const $IDM_EOL_CONVERT = 433 ; == Convert Line End Characters

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_TABSIZE = 440 ; == Change Indentation Settings

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_MONOFONT = 450

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_OPENLOCALPROPERTIES = 460
    Global Const $IDM_OPENUSERPROPERTIES = 461
    Global Const $IDM_OPENGLOBALPROPERTIES = 462
    Global Const $IDM_OPENABBREVPROPERTIES = 463
    Global Const $IDM_OPENLUAEXTERNALFILE = 464 ; == Open Lua Startup Script
    Global Const $IDM_OPENDIRECTORYPROPERTIES = 465

    [/autoit] [autoit][/autoit] [autoit]

    ; Global Const $IDM_SELECTIONMARGIN = 490
    ; Global Const $IDM_BUFFEREDDRAW = 491
    ; Global Const $IDM_USEPALETTE = 492

    [/autoit] [autoit][/autoit] [autoit]

    ; == Buffers
    Global Const $IDM_PREVFILE = 501
    Global Const $IDM_NEXTFILE = 502
    Global Const $IDM_CLOSEALL = 503
    Global Const $IDM_SAVEALL = 504
    Global Const $IDM_BUFFERSEP = 505
    Global Const $IDM_PREVFILESTACK = 506
    Global Const $IDM_NEXTFILESTACK = 507
    Global Const $IDM_MOVETABRIGHT = 508
    Global Const $IDM_MOVETABLEFT = 509

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDM_WHOLEWORD = 800
    Global Const $IDM_MATCHCASE = 801
    Global Const $IDM_REGEXP = 802
    Global Const $IDM_WRAPAROUND = 803
    Global Const $IDM_UNSLASH = 804
    Global Const $IDM_DIRECTIONUP = 805
    Global Const $IDM_DIRECTIONDOWN = 806

    [/autoit] [autoit][/autoit] [autoit]

    ; == Help
    Global Const $IDM_HELP = 901
    Global Const $IDM_ABOUT = 902
    Global Const $IDM_HELP_SCITE = 903

    [/autoit] [autoit][/autoit] [autoit]

    ; == Windows specific windowing options
    Global Const $IDM_ONTOP = 960 ; == Always On Top
    Global Const $IDM_FULLSCREEN = 961
    Global Const $IDC_TABCLOSE = 962
    Global Const $IDC_SHIFTTAB = 963
    Global Const $IDC_TABDBLCLK = 964 ; == ! -add-[close_on_dbl_clk]

    [/autoit] [autoit][/autoit] [autoit]

    ; == Dialog control IDs
    Global Const $IDGOLINE = 220
    Global Const $IDABOUTSCINTILLA = 221
    Global Const $IDFINDWHAT = 222
    Global Const $IDFILES = 223
    Global Const $IDDIRECTORY = 224
    Global Const $IDCURRLINE = 225
    Global Const $IDLASTLINE = 226
    Global Const $IDEXTEND = 227
    Global Const $IDTABSIZE = 228
    Global Const $IDINDENTSIZE = 229
    Global Const $IDUSETABS = 230

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDREPLACEWITH = 231
    Global Const $IDWHOLEWORD = 232
    Global Const $IDMATCHCASE = 233
    Global Const $IDDIRECTIONUP = 234
    Global Const $IDDIRECTIONDOWN = 235
    Global Const $IDREPLACE = 236
    Global Const $IDREPLACEALL = 237
    Global Const $IDREPLACEINSEL = 238
    Global Const $IDREGEXP = 239
    Global Const $IDWRAP = 240

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDUNSLASH = 241
    Global Const $IDCMD = 242

    [/autoit] [autoit][/autoit] [autoit]

    ; == id for the browse button in the grep dialog
    Global Const $IDBROWSE = 243

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDABBREV = 244

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDREPLACEINBUF = 244
    Global Const $IDMARKALL = 245

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDGOLINECHAR = 246
    Global Const $IDCURRLINECHAR = 247
    Global Const $IDREPLDONE = 248

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDDOTDOT = 249
    Global Const $IDFINDINSTYLE = 250
    Global Const $IDFINDSTYLE = 251
    Global Const $IDCONVERT = 252

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $IDPARAMSTART = 300

    [/autoit] [autoit][/autoit] [autoit]

    ; == Dialog IDs
    Global Const $IDD_FIND = 400
    Global Const $IDD_REPLACE = 401
    Global Const $IDD_BUFFERS = 402
    Global Const $IDD_FIND_ADV = 403
    Global Const $IDD_REPLACE_ADV = 404

    [/autoit] [autoit][/autoit] [autoit]

    ; == Resource IDs
    ; ! Global Const $IDR_CLOSEFILE = 100
    Global Const $IDR_BUTTONS = 100 ; == ! -change-[user.toolbar]
    Global Const $IDC_DRAGDROP = 401
    Global Const $IDBM_WORD = 101
    Global Const $IDBM_CASE = 102
    Global Const $IDBM_REGEX = 103
    Global Const $IDBM_BACKSLASH = 104
    Global Const $IDBM_AROUND = 105
    Global Const $IDBM_UP = 106

    [/autoit]
    SciTE_Interface Bsp.
    [autoit]

    #Region - TimeStamp
    ; 2013-03-10 15:02:07
    #EndRegion - TimeStamp

    [/autoit] [autoit][/autoit] [autoit]

    #include "SciTE_Interface.au3"

    [/autoit] [autoit][/autoit] [autoit]

    ConsoleWrite("SciTE_Interface" & @TAB & "_GetCurrentFile()" & @LF)
    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "GetCurrentFile = " & @LF & _GetCurrentFile() & @LF & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_GetProperty()")
    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_GetProperty('style.au3.33') = " & @LF & _GetProperty("style.au3.33") & @LF & @LF)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    ; == SUCHWORT ==
    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_FindString()" & @LF & "'SUCWORT' oberhalb dieser Befehlszeile wird gesucht und markiert" & @LF & @LF)
    Sleep(2000)
    _FindString("SUCHWORT")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_GoToLineCol()" & @LF & "Cursor wird gesetzt auf Zei.7, Sp.20. Dort ist ein Wort - es wird selektiert." & @LF & @LF)
    Sleep(2000)
    _GoToLineCol(7,20)

    [/autoit] [autoit][/autoit] [autoit]

    ; == ERSETZEN ==
    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_InsertValue()" & @LF & "Cursor wird erst gesetzt auf Zei.28, Sp.10. Das Wort 'ERSETZEN' wird selektiert" & @LF & "und dann das Wort 'EINFÜGEWERT' eingesetzt." & @LF & @LF)
    Sleep(2000)
    _GoToLineCol(28,10)
    _InsertValue("EINFÜGEWERT")

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(2000)
    ConsoleWrite("SciTE_Interface" & @TAB & "_MenuCmd()" & @LF & "Es wird einen Tab nach links gewechselt und nach 1s wieder einen nach rechts." & @LF & @LF)
    Sleep(2000)
    _MenuCmd($IDM_MOVETABLEFT)
    Sleep(1000)
    _MenuCmd($IDM_MOVETABRIGHT)

    [/autoit] [autoit][/autoit] [autoit]

    ; == Zeilenumbrüche lassen sich durch "\n" im String erzeugen (Tab mit "\t"), somit braucht der String nicht gesplittet werden um Makros einzufügen
    _OutputToConsole('! ROT\n> BLAU\n- ORANGE\n< ORANGE\n+ GRÜN\n')

    [/autoit] [autoit][/autoit] [autoit]

    Sleep(2000)
    MsgBox(0, "SciTE_Interface", "_CloseCurrentFile()" & @LF & "Die Datei wird jetzt geschlossen, Änderungen werden vorher gespeichert.")
    _MenuCmd($IDM_SAVE)
    _CloseCurrentFile()

    [/autoit]

    Dateien

    SciTE_Constants.au3 9,33 kB – 438 Downloads SciTE_Interface[0.2].au3 11,02 kB – 404 Downloads SciTE_Interface_Bsp.au3 1,9 kB – 419 Downloads
  • Doppelklick als Event abfragen

    • BugFix
    • 10. März 2013 um 10:36

    So, ich habe den "Zeitfresser" entdeckt. Es ist der Return-Hook in der Mouse-Procedure.
    Je nach System dauert dies unterschiedlich lang. Auf meinem Virtual-XP etwa 0,7 bis 0,8 s, auf Win7 nur 0,001 s.
    Bau mal den Timer, wie folgt ein um zu testen:

    [autoit]


    ;=======================================================
    Global $TEST_Timer
    ;=======================================================

    [/autoit][autoit][/autoit][autoit]

    Func _MouseProc($nCode, $wParam, $lParam)
    If ($nCode < 0) Or ($nCode <> $HC_ACTION) Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    If $wParam = $WM_LBUTTONUP Then __GUI_DoubleClick_MouseUp()
    ;=======================================================
    $TEST_Timer = TimerInit()
    ;=======================================================
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    EndFunc

    [/autoit][autoit][/autoit][autoit]

    Func OnAutoItExit()
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hStub_MouseProc)
    ;=======================================================
    ConsoleWrite(StringFormat("Time to close: %.3fs", TimerDiff($TEST_Timer)/1000) & @LF)
    ;=======================================================
    EndFunc

    [/autoit]
  • Doppelklick als Event abfragen

    • BugFix
    • 9. März 2013 um 23:22

    gem
    Das klingt etwas ungewöhnlich. Beim Beenden werden der Maus-Hook und die Callbackfunktion zurückgesetzt, aber das dauert (zumindest bei mir) nur etwa 20- 50 ms.

  • Doppelklick als Event abfragen

    • BugFix
    • 9. März 2013 um 20:05

    Hi,

    ich habe nach einer Lösung gesucht auch für Controls, die keine Msg bei Doppelklick abgeben (wie z.B. Inputs) dieses Ereignis direkt auswertbar zu machen.
    Natürlich sollte es allgemeingültig sein und nicht mit anderen Messages kollidieren. Entstanden ist diese UDF: "DoubleClick_Event.au3"

    Nach dem Erstellen eines Controls wird mit der Funktion _GUI_DoubleClick_Register($_hGui, $_cCtrl) dieses Control für den Doppelklick registriert und ein Dummy-Control zurückgegeben, das bei Doppelklick auf das registrierte Control aus der UDF heraus "befeuert" wird und per GuiGetMsg() oder GUICtrlSetOnEvent() abgefragt werden kann.
    Es können Controls auf verschiedenen GUI registriert werden.

    DoubleClick_Event.au3 (v0.1)
    [autoit]

    #Region - TimeStamp
    ; 2013-03-09 19:53:02 v 0.1
    #EndRegion - TimeStamp

    [/autoit] [autoit][/autoit] [autoit]

    #include-once
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>
    OnAutoItExitRegister('OnAutoItExit')

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $HC_ACTION = 0
    Global $hStub_MouseProc = DllCallbackRegister("_MouseProc", "long", "int;wparam;lparam")
    Global $hmod = _WinAPI_GetModuleHandle(0)
    Global $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($hStub_MouseProc), $hmod)

    [/autoit] [autoit][/autoit] [autoit]

    Func _MouseProc($nCode, $wParam, $lParam)
    If ($nCode < 0) Or ($nCode <> $HC_ACTION) Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    If $wParam = $WM_LBUTTONUP Then __GUI_DoubleClick_MouseUp()
    Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func OnAutoItExit()
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hStub_MouseProc)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Global $__aDblClkCtrl[1][3] = [[0]] ; [0][0]=Anzahl Ctrl, [[GUI-Hwnd,Control-ID,Dummy-ID]]

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _GUI_DoubleClick_Register
    ; Description......: Registriert ein Control auf einer GUI für Doppelklick-Event
    ; .................: und gibt eine Ctrl-ID zurück die bei Doppelklick befeuert wird.
    ; .................: Abfragbar über GuiGetMsg() und GUICtrlSetOnEvent()
    ; Parameter(s).....: $_hGui GUI-Handle, auf dem das Control sich befindet
    ; .................: $_cCtrl Control für das Doppelklicks abgefragt werden sollen
    ; Requirement(s)...: none
    ; Return Value(s)..: Erfolg: Dummy-Ctrl, das bei Doppelklick ausgelöst wird
    ; .................: Fehler: "0" set @error =1 bereits registriert
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _GUI_DoubleClick_Register($_hGui, $_cCtrl)
    Local $iRegHwnd = 0, $iRegCtrl = 0
    If $__aDblClkCtrl[0][0] > 0 Then
    For $i = 1 To $__aDblClkCtrl[0][0]
    If $__aDblClkCtrl[$i][0] = $_hGui Then $iRegHwnd = 1
    If $__aDblClkCtrl[$i][0] = $_hGui And $__aDblClkCtrl[$i][1] = $_cCtrl Then $iRegCtrl = 1
    Next
    EndIf
    If $iRegHwnd = 1 And $iRegCtrl = 1 Then Return SetError(1,0,0)
    $__aDblClkCtrl[0][0] += 1
    ReDim $__aDblClkCtrl[$__aDblClkCtrl[0][0] +1][3]
    $__aDblClkCtrl[$__aDblClkCtrl[0][0]][0] = $_hGui
    $__aDblClkCtrl[$__aDblClkCtrl[0][0]][1] = $_cCtrl
    Local $hPrevious = GUISwitch($_hGui)
    Local $iID = GUICtrlCreateDummy()
    $__aDblClkCtrl[$__aDblClkCtrl[0][0]][2] = $iID
    GUISwitch($hPrevious)
    Return $iID
    EndFunc ;==>_GUI_DoubleClick_Register

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func __GUI_DoubleClick_MouseUp()
    Local Static $iDblClickSpeed = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "DoubleClickSpeed")
    Local Static $iClickDown = 0, $iTime, $iCtrlSingle
    Local $iClicked = 0
    Local $hWndCurr = WinGetHandle(WinGetTitle("[ACTIVE]"))
    If @error Then Return $iClickDown = 0
    Local $aInfo = GUIGetCursorInfo($hWndCurr)
    If @error Then Return $iClickDown = 0
    For $i = 1 To $__aDblClkCtrl[0][0]
    If $__aDblClkCtrl[$i][0] = $hWndCurr And $__aDblClkCtrl[$i][1] = $aInfo[4] Then
    $iClicked = $i
    ExitLoop
    EndIf
    Next
    If $iClicked = 0 Then Return $iClickDown = 0
    $iClickDown += 1
    If $iClickDown = 1 Then
    $iTime = TimerInit()
    $iCtrlSingle = $aInfo[4]
    Else
    If ($iCtrlSingle <> $aInfo[4]) Or (TimerDiff($iTime) >= $iDblClickSpeed) Then
    $iTime = TimerInit()
    $iCtrlSingle = $aInfo[4]
    Return $iClickDown = 1
    EndIf
    If TimerDiff($iTime) <= $iDblClickSpeed Then _
    DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $__aDblClkCtrl[$iClicked][0], "uint", 273, "wparam", $__aDblClkCtrl[$iClicked][2], "lparam", 0)
    $iClickDown = 0
    EndIf
    EndFunc ;==>__GUI_DoubleClick_MouseUp

    [/autoit]
    Bsp.-Skript
    [autoit]

    #include "DoubleClick_Event.au3"

    [/autoit] [autoit][/autoit] [autoit]

    $Gui1 = GUICreate('Test Doppelklick-Event GUI-1')
    $in1 = GUICtrlCreateInput('', 10, 20, 80, 20)
    $in2 = GUICtrlCreateInput('', 10, 50, 80, 20)
    $in3 = GUICtrlCreateInput('', 10, 80, 80, 20)
    $inDbl1 = _GUI_DoubleClick_Register($Gui1, $in1)
    $inDbl2 = _GUI_DoubleClick_Register($Gui1, $in2)
    $inDbl3 = _GUI_DoubleClick_Register($Gui1, $in3)
    $btChange1 = GUICtrlCreateButton('Zeige GUI_2', 10, 160, 100, 20)

    [/autoit] [autoit][/autoit] [autoit]

    $Gui2 = GUICreate('Test Doppelklick-Event GUI-2')
    $in4 = GUICtrlCreateInput('', 10, 20, 80, 20)
    $in5 = GUICtrlCreateInput('', 10, 50, 80, 20)
    $in6 = GUICtrlCreateInput('', 10, 80, 80, 20)
    $inDbl4 = _GUI_DoubleClick_Register($Gui2, $in4)
    $inDbl5 = _GUI_DoubleClick_Register($Gui2, $in5)
    $inDbl6 = _GUI_DoubleClick_Register($Gui2, $in6)
    $btChange2 = GUICtrlCreateButton('Zeige GUI_1', 10, 160, 100, 20)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState(@SW_SHOW, $Gui1)

    [/autoit] [autoit][/autoit] [autoit]

    While True
    Switch GUIGetMsg()
    Case -3
    Exit
    Case $btChange1
    GUISetState(@SW_SHOW, $Gui2)
    GUISetState(@SW_HIDE, $Gui1)
    Case $btChange2
    GUISetState(@SW_SHOW, $Gui1)
    GUISetState(@SW_HIDE, $Gui2)
    Case $inDbl1
    ConsoleWrite('Doppel-Klick GUI-1 Input_1' & @LF)
    Case $inDbl2
    ConsoleWrite('Doppel-Klick GUI-1 Input_2' & @LF)
    Case $inDbl3
    ConsoleWrite('Doppel-Klick GUI-1 Input_3' & @LF)
    Case $inDbl4
    ConsoleWrite('Doppel-Klick GUI-2 Input_4' & @LF)
    Case $inDbl5
    ConsoleWrite('Doppel-Klick GUI-2 Input_5' & @LF)
    Case $inDbl6
    ConsoleWrite('Doppel-Klick GUI-2 Input_6' & @LF)
    EndSwitch
    WEnd

    [/autoit]

    Dateien

    DoubleClick_Event[0.1].au3 3,75 kB – 459 Downloads
  • Happy Birthday Eukalyptus & Developer30

    • BugFix
    • 2. März 2013 um 13:08

    Alles Gute Jungs, Gesundheit und Erfolg bei allem, was ihr anpackt. :thumbup:

  • Excel - Toolbars und deren Controls, + eigene Ctrl hinzufügen

    • BugFix
    • 1. März 2013 um 12:52

    Hi,
    angeregt durch eine Fragestellung gestern Nacht habe ich mich mal mit den Toolbars und deren Controls etwas näher befaßt.
    Im Allgemeinen können uns die Control fast egal sein, aber wenn man z.B. eine personifizierte Oberfläche auf mehreren PC einrichten möchte/muss :D kommt die Stärke von AutoIt zur Automatisierung zum Tragen. Und dann müssen wir natürlich Zugriff auf diese Objekte erlangen um ihre Eigenschaften nach unserem Bedarf anzupassen.

    Hier die beiden Funktionen, mit denen das sehr praktikabel geht. Voraussetzung ist natürlich ein geöffnetes Excel (Referenz kann, muß aber nicht übergeben werden).

    Und hier die Funktionen
    • _Excel_GetToolBars
    • _Excel_GetCtrlsFromToolBar
    mit einem Mini-Bsp.

    Spoiler anzeigen
    [autoit]


    #include <Array.au3>

    [/autoit] [autoit][/autoit] [autoit]

    ; == Bei geöfnetem Excel ausführen

    [/autoit] [autoit][/autoit] [autoit]

    $aToolBars = _Excel_GetToolBars()
    _ArrayDisplay($aToolBars, 'Sichtbare ToolBars')

    [/autoit] [autoit][/autoit] [autoit]

    $aCtrls = _Excel_GetCtrlsFromToolBar('Standard')
    _ArrayDisplay($aCtrls, 'Alle Controls der Toolbar')

    [/autoit] [autoit][/autoit] [autoit]

    $oCtrl = _Excel_GetCtrlsFromToolBar('Standard','Funktions-Assistent')
    ConsoleWrite('L, T, W, H: ' & $oCtrl.Left & ', ' & $oCtrl.Top & ', ' & $oCtrl.Width & ', ' & $oCtrl.Height & @LF)

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _Excel_GetToolBars
    ; Description......: Ermittelt alle (od. nur sichtbare) Toolbars der Excelanwendung
    ; Parameter(s).....: $_iVisible 1 (Standard) nur sichtbare/ 0 alle Toolbars
    ; .................: $_oExcel Excel-Referenz, -1 (Standard) greift auf offenes Excel zu
    ; Requirement(s)...: MS Excel
    ; Return Value(s)..: Erfolg: 2D-Array, an [0][0] die Anzahl der Toolbars, [[Name,Obj-Referenz,Visible]]
    ; .................: Fehler: -1 set @error = 1 keine Referenz übergeben u. kein Excel offen
    ; .................: = 2 keine Toolbar sichtbar
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _Excel_GetToolBars($_iVisible=1, $_oExcel=-1)
    If $_oExcel = -1 Then
    $_oExcel = ObjGet('', 'Excel.Application')
    If Not IsObj($_oExcel) Then Return SetError(1,0,-1)
    EndIf
    Local $oToolBars = $_oExcel.Application.CommandBars
    Local $aTB[1][3] = [[0]] ; [[Name,Obj-Referenz,Visible]]
    Local $i = 0
    If Not $_iVisible Then
    $aTB[0][0] = $oToolBars.Count
    ReDim $aTB[$aTB[0][0] +1][3]
    EndIf
    With $oToolBars
    For $oTB In $oToolBars
    If $_iVisible Then
    If Not $oTB.Visible Then ContinueLoop
    $i += 1
    $aTB[0][0] = $i
    ReDim $aTB[$i +1][3]
    Else
    $i += 1
    EndIf
    $aTB[$i][0] = $oTB.NameLocal
    $aTB[$i][1] = $oTB
    $aTB[$i][2] = $oTB.Visible
    Next
    EndWith
    If $i > 0 Then Return $aTB
    Return SetError(2,0,-1)
    EndFunc ;==>_Excel_GetToolBars

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _Excel_GetCtrlsFromToolBar
    ; Description......: Ermittelt alle/ein bestimmtes Control(s) einer Toolbar
    ; Parameter(s).....: $_sTB lokaler Name der Toolbar
    ; .................: $_sCtrl Name eines Controls, Leerstring (Standard) gibt alle zurück
    ; .................: $_oExcel Excel-Referenz, -1 (Standard) greift auf offenes Excel zu
    ; Requirement(s)...: MS Excel, _Excel_GetToolBars()
    ; Return Value(s)..: Erfolg: Aufruf mit Controlname - Objektreferenz für dieses Control
    ; .................: Aufruf ohne Controlname - 2D-Array an [0][0] die Anzahl der Controls, [[Name,Obj-Referenz]]
    ; .................: Fehler: -1 set @error = 1 keine Referenz übergeben u. kein Excel offen od. Toolbar nicht sichtbar
    ; .................: = 2 angegebene Toolbar ist nicht vorhanden
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _Excel_GetCtrlsFromToolBar($_sTB, $_sCtrl='', $_oExcel=-1)
    Local $oTB, $n = 0, $aCtrl[1][2] = [[0]] ; [[Name,Obj-Referenz]]
    Local $aTB = _Excel_GetToolBars(1, $_oExcel)
    If @error Then Return SetError(1,0,-1)
    For $i = 1 To $aTB[0][0]
    If $aTB[$i][0] = $_sTB Then
    $oTB = $aTB[$i][1]
    ExitLoop
    EndIf
    Next
    If Not IsObj($oTB) Then Return SetError(2,0,-1)
    If $_sCtrl = '' Then
    $aCtrl[0][0] = $oTB.Controls.Count
    ReDim $aCtrl[$aCtrl[0][0] +1][2]
    EndIf
    For $oControl In $oTB.Controls
    With $oControl
    If $_sCtrl <> '' Then
    If .Caption = $_sCtrl Then Return $oControl
    Else
    $n += 1
    $aCtrl[$n][0] = $oControl.Caption
    $aCtrl[$n][1] = $oControl
    EndIf
    EndWith
    Next
    Return $aCtrl
    EndFunc ;==>_Excel_GetCtrlsFromToolBar

    [/autoit]

    Edit:
    Da kam mir der Gedanke doch auch eigene Controls hinzuzufügen. Das geht mit 5 Controltypen: Button, Edit, DropDown, ComboBox, PopUp.
    Den Button kann man diverse Images(FaceId) zuordnen. Eine Übersicht findet ihr hier.
    Eigene Images lassen sich auch verwenden, ist aber etwas mehr Aufwand. Hatte ich mir noch nicht vorgenommen, zumal die vorhandene Auswahl riesig ist.
    Die Controls lassen sich temporär oder dauerhaft zuordnen. Das ist praktisch, wenn man an einem Fremd-PC sein gewohntes Umfeld herstellen möchte. Beim nächsten Aufruf ist alles wie vorher.

    _Excel_ToolBarCtrlAdd
    [autoit]

    ; == Control-Types
    Const $msoControlButton = 1
    Const $msoControlEdit = 2
    Const $msoControlDropdown = 3
    Const $msoControlComboBox = 4
    Const $msoControlPopup = 10

    [/autoit] [autoit][/autoit] [autoit]

    ; == Button am Ende erstellen (temporär) mit Smiley-Image
    $oCtrl = _Excel_ToolBarCtrlAdd('Standard', 'MeinTestButton', 'Test Button', $msoControlButton, 1, '', '', 59, -1, True)

    [/autoit] [autoit][/autoit] [autoit]

    ;===============================================================================
    ; Function Name....: _Excel_ToolBarCtrlAdd
    ; Description......: Fügt einer Toolbar ein benutzerdefiniertes od. Systeminternes Control hinzu
    ; Parameter(s).....: $_sTB Lokaler Name der Toolbar
    ; .................: $_sTag Tag des neuen Controls
    ; .................: $_sCaption Bezeichnung des neuen Controls, gleichzeitig ControlTip bei Hover
    ; .................: $_iType MsoControlType, möglich sind:
    ; .................: • $msoControlButton
    ; .................: • $msoControlEdit
    ; .................: • $msoControlDropdown
    ; .................: • $msoControlComboBox
    ; .................: • $msoControlPopup
    ; ....optional.....: $_iId ID eines internen Ctrl oder "1" (Standard) für benutzerdefiniertes Ctrl
    ; ....optional.....: $_sParameter Für integrierte Steuerelemente, wird dieses Argument durch die
    ; .................: Container-Anwendung verwendet werden, um den Befehl auszuführen.
    ; .................: Bei benutzerdefinierten Ctrl können hier zusätzliche Werte zur
    ; .................: Interaktion mit VBA oder Eigenschaftswerte gespeichert werden
    ; ....optional.....: $_iBefore Zahlenwert (Index) eines Ctrl vor dem das neue Ctrl eingefügt werden soll.
    ; .................: Ohne Angabe (Leerstring, Standard) wird am Ende angefügt.
    ; ....optional.....: $_iFaceID Image-ID für Button, -1=kein Image (Standard), Übersicht: http://fring.developpez.com/vba/excel/faceid/
    ; ....optional.....: $_oExcel Excel-Referenz, -1 (Standard) greift auf offenes Excel zu
    ; ....optional.....: $_fTemporary Mit "True" existiert das Control nur bis die Anwendung geschlossen wird.
    ; .................: "False" (Standard) integriert das Control dauerhaft.
    ; Requirement(s)...: MS Excel, _Excel_GetToolBars()
    ; Return Value(s)..: Erfolg: Objektreferenz des neuen Controls
    ; .................: Fehler: -1 set @error 1 - keine Referenz übergeben u. kein Excel offen
    ; .................: 2 - keine Toolbar vorhanden
    ; .................: 3 - angegebene Toolbar ist nicht vorhanden od. nicht sichtbar
    ; .................: 4 - $_iBefore-Param <1 oder größer als Anzahl Controls
    ; Author(s)........: BugFix ( [email='bugfix@autoit.de'][/email] )
    ;===============================================================================
    Func _Excel_ToolBarCtrlAdd($_sTB, $_sTag, $_sCaption, $_iType, $_iId=1, $_sParameter='', $_iBefore='', $_iFaceID=-1, $_oExcel=-1, $_fTemporary=False)
    If $_oExcel = -1 Then
    $_oExcel = ObjGet('', 'Excel.Application')
    If Not IsObj($_oExcel) Then Return SetError(1,0,-1)
    EndIf
    Local $oCtrl, $oTB, $aTB = _Excel_GetToolBars(1, $_oExcel)
    If @error Then Return SetError(2,0,-1)
    For $i = 1 To $aTB[0][0]
    If $aTB[$i][0] = $_sTB Then
    $oTB = $aTB[$i][1]
    ExitLoop
    EndIf
    Next
    If Not IsObj($oTB) Then Return SetError(3,0,-1)
    If $_iBefore <> '' Then
    If $_iBefore < 1 Or $_iBefore > $oTB.Controls.Count Then Return SetError(4,0,-1)
    Else
    $_iBefore = Default
    EndIf
    $oCtrl = $oTB.Controls.Add($_iType, $_iId, $_sParameter, $_iBefore, $_fTemporary)
    With $oCtrl
    .Caption = $_sCaption
    .Tag = $_sTag
    If $_iFaceID <> -1 Then .FaceId = $_iFaceID
    EndWith
    Return $oCtrl
    EndFunc ;==>_Excel_ToolBarCtrlAdd

    [/autoit]
  • Einträge in ListView via Input's aktuallisieren

    • BugFix
    • 1. März 2013 um 10:44
    Zitat von Inferior

    Keiner eine Idee?


    Ist dir nicht mal der Gedanke gekommen, dass keiner antwortet, weil die Frage durch einfaches Lesen der Listview-UDF-Hilfe sich schon selbst beantwortet?
    Lerne mit der Hilfe umzugehen, es nützt dir nichts, wenn du jetzt die Lösung vorgekaut bekommst.
    Tipp: Du möchtest Text aus einem selektiertem Item - vielleicht suchst du mal in der UDF nach Funktion(en) mit dem Wort "..Text.."... :whistling:

    [OT]
    Bitte korrigiere mal deine Signatur. Der Spruch ist inhaltlich und von der Rechtschreibung her inkorrekt.
    Er lautet:
    "Denke nie gedacht zu haben, denn das Denken der Gedanken ist gedankenloses Denken." ;)
    [/OT]

  • Maus curser geht nicht

    • BugFix
    • 1. März 2013 um 10:34

    Try command:

    [autoit]

    ControlCommand ( "title", "text", controlID, "command" [, "option"] )

    [/autoit]


    But you must identify the window, where the control is. Parameter "title", maybe a handle or the window title. Parameter "text" can be omitted, use empty string.

    [autoit]


    $title = ; The Window title/handle
    ControlCommand($title, '', "[CLASS:TEdit; INSTANCE:16]", "EditPaste", 'your_string_to_insert')

    [/autoit]


    NB: If you make cross posts, its a good kind of manner to post the link here too.

  • Dynamische GUI Grösse über 2 verschiedene Monitore

    • BugFix
    • 26. Februar 2013 um 13:12

    An der Funktion bin ich unschuldig. :D
    AspirinJunkie hatte da mal was gepostet: http://msdn.microsoft.com/en-us/library/dd162610(VS.85).aspx

  • Win 8 dlls ins systemverzeichnis scheiben per script ? - nicht möglich!?

    • BugFix
    • 25. Februar 2013 um 14:15
    Zitat von WhiteLion

    ich hatte keine richtige erklärung warum es nicht funktionierte


    Welchen @error liefert denn DllOpen() ?

  • Win 8 dlls ins systemverzeichnis scheiben per script ? - nicht möglich!?

    • BugFix
    • 25. Februar 2013 um 13:40
    Zitat von WhiteLion

    die im systemverzeichnis vom Windows liegen müssen damit sie funktionieren


    Warum??
    Da wo sie liegen, sind sie schon richtig. Lade sie mit

    [autoit]

    $hDll = DllOpen("Pfad")

    [/autoit]

    und fertig ist die Laube.

  • neue Images per Makro - auf Dauer

    • BugFix
    • 25. Februar 2013 um 12:37

    Wir sprechen anscheinend von unterschiedlichen Dingen.
    Wenn du in Excel ein Image einfügst, hat das keinen Bezug zu irgendeiner Zelle (ausser der Positionierung). Also speicherst du das Bild nicht als Objekt, sondern als Pfadangabe in der Zelle.
    Ich halte es für etwas abwegig, jetzt einen Weg zu suchen um auf einer VBA-GUI Bilder darzustellen unter Verwendung von AutoIt. :whistling:
    Wenn du unbedingt in deinem Excel bleiben möchtest, solltest du diese Zugriffe mittels VBA-Programmierung lösen.
    Du mußt dir nur eine sinnvolle Vorgehensweise überlegen. Könnte etwa so aussehen
    - Nimm dir eine Zelle, in der du die Adresse der als nächstes zu belegenden Zelle hinterlegst
    - Bei Klick auf Button "Neu" wird die zugehörige Sub aufgerufen
    - In der Sub: - Adresse aus Zelle auslesen/ - Datei-Auswahldialog einblenden um Image-Pfad zu erhalten/ - Pfad in Zelle eintragen/ - Image in der Form einfügen/ - Eigenschaft Pfad auf Zelladresse verweisen/ - Zelladresse auf nächsten Wert erhöhen
    - Abspeichern


    Du kannst das alles auch in AutoIt lösen (vermutlich sogar wesentlich einfacher). Dann sind wir auch die richtigen Ansprechpartner und können gezielt helfen.

  • neue Images per Makro - auf Dauer

    • BugFix
    • 25. Februar 2013 um 09:22
    Zitat von Sunnysmiler

    Derzeit habe ich eine Exceltabelle für 27 Bilder


    Werde mal etwas konkreter. Hast du die Bilder als Pfad oder als Objekt eingebunden?
    Die einfachste Lösung ist eigentlich, wenn du die gewünschten Handlungen per Hand ausführst und dabei als Makro aufzeichnest. Das Makro kannst du dann bearbeiten, sodass es nicht nur für diesen einen Vorgang wirkt, sondern allgemeingültig wird.

  • Weiter bestehendes Problem mit IE@Create

    • BugFix
    • 24. Februar 2013 um 13:14
    Zitat von Croco1984

    Nachdem man mir einfach das Problem geschlossen hat, ohne auf eine reaktion meinerseits zu warten


    Halte dich mal bitte an die Fakten:
    - Erste Antwort von autoBert war: "Da Anmeldeprozeduren sich von Site zu Site unterscheiden müsstest du schon die URL nennen bei der du Probleme hast."
    - Deine Reaktion: "Es ist vollkommen egal welche URL ich da nehme."
    - Darauf hast du die einzig nun mögliche Antwort von autoBert erhalten: "für eine so allgemein gehaltene Anforderung eine genauso allgemeine Antwort: mit den _IE...-Funkionen, speziell _IEFormElementSetValue"
    - Aber auch das konnte dich nicht dazu veranlassen eine für uns reproduzierbare Problemsituation zu posten. Stattdessen wieder allgemeines Rumgeeiere: "nach der erfolgreichen anmeldung auf der Seite-X, wird eine Seite-Y neu generiert mit mehr informationen und vielleicht buttons für den Member. Auf dieser neuen Seite Y möchte ich in ein Feld einen schon festgelegten Text automatisch einfügen und bestätigen lassen. das das über die ie-funktionen läuft ist mir schon bewusst, aber über welche genau, den bei jeder anmeldung wird über die X-seite der Bezug genommen und wenn ich auf der Y-Seite eine erneute eingabe machen will findet er den Bezug einfach nicht mehr."

    Wenn du kein Interesse hast dein Problem nachvollziehbar zu schildern, haben wir kein Interesse unsere Zeit zu verschwenden indem wir Glaskugeln reiben um zu Erahnen, was dein Problem sein könnte.
    Niemals wird ein Thread einfach so geschlosssen. Es war dein Verhalten, dass diese Reaktion initiiert hat. Also bitte schön den Ball flach halten.

  • Combox auslesen und in Edit anderen wert schreiben.

    • BugFix
    • 23. Februar 2013 um 09:07

    Dazu brauchst du nur ein If-Statement:

    [autoit]


    $read = GUICtrlRead($Combo1)
    $write = 0 ; == Variable mit "Nein"-Status vorbelegen
    If $read = "Ja" Then $write = 1 ; == wenn Abfrage "Ja" den Wert ändern
    GUICtrlSetData ($Edit1,$s & $write)

    [/autoit]
  • [UDF] Debug-Timer

    • BugFix
    • 23. Februar 2013 um 08:51

    Für sehr grobe "Schätzungen" kannst du mit den nativen Timer-Funktionen arbeiten. Wenn es dir aber um sehr genaue Zeitmessungen geht, schau die mal die Funktionen der Timer-UDF an.

  • IE@Create Problem

    • BugFix
    • 21. Februar 2013 um 23:20

    Wie AutoBert bereits sagte spielt es sehr wohl eine Rolle, welche Seite aufgerufen werden soll.
    Da du nicht gewillt bist uns diese Informationen zu geben, sind wir nicht gewillt dir zu helfen.

    [CLOSED]

  • Funktion Gesucht !

    • BugFix
    • 17. Februar 2013 um 20:56

    Dann setze bitte das Thema auf gelöst (Startpost editieren).

  • StringInStr Funktioniert nicht richtig

    • BugFix
    • 17. Februar 2013 um 20:53

    Deine Überschrift ist Bullshit!

    Richtig wäre:
    Mein Versuch mit StringInStr zu arbeiten schlägt fehl - was mache ich falsch?

    Und um deine Fehler zu sehen, müßtest du uns schon wissen lassen, wie der Inhalt, den du verarbeiten willst, aussieht.

    Btw. - Um nur zu prüfen, ob StringInStr etwas findet bedarf es keinerlei Vergleichselement. Hängt mit der Vergleichsform von If (bool) und der Interpretation von Werten durch AutoIt (0=False, alles andere ist True) zusammen:

    [autoit]

    If StringInstr($string, $InStr) Then ; wahr

    [/autoit]
  • RosettaCode Sammelthread

    • BugFix
    • 16. Februar 2013 um 21:12

    Eigentlich meiden wir, wenn es irgend geht, Assign und Eval. Das sind Befehle, die wirklich nur in extremen Ausnahmefällen zu nutzen sind. Meist gibt es jedoch bessere Lösungsvarianten.
    Deshalb würde ich empfehlen die Bsp. in Rosetta Code nicht damit zu "verschlimmbessern".
    Just my 2 Cent. ;)

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™