Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/12/2018 in all areas

  1. Yashied

    HotKey UDF

    LAST VERSION - 1.8 / 2.1b 25-Dec-13 The library allows to set hotkeys by using the low-level keyboard hook. Below are the main differences between HotKey UDF from the native HotKeySet() function: To assign a hotkeys are used integer values ​​instead of strings as in the HotKeySet() function. This is useful, for example, to save the hotkey's values in the registry.Ability to set any hotkeys including CTRL+ALT+DEL, F12, WIN+*, etc. The only exceptions are special keys such as "Fn" which do not have their own scan code.Ability to utilize or pass on the specified hotkeys for other applications.Ability to set hotkeys that already used by other applications.Ability to set hotkeys only for the specified window(s).Ability to prevent re-activation of the hotkeys when it is held down.Ability to disable previously installed hotkeys without removing the hook from the hook chain, ie without losing priority.Ability to block call user-defined function associated with the hotkey if the previous call has not been completed. Here is what you can't do by using this library:Set hotkey only for the CTRL, ALT, SHIFT, WIN, and any combination of this keys. Any hotkey should always include one function key. For example, ALT+A, CTRL+SHIFT+F10, etc.Set hotkey for a mouse buttons.Prevent using the hotkey like CTRL+ALT+DEL, CTRL+SHIFT+ESC (Windows Vista+), and similar.Use more than one function key in the hotkey. For example, ALT+A+B, F1+F2, etc.Use "Fn" key or any other keys that do not have their own scan code. Available functions HotKey UDF Library v1.8 Previous downloads: 5027 HotKey.au3 HotKey UDF Library v2.1b (Read >here for more information) Previous downloads: 1791 HotKey_21b.au3 Virtual-Key (VK) Code Constants (Optional) Previous downloads: 1576 vkConstants.au3 Example1 #Include <HotKey.au3> Global Const $VK_ESCAPE = 0x1B Global Const $VK_F12 = 0x7B ; Assign "F12" with Message() and set extended function call _HotKey_Assign($VK_F12, 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL)) ; Assign "CTRL-ESC" with Quit() _HotKey_Assign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit') While 1 Sleep(10) WEnd Func Message($iKey) MsgBox(0, 'Hot key Test Message', 'F12 (0x' & Hex($iKey, 4) & ') has been pressed!') EndFunc ;==>Message Func Quit() Exit EndFunc ;==>Quit Example2 #Include <HotKey.au3> Global Const $VK_OEM_PLUS = 0xBB Global Const $VK_OEM_MINUS = 0xBD Global $Form, $Label Global $i = 0 $Form = GUICreate('MyGUI', 200, 200) $Label = GUICtrlCreateLabel($i, 20, 72, 160, 52, 0x01) GUICtrlSetFont(-1, 32, 400, 0, 'Tahoma') GUISetState() ; Assign "CTRL-(+)" with MyFunc1() and "CTRL-(-)" with MyFunc2() for created window only _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_PLUS), 'MyFunc1', 0, $Form) _HotKey_Assign(BitOR($CK_CONTROL, $VK_OEM_MINUS), 'MyFunc2', 0, $Form) Do Until GUIGetMsg() = -3 Func MyFunc1() $i += 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc1 Func MyFunc2() $i -= 1 GUICtrlSetData($Label, $i) EndFunc ;==>MyFunc2
    1 point
  2. Hi @BatMan22. Maybe something like: If you want the toast to be displayed instantly do this: $iToast_Time_Out = 1 $iToast_Time_In = 1 after _Toast_Set and before _Toast_Show in the example in Toast.zip.
    1 point
  3. Jos

    Need Help

    mmm.. Name "NeedHelpNOW" and title "Need Help" is really a great start here. Don't you think that all people posting in the support forum need help one way or the other? It? what is it? if you mean your script then what about posting that? Jos
    1 point
  4. Some "test scripts"? To test what? If somebody can translate this word salat to something meaningful?
    1 point
  5. Jos

    Get data from json

    Unsure what you mean by the deleted comment. The posted code works fine on the posted Data, so should work for you too....right? I am working on a script that will help to code these JSON queries by making a JSON.DUMP() function which shows the proper keys. Jos
    1 point
  6. @Ostap welcome to the forum. As mentioned above, the problem is a combination of trying to use the wrong tool for the job (a MsgBox to display an array) and a lack of error checking. I would suggest in addition that you spend some time reading the help file page for the particular function you plan to use. The examples provided (in this case 3) will show you the proper way to utilize the command to retrieve the results you're after.
    1 point
  7. @n3wbie Thanks... I've seen those links before. Not sure on the Text / Value thing, especially since both FF and Chome are behaving the same way. For the time being, I've written separate functions to allow access to both.
    1 point
  8. Jos

    Get data from json

    Guess we can start a masterclass JSON here too. Try this one: (demo_json2.txt contains your json data) #include <Inet.au3> #include <json.au3> $data = FileRead("demo_json2.txt") $object = json_decode($data) $balances = json_get($object, '.balances') Local $i = 0 While 1 $asset = json_get($object, '.balances[' & $i & '].asset') If @error Then ExitLoop if $asset = "BTC" Then $volume_USD = json_get($object, '.balances[' & $i & '].free') ConsoleWrite('! $asset:' & $asset & ' $volume_USD = ' & $volume_USD & @CRLF) ;### Debug Console EndIf $i += 1 WEnd Jos
    1 point
  9. Study post 3 example1 thats the raw interface with treewalkers and base condition filters. This is the uiabase Create a filter condition. Search in examples for CreatePropertyCondition or in this thread A true condition is the simplest (will not filter/give back all elements) see https://msdn.microsoft.com/en-us/library/ms752331(v=vs.85).aspx#Using_Conditions Do a findall with treescope, filter condition and the reference for the result As said then it will only find on full matching and not on partial (which you frequently need if you deal with titles, multi language etc) $UIA_oUIAutomation.CreateTrueCondition($pTrueCondition) $oCondition = ObjCreateInterface($pTrueCondition, $sIID_IUIAutomationCondition, $dtagIUIAutomationCondition) ;~ $oCondition1 = _AutoItObject_WrapperCreate($aCall[1], $dtagIUIAutomationCondition) ;~ Tricky to search all descendants on html objects or from desktop/root element $oElementStart.FindAll($TreeScope, $oCondition, $pElements) ; Condition to find View menu item Local $pCondition1, $pCondition2 $oUIAutomation.CreatePropertyCondition( $UIA_ControlTypePropertyId, $UIA_MenuItemControlTypeId, $pCondition1 ) $oUIAutomation.CreatePropertyCondition( $UIA_NamePropertyId, "View", $pCondition2 ) $oUIAutomation.CreateAndCondition( $pCondition1, $pCondition2, $pCondition ) If Not $pCondition Then Return Thoughts for UIAwrappers (will put it on TODO list) Keep the initial elements in array found of a certain element in memory and scan that first as most likely you will handle n controls under same parent in sequence so UIA_SETVAR("RTI.SEARCHCONTEXT", $window) should set the window and the initial array and UIA_Action("checkbox1","click"), UIA_Action("checkbox2","click") should reuse the array thats set as a searching context
    1 point
  10. Jos

    /ErrorStdOut

    The config for *.au3 files is located in au3.properties and these lines perform the Run/Compile/Build tasks shown under tools: # Commands to compile / run your script command.go.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "$(FilePath)" /UserParams $(1) $(2) $(3) $(4) command.go.subsystem.$(au3)=1 command.compile.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /ShowGui /prod /in "$(FilePath)" command.compile.filter.$(au3)=1 command.build.$(au3)="$(SciteDefaultHome)\..\AutoIt3.exe" "$(SciteDefaultHome)\AutoIt3Wrapper\AutoIt3Wrapper.au3" /NoStatus /prod /in "$(FilePath)" command.build.filter.$(au3)=1 Scroll down to see all tools definition. SciTE is a generic Editor which I/We have totally configured & customized to perform all functions. I wrote AutoIT3Wrapper to be able to automate the Run and Compile processes and requested the addition of /ErrorStdOut to AutoIt3 at the time to get the AutoIt3 errrors/warnings back via STDOUT in stead of in an MsgBox(). Jos
    1 point
  11. I found out what the issue was. I changed this: FileWriteLine($LogFile, $ComputerNames & "," & $IP) To this: FileWriteLine($LogFile, $ComputerNames[$i] & "," & $IP) If forgot the add the computer name array $ComputerNames[$i] to the filewrite.
    1 point
  12. To convert an old source file from locale codepage to UTF8, open it, change encoding to UTF8 (File > Encoding > UTF8), apply a dummy change (add space then remove it) and save it.
    1 point
  13. water

    autoit autologin

    Welcome to AutoIt and the forum! How could you enter wrong credentials when they are provided by your script?
    1 point
  14. That's a peculiar need indeed. Then previous codes won't work as expected. This shoud work and still run fast: Local $hTimer = TimerInit() Local $nFile = @ScriptDir & "\new.csv" FileDelete($nFile) Local $sText = FileRead(@ScriptDir & "\data.tsv") $sText = StringReplace($sText, "\N", "", 0, $STR_NOCASESENSEBASIC) FileWrite($nFile, StringReplace($sText, @TAB, ",", 0, $STR_NOCASESENSEBASIC)) Local $fDiff = TimerDiff($hTimer) MsgBox("Finito","Time: ",_Convert($fDiff)) Func _Convert($ms) Local $day, $hour, $min, $sec _TicksToTime($ms, $hour, $min, $sec) If $hour > 24 Then $day = $hour/24 $hour = Mod($hour, 24) EndIf Return StringFormat("DAY:%02i,HOUR:%02i,MIN:%02i,SEC:%02i", $day, $hour, $min, $sec) EndFunc
    1 point
  15. To create a RichText Edit use the following function: (help file) #include <GuiRichEdit.au3> _GUICtrlRichEdit_Create($Window, $Text, $Left, $Top[, $Width [, $Height [, $Style [, $ExStyle ]]]]) ;# $Window : Which Window should the RichText Edit be in? ;# $Text : Which Text should be in the RichText Edit? ;# $Left : The RichText Edit's position from the left? ;# $Top : The RichText Edit's position from the top? ;# $Width : The RichText Edit's width ;# $Height : The RichText Edit's height ;# $Style : The RichText Edit's Styles ;# $ExStyle : The RichText Edit's Extended Styles To input text in another size / color / Bold / italic ... Check out Melba23s Helper To read out your RichText Edit Use (help file) #include <GuiRichEdit.au3> _GUICtrlRichEdit_StreamToFile($Window, $Path [, $fIncludeCOM=True [, $iOpts=0 [, $iCodePage = 0]]])Make sure NOT to save it as a txt!!!! Txt doesn't support rich text! Use .rtf (works best and should be supported by every computer) To add something to your Edit, use (help file) #include <GuiRichEdit.au3> _GUICtrlRichEdit_AppendText($hWnd, $sText) If you want to add something with a diffrent size or in bold or italic, again, check out Melba23s Helper So Finally i have this example Code for you. (Doesnt use Any special text) #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiRichEdit.au3> #include <File.au3> $Form1 = GUICreate("Test", 411, 300) ;Creates The GUI and makes it centered in the screen Global $Edit1 = _GUICtrlRichEdit_Create($Form1, "", 8, 8, 393, 241, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) ;Creates The richtext edit and makes it global, so that every function can read it out GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Input Something", 40, 264, 129, 25) ;creates a button $Button2 = GUICtrlCreateButton("Save Text", 176, 264, 113, 25) ;creates a button $Button3 = GUICtrlCreateButton("Close", 304, 264, 89, 25) ;creates a button GUISetState(@SW_SHOW) ;Makes the GUI visible While 1 $msg = GUIGetMsg() ;gets the GUI "changes" Switch $msg Case $GUI_EVENT_CLOSE ;on click on the X _GUICtrlRichEdit_Destroy($Edit1) ;VERY IMPORTANT! Exit Case $Button1 $input = InputBox("Input your text here", "Input your text that you want to add to the edit here") ;shows an inputbox _GUICtrlRichEdit_AppendText($Edit1, $Input & @CRLF) ;adds the text fron the inputbox to the Edit Case $Button2 _save() ;calls function _save() Case $Button3 _GUICtrlRichEdit_Destroy($Edit1) ;IMPORTANT before exit! Exit EndSwitch ;Ends the switch WEnd ;ends the while Func _save() $MyDocsFolder = "::{450D8FBA-AD25-11D0-98A8-0800361B1103}" ;Declares The variable $MyDocsFolder $savewhere = FileSaveDialog("Save to...", $MyDocsFolder,"Rich Text Files (*rtf)", 2) ;opens a dialog where you want to save your file If StringInStr($savewhere,".rtf") Then ;checks if the file extention is already there _FileCreate($savewhere);creates the file in directory selected (I'm not sure if it's necessary or not) $savetofile = _GUICtrlRichEdit_StreamToFile($Edit1, $savewhere) Else ;else adds file extention $savewhere = $savewhere & ".rtf" _FileCreate($savewhere) ;creates the file in directory selected (I'm not sure if it's necessary or not) $savetofile = _GUICtrlRichEdit_StreamToFile($Edit1, $savewhere) EndIf ;Ends the if EndFunc
    1 point
×
×
  • Create New...