Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/21/2015 in all areas

  1. My suggestions Add in the restore current clipboard code like I have shown above, nothing more frustrating that having something copied you need/want and losing it on accident because you ran a script. Compile your script to an .exe so that if your friends want it they can run it without needing to install Autoit, better yet Compile an installer for it so that it puts the shortcut, the .exe and everything in its place, and can uninstall it later on if desired. You can use a .ini file and some simple code to read the "search" location so that it can be changed by the user without needing to recompile the .exe and let them customize it upon install. Use ClipGet() instead of _ClipBoard_GetData() its native to Autoit and will perform the same for your needs. Especially if distributing this to others, I would go the route we showed earlier with the script open in the background and a While Loop, this way users do not need to worry about shortcuts, and placing files around or any of that. Add another hotkey to exit the script at any time. Then you can just give them the .exe and they run it and it works, nothing else required. Regards,
    1 point
  2. I do have Win 7, Win 8.1, and Win 10 computers at my desk. Looks like your on the right track, its not working on my 8.1 computer. Best Solution? Use Alt+Escape Send("!{ESC}")
    1 point
  3. SkythekidRS, Why do you want to do this? Why can you not provide a compiled exe rather then create it in place? M23
    1 point
  4. Genericized. #include <Date.au3> Global $aSeconds[3] = [" Seconds ", 1000, "s"] Global $aMinutes[3] = [" Minutes ", 1000 * 60, "n"] Global $aHours[3] = [" Hours ", (1000 * 60) * 60, "h"] Global $aUnits = $aMinutes ; This can be $aSeconds, $aMinutes or $aHours Global $iUnits = 3 HotKeySet("^!t", "CheckTime") Global $iWaitTime = $iUnits * $aUnits[1] Global $vStartTime = _NowCalc() AdlibRegister("MyFunc", $iWaitTime) While 1 Sleep(10) WEnd Func MyFunc() $vStartTime = _NowCalc() ConsoleWrite("MyFunc Adlib: " & $vStartTime & @LF) EndFunc ;==>MyFunc Func CheckTime() ConsoleWrite(@LF & "Current Cycle is set for " & $iWaitTime / $aUnits[1] & $aUnits[0] & @LF & _ "There is " & ($iUnits - _DateDiff($aUnits[2], $vStartTime, _NowCalc())) & $aUnits[0] & "Left Until Next Cycle" & @LF) EndFunc ;==>CheckTime
    1 point
  5. The only issue with the OP is that you are working forwards through a loop deleting things. go backwards. #include <file.au3> $file = @ScriptDir & "\test.txt" For $i = _FileCountLines($file) to 1 step - 1 $line = FileReadLine($file, $i) If StringInStr($line, "//") Then _FileWriteToLine($file, $i, "", 1) EndIf Next
    1 point
  6. Melba23

    Left To Right

    zxtnt09, Apply the $WS_EX_LAYOUTRTL extended style to the control. M23
    1 point
  7. kcvinu, When you create a control using a native GUICtrlCreate* function, the return value is a ControlID - an integer value. AutoIt uses this ControlID to identify the control - it is in fact the index of the internal array that AutoIt uses to track native control. When you create a control using a UDF, the return is a handle - a special unique value used by Windows to track virtually everything in the system. In your first script above you are using the native command - so the $hCombo1 variable holds a ControlID (and should really be named $idCombo1 or $cCombo1). However, in the message handler you are looking for the handle: $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hCombo1 If you replace $hWndFrom with $iIDFrom, you will find that the code works as expected - because you are now checking the ControlID and not the handle. In the second script, you create the combo via the UDF and so get a handle returned - unsurprisingly this works as you are this time checking the handle directly. All clear? And as always I would counsel against using blocking functions (such as MsgBox) inside a message handle you do in both scripts - the Help file specifically mentions this and it is a warning that should be heeded. M23
    1 point
  8. You can declare multiple variables on one line (separated by commas): Global $g_Var1, $g_Var2 = "string", $g_Var3 = 3, $g_Var4 ; add more variables...
    1 point
  9. Adele, If you declare a variable in the main script and not inside a function then it is automatically Global in scope (even if you declare it as Local). But I would caution against doing this and recommend that you specifically declare the scope of your variables to prevent later confusion. And if you have that many Global variables I wonder whether you should not look at recasting your script to reduce their number. M23
    1 point
  10. Jon

    AutoIt v3.3.14.2 Released

    Uploaded v3.3.14.2 with some changes that were causing issues. Download it here. AutoIt: Fixed: #pragma directive was not working correctly for setting Windows 10 options.UDFs: Fixed #3078: _ArrayUnique() error on 2D arrays with autocheck.Changed: _SQLite_Startup() no longer automatically downloads DLL files. THIS IS A SCRIPT BREAKING CHANGE
    1 point
  11. LarsJ

    Rubik's Cube

    The picture shows Rubik's Cube in the middle of a rotation, wherein the layer is rotated 90 degrees. New version for AutoIt 3.3.10 The scripts were flawed. Fixed in this update. 08-01-2013: First post In the Cubes menu there are six cubes from 2*2*2 to 7*7*7: Pocket Cube, Rubik's Cube, Rubik's Revenge, Professor's Cube, V-Cube 6 and V-Cube 7. See http://en.wikipedia.org/wiki/Rubik's_Cube. The Scramble menu scrambles the cube. In the input field in the statusbar you can set the number of scramble steps. The Solve menu automatically solves the cube. In this version it just plays back the undo log. The Build menu shows how the cubes are created. It also shows how the rotation of a layer is simulated. The Scramble, Solve and Build menus puts the program into a Scramble, Solve and Build mode. To leave the Scramble and Solve modes click the menu once more. To leave the Build mode uncheck the menu. The program mode or state appears in the statusbar. See the Help menu for more information about the menus. Rotating a layer in the cube Click an edge of the layer with the left mouse button and hold the button downMove the mouse in the direction you want to rotate the layerRelease the left mouse buttonThe rotating layer in the picture has probably been clicked somewhere on the blue edge. You can't rotate a layer in Scramble, Solve and Build modes. The mouse buttons can be switched in the Options. Rotating the entire cube Click in the window with the right mouse button and hold the button downMove the mouse in the direction you want the cube to rotateRelease the right mouse buttonThe description of the mouse rotations can be found in the Help menu. Using the keyboard Use the arrow keys or <A,a>, <W,w>, <S,s>, <Z,z> to rotate the cube. Use <Home> or <H,h> to place the cube in the start position. Use <Page Up> or <I,i> and <Page Down> or <O,o> to zoom in and out. Use Num 1-6 or 1-6 to show the 6 sides of the cube. The program Inspiration for the program is from this site: http://rubiksim.sourceforge.net/. The graphics is generated with old style OpenGL 1.1. Some OpenGL globals and functions are copied from this thread http://www.autoitscript.com/forum/index.php?showtopic=83581 by trancexx. Especially globals and functions for creating an OpenGL window and a rendering context. Zipfile The zipfile contains a number of files: RubiksCube.au3 - GUI and main loop, run this fileMenuFncs.au3 - implements the menu systemMenuWins.au3 - creates menu system windowsKeyboard.au3 - code for shortcut keysOGLconsts.au3 - OpenGL constantsOGLfuncs.au3 - OpenGL functionsCubes.au3 - creates the cubesTurnLayer.au3 - rotate a layerRotateCube.au3 - rotate the cubeScramble.au3 - scramble functionSolveCube.au3 - solve functionsBuild.au3 - build functionsUtilities.au3 - calculations(The files are edited with Notepad++ with a tabwidth of 2. This doesn't match the default settings in Scite.) 21-01-2013: Update #1 Fixed some errors in the Build menu. Added a log to see the colors of all sides at one time. See picture in post #5. RubiksCube3.3.10.7z Testet on XP 32 bit and Win 7 32/64 bit. Previous versions for AutoIt 3.3.8
    1 point
  12. GtaSpider

    msdn constants importer

    Hi there, Well, perhaps some of you know that problem: You just wanna create a new amazing UDF and recive your informations from msdn. Well, ok exporting functions is not that problem, but its quite horrible to expand all the struct-constants from msdn in your script and format it in the way you want to. So i wrote a little automation, so you just have to run this script, copy the link from msdn in your clip and the script will automatically write the constant in a file you specified before. Quite simple, isnt it? Here is an example link: http://msdn.microsoft.com/en-us/library/ms941841.aspx Hope you enjoy it! ;================== ;msdn constants importer ;by GtaSpider ;================== ;PLEASE CHANGE IF YOU WANT Global Const $sVarBefore = "$tag" ; will be: $tagTITLE_OF_THE_CONSTANT Global Const $sConstFileToWrite = @ScriptDir&"\Clip_Constants.au3"; the Constants will be written in the next line of the file ;STOP CHANGE FileWrite($sConstFileToWrite,";Constants importet from msdn with 'msdn constants importer' by GtaSpider'"&@CRLF&@CRLF) HotKeySet("^c","_clip") HotKeySet("^C","_clip") HotKeySet("^{ins}","_clip") While 1 Sleep(500) WEnd Func _clip() HotKeySet(@HotKeyPressed) Send(@HotKeyPressed) Local $sURL = ClipGet() If StringInStr($sURL,"msdn.microsoft.com") Then TrayTip("Clip",$sURL,2) Local $sSource = BinaryToString(InetRead($sURL)) Local $aRegExp = StringRegExp($sSource,'(?s)<div class="title">(.*?)</div>.*?<pre class="libCScode".*?>.*?\{(.*?)}.*?</pre>',3) If UBound($aRegExp) < 2 Then MsgBox(16,"Clip","Error, RegExp returnd bad values") Else Local $sTitle = $aRegExp[0] Local $sData = $aRegExp[1] $sData = StringStripCR(StringReplace(StringReplace($sData,@LF,''),@CRLF,'')) Local $sNewLine = 'Global Const '&$sVarBefore&$sTitle&' = "',$sRet Local $aData = StringSplit($sData,";"),$i For $i = 1 To $aData[0] If Not StringLen($aData[$i]) Then ContinueLoop $sNewLine &= $aData[$i]&"; " If StringLen($sNewLine) > 100 Then $sRet &= $sNewLine& '" & _'&@CRLF $sNewLine = @TAB&@TAB&'"' EndIf Next $sRet &= $sNewLine&'"' If StringRight($sRet,10) = ' & _'&@CRLF&@TAB&@TAB&'""' Then $sRet = StringTrimRight($sRet,10) FileWrite($sConstFileToWrite,$sRet&@CRLF) TrayTip($sTitle,"Successful insertet to"&@CRLF&$sConstFileToWrite,2) EndIf EndIf HotKeySet(@HotKeyPressed,"_clip") EndFunc Greetings Spider msdn constants importer.au3
    1 point
×
×
  • Create New...