Jump to content

Xenobiologist

MVPs
  • Posts

    4,888
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Xenobiologist

  1. What is it, that you are trying to achieve? I changed to key 1 for testing. #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") HotKeySet("{F8}", "Terminate") Func Terminate() DllClose($hDLL) Exit 0 EndFunc Func test() If _IsPressed("31", $hDLL) Then ConsoleWrite("_IsPressed - '=' Key was pressed." & @CRLF) While _IsPressed("31", $hDLL) ConsoleWrite(" '=' Key remains pressed." & @CRLF) Sleep(250) WEnd ConsoleWrite("_IsPressed - '=' Key was released." & @CRLF) EndIf EndFunc While 1 Sleep(250) test() WEnd DllClose($hDLL)
  2. Fun game, but 5 numbers with 1000 ms is too easy.
  3. I tried this and it worked without any quotation in target/ziel. ConsoleWrite(FileCreateShortcut("c:\EigeneProgramme\bank21-Reporting-Manager\bank21-Reporting-Manager.exe", @DesktopDir & '\RM.lnk', "C:\", "-StartMenuFine", "RM", "", "", 0, @SW_SHOWNORMAL) & @crlf)
  4. Do you just want to open the standard browser with its start page?
  5. Did you try all the _IE functions supported by Autoit? Can you provide the URL to test it?
  6. Are you doing it the way I suggested with FileInstall and deleting afterwards?
  7. Fine, but what about using an array or dictionary object instead of many many single variables?
  8. No problem. Easy one and glad I could help.
  9. Maybe this is what you asked. $baum = 'tree' _translate() Func _translate() Send("^c"); Send(Eval(ClipGet())) EndFunc
  10. Something like this? Mark Haus or Uhr and then hit ALT+SHIFT+d. $myDict = _ObjDictCreate(1) _ObjDictAdd($myDict, 'Baum', 'tree') _ObjDictAdd($myDict, 'Uhr', 'clock') _ObjDictAdd($myDict, 'Haus', 'house') HotKeySet("+!d", "_translate") ; Shift-Alt-d While 1 Sleep(100) WEnd Func _translate() Send("^c"); ConsoleWrite(ClipGet() & @CRLF) Send(_ObjDictGetValue($myDict, ClipGet())) EndFunc #cs ============================= OBJEKT 'Scripting.Dictionary' ======================================= *** Funktionssammlung *** _ObjDictCreate(Modus) Erzeugt ein Dictionary Objekt im Binär- (default) oder Textmodus Gibt das Handle des Objektes zurück _ObjDictAdd(Objekt, Schlüssel, Wert) Fügt einem Dictionary Objekt ein Schlüssel-Wert Paar hinzu _ObjDictGetValue(Objekt, Schlüssel) Liest den Wert für einen Schlüssel aus _ObjDictSetValue(Objekt, Schlüssel) Setzt einen neuen Wert für einen Schlüssel _ObjDictCount(Objekt) Gibt die Anzahl der Schlüssel-Wert Paare zurück _ObjDictSearch(Objekt, Schlüssel) Prüft ob der Schlüssel existiert, liefert 'TRUE' wenn gefunden _ObjDictDeleteKey(Objekt, Schlüssel) Löscht den angegebenen Schlüssel (und dessen Wert) Wird statt eines Schlüsselnamens '' übergeben, werden alle Schlüssel gelöscht (Standard) _ObjDictList(Objekt) Eine GUI mit einem ListView zeigt alle Schlüssel-Wert Paare _IniReadSectionToObjDict(Objekt, INI-Pfad, Sektion) Liest die angegebene INI-Sektion in das Objekt Gibt die Anzahl der gelesenen Schlüssel-Wert Paare zurück _IniWriteSectionFromObjDict(Objekt, INI-Pfad, Sektion) Schreibt die Schlüssel-Wert Paare des Objekts in die angegebene Sektion der INI-Datei Gibt die Anzahl der geschriebenen Schlüssel-Wert Paare zurück _FileReadToObjDict(Objekt, TextDatei-Pfad, Seperator) Liest aus einer Textdatei alle Schlüssel-Wert Paare zeilenweise ein (1 Paar/Zeile) Standard-Seperator ist '|', kann hier angepaßt werden Gibt die Anzahl der gelesenen Schlüssel-Wert Paare zurück _FileWriteFromObjDict(Objekt, TextDatei-Pfad, Seperator, Overwrite) Schreibt die Schlüssel-Wert Paare des Objekts in die angegebene Datei (1 Paar/Zeile). Mit Overwrite='TRUE' (Standard) wird die angegebene Datei, falls sie bereits existiert, überschrieben. Mit 'FALSE' wird an eine bestehende Datei angehängt. Standard-Seperator ist '|', kann hier angepaßt werden. Gibt die Anzahl der geschriebenen Schlüssel-Wert Paare zurück Autor: BugFix ( bugfix@autoit.de ) =================================================================================================== #ce #include <GuiConstants.au3> #include <GuiListView.au3> ;================================================================================================== ; Parameter: $MODE ; 0 Binär (default) ; 1 Text ; Return: Objekt Handle ;================================================================================================== Func _ObjDictCreate($MODE=0) $oDICT = ObjCreate('Scripting.Dictionary') If $MODE <> 0 Then $oDICT.CompareMode = 1 Return $oDICT EndFunc ;==>_ObjDictCreate ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $KEY - Schlüssel ; $VALUE - Wert ; Return: Erfolg: 0 ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 2 Schlüssel ohne Inhalt übergeben ; 3 Wert hat keinen Inhalt ; 4 Schlüssel bereits vorhanden ;================================================================================================== Func _ObjDictAdd(ByRef $oDICT, $KEY, $VALUE) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $KEY = '' Then SetError(2) Return -1 ElseIf $VALUE = '' Then SetError(3) Return -1 ElseIf $oDICT.Exists($KEY) Then SetError(4) Return -1 EndIf $oDICT.Add($KEY, $VALUE) Return 0 EndFunc ;==>_ObjDictAdd ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $KEY - Schlüssel ; Return: Erfolg: Wert des Schlüssels ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 2 Schlüssel ohne Inhalt übergeben ; 5 Schlüssel nicht vorhanden ;================================================================================================== Func _ObjDictGetValue(ByRef $oDICT, $KEY) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $KEY = '' Then SetError(2) Return -1 ElseIf Not $oDICT.Exists($KEY) Then SetError(5) Return -1 EndIf Return $oDICT.Item($KEY) EndFunc ;==>_ObjDictGetValue ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $KEY - Schlüssel ; $VALUE - Wert ; Return: Erfolg: 0 ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 2 Schlüssel ohne Inhalt übergeben ; 3 Wert hat keinen Inhalt ; 5 Schlüssel nicht vorhanden ;================================================================================================== Func _ObjDictSetValue(ByRef $oDICT, $KEY, $VALUE) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $KEY = '' Then SetError(2) Return -1 ElseIf $VALUE = '' Then SetError(3) Return -1 ElseIf Not $oDICT.Exists($KEY) Then SetError(5) Return -1 EndIf $oDICT.Item($KEY) = $VALUE Return 0 EndFunc ;==>_ObjDictSetValue ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; Return: Erfolg: Anzahl der Schlüssel-Wert Paare ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ;================================================================================================== Func _ObjDictCount(ByRef $oDICT) If Not IsObj($oDICT) Then SetError(1) Return -1 EndIf Return $oDICT.Count EndFunc ;==>_ObjDictCount ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $KEY - Schlüssel ; Return: Erfolg: TRUE Schlüssel vorhanden ; FALSE Schlüssel nicht vorhanden ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 2 Schlüssel ohne Inhalt übergeben ;================================================================================================== Func _ObjDictSearch(ByRef $oDICT, $KEY) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $KEY = '' Then SetError(2) Return -1 ElseIf Not $oDICT.Exists($KEY) Then Return False Else Return True EndIf EndFunc ;==>_ObjDictSearch ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $KEY - Schlüssel (default='') ; mit $KEY = '' werden alle Schlüssel gelöscht ; Return: Erfolg: 0 ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ;================================================================================================== Func _ObjDictDeleteKey(ByRef $oDICT, $KEY='') If Not IsObj($oDICT) Then SetError(1) Return -1 EndIf If $KEY = '' Then $oDICT.RemoveAll Return 0 ElseIf Not $oDICT.Exists($KEY) Then SetError(5) Return -1 EndIf $oDICT.Remove($KEY) Return 0 EndFunc ;==>_ObjDictDeleteKey ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $TITLE - Fenstertitel (optional) ; Return: Erfolg: GUI mit ListView ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; Requirements: #include <GuiConstants.au3> ; #include <GuiListView.au3> ;================================================================================================== Func _ObjDictList(ByRef $oDICT, $TITLE='Elemente: Objekt Dictionary') If Not IsObj($oDICT) Then SetError(1) Return -1 EndIf Local $count = $oDICT.Count Local $SaveMode = Opt("GUIOnEventMode",0), $ListGUI, $oDictLV, $btnClose, $msg $ListGUI = GUICreate($TITLE, 600, 400, (@DesktopWidth - 600)/2, (@DesktopHeight - 400)/2) $btnClose = GUICtrlCreateButton('&Ende', 40, 360, 70, 22) GUICtrlSetResizing($btnClose, BitOR($GUI_DockRight, $GUI_DockBottom, $GUI_DockSize)) GUICtrlDelete($oDictLV) $oDictLV = GUICtrlCreateListView('Schlüssel|Wert', 10, 10, 580, 340, BitOR($LVS_SHOWSELALWAYS, _ $LVS_EDITLABELS), BitOR($LVS_EX_GRIDLINES, $LVS_EX_HEADERDRAGDROP, $LVS_EX_FULLROWSELECT, $LVS_EX_REGIONAL)) If $count > 0 Then Local $strKey, $colKeys = $oDICT.Keys For $strKey In $colKeys GUICtrlCreateListViewItem($strKey & '|' & $oDICT.Item($strKey), $oDictLV) Next Else WinSetTitle($ListGUI, '', 'Das Objekt Dictionary enthält keine Elemente!') EndIf GUISetState(@SW_SHOW, $ListGUI) While 1 $msg = GUIGetMsg(1) If $msg[1] = $ListGUI And _ ($msg[0] = $GUI_EVENT_CLOSE Or $msg[0] = $btnClose) Then ExitLoop WEnd GUIDelete($ListGUI) Opt("GUIOnEventMode",$SaveMode) EndFunc ;==>ObjDictList ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $PathINI - Pfad der INI-Datei ; $SECTION - Sektion die gelesen werden soll ; Return: Erfolg: Anzahl der eingelesenen Schlüssel-Wert Paare ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 6 INI-Pfad nicht vorhanden ; 7 kein Sektionsname ; 8 INI-Sektion konnte nicht gelesen werden oder leer ;================================================================================================== Func _IniReadSectionToObjDict(ByRef $oDICT, $PathINI, $SECTION) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf Not FileExists($PathINI) Then SetError(6) Return -1 ElseIf $SECTION = '' Then SetError(7) Return -1 EndIf Local $arSECTION = IniReadSection($PathINI, $SECTION) If Not IsArray($arSECTION) Then SetError(8) Return -1 EndIf For $i = 1 To $arSECTION[0][0] $oDICT.Add($arSECTION[$i][0], $arSECTION[$i][1]) Next Return $arSECTION[0][0] EndFunc ;==>_IniReadSectionToObjDict ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $PathINI - Pfad der INI-Datei ; $SECTION - Sektion die gelesen werden soll ; Return: Erfolg: Anzahl der geschriebenen Schlüssel-Wert Paare ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 7 kein Sektionsname ; 9 INI-Sektion konnte nicht geschrieben werden ;================================================================================================== Func _IniWriteSectionFromObjDict(ByRef $oDICT, $PathINI, $SECTION) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $SECTION = '' Then SetError(7) Return -1 EndIf Local $arSECTION[$oDICT.Count][2], $i = 0 Local $strKey, $colKeys = $oDICT.Keys For $strKey In $colKeys $arSECTION[$i][0] = $strKey $arSECTION[$i][1] = $oDICT.Item($strKey) $i += 1 Next If IniWriteSection($PathINI, $SECTION, $arSECTION, 0) = 1 Then Return $oDICT.Count Else SetError(9) Return -1 EndIf EndFunc ;==>_IniWriteSectionFromObjDict ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $PathFile - Pfad der Datei ; $SEPERATOR - Trennzeichen zwischen Wert u. Schlüssel, Standard: '|' ; Return: Erfolg: Anzahl der eingelesenen Schlüssel-Wert Paare ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 6 Datei-Pfad nicht vorhanden ; 7 Leerstring als Seperator übergeben ; 8 Datei konnte nicht gelesen werden ;================================================================================================== Func _FileReadToObjDict(ByRef $oDICT, $PathFile, $SEPERATOR='|') If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf Not FileExists($PathFile) Then SetError(6) Return -1 ElseIf $SEPERATOR = '' Then SetError(7) Return -1 EndIf Local $fh = FileOpen($PathFile, 0), $line Local $val If $fh = -1 Then SetError(8) Return -1 EndIf While 1 $line = FileReadLine($fh) If @error = -1 Then ExitLoop $val = StringSplit($line, $SEPERATOR) If $val[0] > 1 Then $oDICT.Add($val[1], $val[2]) EndIf Wend FileClose($fh) Return $oDICT.Count EndFunc ;==>_FileReadToObjDict ;================================================================================================== ; Parameter: $oDICT - Handle des Dictionary-Objektes ; $PathFile - Pfad der Datei ; $SEPERATOR - Trennzeichen zwischen Wert u. Schlüssel, Standard: '|' ; $OVERWRITE - Falls Datei existiert, wird sie überschrieben (Standard). ; Mit 'FALSE' wird an bestehende Datei angehängt. ; Return: Erfolg: Anzahl der geschriebenen Schlüssel-Wert Paare ; Fehler: -1 ; Fehlerwert: 1 Objekt existiert nicht ; 7 Leerstring als Seperator übergeben ; 8 Datei konnte nicht geschrieben werden ;================================================================================================== Func _FileWriteFromObjDict(ByRef $oDICT, $PathFile, $SEPERATOR='|', $OVERWRITE=True) If Not IsObj($oDICT) Then SetError(1) Return -1 ElseIf $SEPERATOR = '' Then SetError(7) Return -1 EndIf If $OVERWRITE Then Local $fh = FileOpen($PathFile, 34) Else Local $fh = FileOpen($PathFile, 33) EndIf Local $strKey, $colKeys = $oDICT.Keys For $strKey In $colKeys FileWriteLine($fh, $strKey & $SEPERATOR & $oDICT.Item($strKey)) If @error Then SetError(8) Return -1 EndIf Next FileClose($fh) Return $oDICT.Count EndFunc ;==>_FileWriteFromObjDict
  11. Where is your problem? Use _Excel_RangeRead to get the path and then the save function.
  12. Change your while loop to this: While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop case $userButton_Check startvalidation() EndSwitch WEnd Besides, there are parameters for Input that can also help you to validate things.
  13. Do you view your file in a browser? Maybe then you need to use html tags like <br>
  14. You mean there is a & @crlf missing after your Telefonnummer?
  15. Get the first and the last time and then use e.g. _DateDiff to get the seconds between those time. You could use a _TimeDiff directly in your script.
  16. Please show your script, or at least some more detail of what your are dealing with. Do you have variables? Do you want to sum an array or rows and colums in an 2d array?
  17. What is it that doesn't work? Does the exe start? Did you look at the otions WinTitleMatchMode and so on?
  18. Don't know? Maybe something like this? #include <File.au3> #include <Array.au3> #include <FileConstants.au3> Global $avArray _FileReadToArray('temp.txt', $avArray, $FRTA_NOCOUNT) For $i = UBound($avArray) - 1 To 0 Step -1 ConsoleWrite($i & " " & $avArray[$i] & @crlf) If Not StringRegExp($avArray[$i], '(?s)^\d{5}', $STR_REGEXPMATCH) Then ;~ _ArrayDelete($avArray, $i) ; optional Else $avArray[$i] = "CPT CODE" & $avArray[$i] EndIf Next _ArrayDisplay($avArray)
  19. Maybe you should talk to the guys that are responsible for the proxy in that company. Perhaps, they could help you out. This seems to be no Autoit related problem.
  20. First of all, I'm not a proxy expert, but the Autoit code should work. I use it behind a HTTP proxy in my company. The only "problem" is, I would have to tunnel ftp over HTTP if the proxy doesn't support this by default. What is it, that you are really trying to do? Did you try to use Filezilla, WinSCP, TotalCommander or whatever tool with your proxy? Did that work?
  21. What happens when your script "exits" before the second consolewrite? Is there an error message in scite?
  22. Which error do you get? The code only contains a function which is never called. 😨
  23. Try this: Everytime you change the password and hit enter, the counter goes +1. After 3 attempts the script exits. #include <MsgBoxConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $THE_PASSWORD = '1234' main() Func main() GUICreate("", 196, 29, @DesktopWidth / 2 - 96, @DesktopHeight / 2 - 62, $WS_POPUP) GUICtrlSetDefBkColor(0xFF0000) GUISetBkColor(0xFF0000) GUICtrlCreateLabel("Passwort", 8, 8, 47, 17) GUICtrlSetColor(-1, 0xFFFFFF) Local $password_I = GUICtrlCreateInput("", 64, 4, 121, 21, $SS_NOTIFY) GUICtrlSetColor(-1, 0xFFFFFF) GUISetState(@SW_SHOW) Local $counter = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $password_I If GUICtrlRead($password_I) == $THE_PASSWORD Then Run("notepad.exe") ; your stuff Else $counter += 1 EndIf If $counter = 3 Then MsgBox(16, 'ERROR', 'Shame on you!', 5) Exit EndIf EndSwitch WEnd EndFunc ;==>main
  24. #include <MsgBoxConstants.au3> Example() Func Example() Local $sPasswd = InputBox("Security Check", "Enter your password.", "", "*") If Not @error Then If $sPasswd == "1234" Then Run("notepad.exe") Else Exit EndIf EndIf EndFunc ;==>Example Here is your fish 🙂
  25. Where is the problem? Get the password with Inputbox or whatever Check the password and then Run your script.
×
×
  • Create New...