Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/14/2015 in all areas

  1. jaberwacky

    Haskell

    Here's a good link: http://fpbridge.co.uk/why-fsharp.html
    2 points
  2. Thanks guys, I was looking at the session variables but on my local computer using the SET command, and I wasn't sure how to call them using AutoIt. So I've modified the code you guys mentioned to the following: If Not StringInStr (EnvGet("SESSIONNAME"), "RDP-Tcp" ) Then ...Cheers.
    2 points
  3. Since BAT/CMD scripts have become a real scripting language, there should be also a subforum in the Language Specific Discussion forum. Just to prove the power of BAT scripts, here a licence key script. I know there is also a working au3 solution. May we convince the admins to create such a subforum ?
    1 point
  4. I thought about extracting the comments from Excel and store it somewhere else (flat file, database ... depends on the amount of data to store). There could be a button in the script to grab the comments from the Excel and update the file/database.
    1 point
  5. Excel is so powerful - I only know a little bit of it. If I have a problem I ask Google and add "visual basic". The result can then be easily be translated to AutoIt.
    1 point
  6. I couldn't test my code before posting - Ubuntu doesn't run Excel If it works then it is perfect
    1 point
  7. I could not get the test to recognize the intersection as written it won't evaluate to true (I think because it returns a range object not true). I also noticed it may be missing "Application" after the application object and before the intersect method. @water please feel free to correct me if I did this wrong - or could have done it better - but this works for me. #include <Excel.au3> #include <MsgBoxConstants.au3> Local $oExcel = _Excel_Open() Local $sWorkbook = @ScriptDir & "\comments.xlsx" Local $oWorkbook = _Excel_BookOpen($oExcel, $sWorkbook, Default, Default, True) $oWorksheet = $oWorkbook.WorkSheets.Item(1) $oRange = $oWorksheet.Range("A1:A3") $oRangeWithComments = $oWorksheet.Cells.SpecialCells($xlCellTypeComments) ; returns a range For $oCell in $oRangeWithComments $oIntersect = $oExcel.Application.intersect($oRange, $oRangeWithComments) If Not IsObj($oIntersect) Then ConsoleWrite("no intersection"); used for negative testing when I played with the ranges Else ConsoleWrite("Address: " & $oCell.Address & ", Comment: " & $oCell.Comment.Text & @CRLF) EndIf NextP.S. That intersect method is awesome. I learn a ton from all your posts
    1 point
  8. Untested: $oRange = Your range $oRangeWithComments = $oWorksheet.Cells.SpecialCells($xlCellTypeComments) For $oCell in $oRangeWithComments If $oExcel.Intersect($oCell, $oRange) Then ConsoleWrite("Address: " & $oCell.Address & ", Comment: " & $oCell.Comment.Text & @CRLF) EndIf Next
    1 point
  9. ...and that's the reason for the GUI handle + WM_COPYDATA
    1 point
  10. Yes. As _SciTE.au3 relies on that anyway.
    1 point
  11. Look in SciTE Jump, the function is clearly there in a separate UDF, honestly.
    1 point
  12. The search system breaks when you start trying to limit on tags so searching by forum is the best way at the mo. Hopefully upcoming search changes will address problems like this.
    1 point
  13. No such thing exists I'm afraid.
    1 point
  14. Skysnake, Surely it is just a context menu that appears on right click? In which case it is easy to do: #include <GUIConstantsEx.au3> #include <ButtonConstants.au3> #include <MsgBoxConstants.au3> $hGUI = GUICreate("Test", 500, 500) $cHamburger = GUICtrlCreateButton("", 10, 10, 100, 100, $BS_ICON) GUICtrlSetImage($cHamburger, "HamburgerMenu.ico") $CButtonContextMenu = GUICtrlCreateContextMenu($cHamburger) $cAbout = GUICtrlCreateMenuItem("About button", $cButtonContextMenu) GUICtrlCreateMenuItem("", $cButtonContextMenu) $cExit = GUICtrlCreateMenuItem("Exit", $cButtonContextMenu) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit Exit Case $cAbout MsgBox($MB_SYSTEMMODAL, "Menu Selected", 'About') EndSwitch WEndM23
    1 point
  15. I'm not sure why you'd need this, but you could modify this script to tell you when a USB keyboard is added/removed. $strComputer = "." Global $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") Global $colDevices = $objWMIService.ExecQuery("Select * From Win32_USBControllerDevice") Global $strOutput = "" For $objDevice In $colDevices $strDeviceName = $objDevice.Dependent() $strQuotes = Chr(34) $strDeviceName = StringReplace($strDeviceName, $strQuotes, "") $arrDeviceNames = StringSplit($strDeviceName, "=") $strDeviceName = $arrDeviceNames[2] Global $colUSBDevices = $objWMIService.ExecQuery("Select * From Win32_PnPEntity Where DeviceID = '" & $strDeviceName & "'") For $objUSBDevice In $colUSBDevices $strOutput &= $objUSBDevice.Description & " = " & $objUSBDevice.PnPDeviceID & @CRLF ; Changed from Description to PnPDeviceID ;as this script can be altered to return any property ;of the Win32_USBControllerDevice collection. Next Next ConsoleWrite($strOutput)
    1 point
  16. A better example. #include <GUIConstantsEx.au3> #include <WinAPIEx.au3> #include <MsgBoxConstants.au3> #include <TrayConstants.au3>; Required for the $TRAY_ICONSTATE_SHOW constant. Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. Example() Func Example() Local $hGUI = GUICreate("My Dummy GUI", 0, 0) Local $idShowDlg = TrayCreateItem("ShowDialog") TrayCreateItem("") ; Create a separator line. GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $idShowDlg ; Display a message box about the AutoIt version and installation path of the AutoIt executable. _ShowDialog() Case $idExit ; Exit the loop. _WinAPI_DeregisterShellHookWindow($hGUI) ExitLoop EndSwitch WEnd EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle = $sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_ShowDialog Saludos
    1 point
  17. of couse yes. just create a dummy gui (hidden) #include <GUIConstantsEx.au3> #include <WinAPIEx.au3> Global Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ;Must be global to allow compare HotKeySet("{F8}", "_ShowDialog") Example() Func Example() Local $hGUI = GUICreate('Just a Dummy GUI', Default, Default) ; Create a dummy gui no need to be visible GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. _ShowDialog() _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) If WinGetProcess($lParam) = @AutoItPID And $sTitle=$sMessage Then ControlSetText($sTitle, "", "Button1", "AutoIt") ControlSetText($sTitle, "", "Button2", "Danyfirex") EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _ShowDialog() ; Create a constant variable in Local scope of the message to display in FileOpenDialog. Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." ; Display an open dialog to select a list of file(s). Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", $FD_FILEMUSTEXIST + $FD_MULTISELECT) If @error Then ; Display the error message. MsgBox($MB_SYSTEMMODAL, "", "No file(s) were selected.") ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) Else ; Change the working directory (@WorkingDir) back to the location of the script directory as FileOpenDialog sets it to the last accessed folder. FileChangeDir(@ScriptDir) ; Replace instances of "|" with @CRLF in the string returned by FileOpenDialog. $sFileOpenDialog = StringReplace($sFileOpenDialog, "|", @CRLF) ; Display the list of selected files. MsgBox($MB_SYSTEMMODAL, "", "You chose the following files:" & @CRLF & $sFileOpenDialog) EndIf EndFunc ;==>_Dialog Saludos
    1 point
  18. jvanegmond

    Haskell

    Even Notepad++ supports Haskell highlighting, though I'm not sure how good it is. I've been thinking about learning F# for a while.
    1 point
  19. It's actually not too bad of an idea to fix HotStrings and include it with UDFs. Still I'd prefer a package manager but maybe something to think about. I need some help though.
    1 point
  20. 1 point
  21. You're wellcome. Look out with $sMessage. I declared it twice lol. Just keep the global one. Saludos
    1 point
  22. ISN AutoIt Studio Version 0.99 BETA is now online! Happy testing! Changelog (translated by google translator): -> ISN AutoIt Studio: <- ----------------------------------- - Fix: Several bugfixes - Fix: When you close a project was produced in error under certain conditions the message that a file in the folder for temporary scripts. This is now fixed. - Bug fix: When using the DBUG tools were often not deleted some temp files. This is now fixed. - Fix: Several bugfixes for the new autocomplete (If -> endif, etc.) - Bugfix: veringert fibrillation the toolbar and the menu bar when switching tabs - Fix: Autocomplete detection improved - Fix: The path to the last open tabs will now be saved in the * .isn file with real tive paths. - Bugfix: syntax update for AutoIt version 3.3.14.1 - NEW: AutoIt3Wrapper, Tidy & Au3Stripper updated to newer versions. - NEW: The project file (project.isn) can now be named anything! (Extension * must .isn naturally preserved! In addition, the file must be in the root directory of the project!) - NEW: When creating a new project, the name can now also directly to the project file (* .isn) be specified. - NEW: "Edit -> Go to function (Ctrl + J)" can now jump directly to the function. (As in the script tree) - NEW: In the program settings under "Script Editor -> File Types" can now any file types are set to be automatically opened with the Script Editor, the ISN. - NEW: New Tag for macros:% myisndatadir% -> Points to the directory by the cache, settings, etc. are stored. (In portable mode is% myisndatadir% =ScriptDir) - NEW: There is now in the program settings the ability more paths for AU3 * api files & * .keywords.properties files indicate... (File Locations -> API files) - NEW: The alphabetical sorting of functions in the script tree can now be disabled. (In the script tree characteristics) - NEW: New macro: Start script -> Starts an AutoIt script in ISN AutoIt Studio (similar to the script function test) -> ISN form Studio 2: <- ----------------------------------- - Fix: Several bugfixes - Bugfix: syntax update for AutoIt version 3.3.14.1 - Fix: Fixed a bug in which was selected in the GUI properties automatically "text from func". - Bug fix: could ComboBoxes often difficult marked with the mouse. This is now fixed. - Fix: Some controls have simply disappeared again after copying. This is now fixed. - Fix: Fixed a bug by the entries could be changed anyway in a locked menu Control. - NEW: The Control Editor in form Studio 2 can now be folded up in the Control Editor or be restored by an icon to the right. (If it is sometimes requires more space quickly.) - NEW: In the GUI properties under "AutoIt code settings" can now be determined whether will be inserted in the script #include one should or not. - NEW: Settings such as "declaration of Handles" can now be obtained from the Global program settings form Studios. - NEW: It can now be selected as Style or States in the AutoIt code be adopted. Either as a variable (eg. $ BS_DEFPUSHBUTTON) or Magic Numer (as before). New default for this setting is the variant with variable. (Because the code is easier to read) The whole can be set in the GUI properties for each .isf or in the program settings Global. - NEW: In Control Editor under "representation" can now be specified with an icon (.ico) and the Index. (If the icon of a .dll is based) - NEW: The loading screen has now been transferred to the GUI of the form Studios. - NEW: It is now possible properties in the Control Editor to change when multiple controls are selected. These are then applied to the Mark Controls.
    1 point
  23. While looking for a way to change my desktop background of only my secondary monitor, I found a few simple solutions that are built into Windows. But when you look up how to do such with a slideshow... You only find programs that cost money. So, I set out to make it myself.This is a pretty basic program. It simply displays an image in the center of the screen (scaled to fit screen) and uses a black background.The program does allow mouse passthrough, though you can't drag and drop over it, so it wouldn't really work well if you have icons on your second monitor. #include <File.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <Misc.au3> #include <Array.au3> #include <GDIPlus.au3> ;User Changeable Variables ;======================================================================== $pictureFolder = "D:\Wallpapers" $changeTime = 5 ;Seconds Global $smWidth = 1600 Global $smHeight = 900 Global $monitorPosition = "Right" ;Global $monitorPosition = "Left" ;======================================================================== Global $imageList = _FileListToArray($pictureFolder) Global $imageCount = $imageList[0] Global $imageHeight, $imageWidth, $pHeight, $pWidth, $pic, $gdiPic _GDIPlus_Startup() OnAutoItExitRegister("CloseProgram") $GUIStyle = BitOR($WS_POPUP, $WS_VISIBLE, $HWND_BOTTOM) ;Popup, Visible, Window on Bottom $GUIStyleEx = BitOR($WS_EX_TRANSPARENT, $WS_EX_TOOLWINDOW) ;Allow Passthrough, Hide from Alt+Tab $Parent = WinGetHandle('Program Manager', '') ;Sets parent to the program manager, allowing you to right click the desktop If $monitorPosition = "Right" Then $GUI = GUICreate("Secondary Wallpaper", $smWidth, $smHeight, @DesktopWidth, 0, $GUIStyle, $GUIStyleEx, $Parent) Else $GUI = GUICreate("Secondary Wallpaper", $smWidth, $smHeight, (-1 * @DesktopWidth), 0, $GUIStyle, $GUIStyleEx, $Parent) EndIf GUISetBkColor(0, $GUI) _WinAPI_SetWindowPos($GUI, $HWND_BOTTOM, 0, 0, 0, 0, BitOR($SWP_NOACTIVATE, $SWP_NOMOVE, $SWP_NOSIZE, $SWP_SHOWWINDOW)) ;Forces window to bottom of screen WinSetTrans($GUI, '', 255) ;Sets Window Visible Transparency: Required for mouse passthrough ChangeImage() GUISetState(@SW_SHOW) ;Show GUI While 1 Sleep($changeTime * 1000) ChangeImage() WEnd Func ChangeImage() $picName = Random(1, $imageCount, 1) ;Get Dimensions of image GetDimensions($imageList[$picName]) $imageHeight = $pHeight $imageWidth = $pWidth ;Turn them all into integers. (Fixes glitch that caused some images to skip resizing) $imageHeight = Int($imageHeight) $imageWidth = Int($imageWidth) $smHeight = Int($smHeight) $smWidth = Int($smWidth) ;Adjust the image size ;----------------------------------------------- ;If the image is bigger than the screen, adjust it If $imageWidth > $smWidth = 1 Or $imageHeight > $smHeight = 1 Then ;Calculate Aspect Ratio of image $aspectRatioX = $smWidth / $imageWidth $aspectRatioY = $smHeight / $imageHeight If $aspectRatioX < $aspectRatioY Then $scaleFactor = $aspectRatioX Else $scaleFactor = $aspectRatioY EndIf $imageHeight = $imageHeight * $scaleFactor $imageWidth = $imageWidth * $scaleFactor ;Else ;Image is smaller/same size as monitor EndIf ;Calculate Center of monitor ;(Monitor size - image size) / 2 $smCenterX = ($smWidth - $imageWidth) / 2 $smCenterY = ($smHeight - $imageHeight) / 2 ;Resize the image $hHBmp = $pictureFolder & "\" & $imageList[$picName] $gdiPic = _GDIPlus_BitmapCreateFromFile($hHBmp) ;convert GDI bitmap to GDI+ bitmap _GDIPlus_BitmapDispose($pic) $pic = _GDIPlus_ImageResize($gdiPic, $imageWidth, $imageHeight) ;resize image _GDIPlus_BitmapDispose($gdiPic) GUISetBkColor(0, $GUI) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($GUI) ;create a graphics object from a window handle $gdiPic = _GDIPlus_BitmapCreateFromFile($pictureFolder & "\" & $imageList[$picName]) _GDIPlus_GraphicsDrawImage($hGraphics, $pic, $smCenterX, $smCenterY) ;display scaled image _GDIPlus_GraphicsDispose($hGraphics) ;Garbage Cleanup EndFunc ;==>ChangeImage Func GetDimensions($picName) Local $prop, $dArray, $fileSize, $imageDimensionsGDI $path = $pictureFolder & "\" & $picName $fileSize = FileGetSize($path) ;Save information to registry for faster access. Compare size of picture to verify changes to picture If $fileSize <> RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size") Then ;File sizes do not match RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size", "REG_SZ", $fileSize) $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path) $pWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI) $pHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI) _GDIPlus_ImageDispose($imageDimensionsGDI) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width", "REG_SZ", $pWidth) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height", "REG_SZ", $pHeight) Else ;File sizes match $pWidth = RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width") $pHeight = RegRead("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height") If $pWidth = "-1" Or $pHeight = "-1" Then RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Size", "REG_SZ", $fileSize) $imageDimensionsGDI = _GDIPlus_ImageLoadFromFile($path) $pWidth = _GDIPlus_ImageGetWidth($imageDimensionsGDI) $pHeight = _GDIPlus_ImageGetHeight($imageDimensionsGDI) _GDIPlus_ImageDispose($imageDimensionsGDI) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Width", "REG_SZ", $pWidth) RegWrite("HKEY_CURRENT_USER\Software\Secondary Wallpaper\Pictures", $picName & " Height", "REG_SZ", $pHeight) EndIf EndIf EndFunc ;==>GetDimensions Func CloseProgram() ;Garbage Cleanup _GDIPlus_GraphicsDispose($gdiPic) _GDIPlus_Shutdown() EndFunc ;==>CloseProgram Secondary Wallpaper.au3
    1 point
  24. Just for reference: https://technet.microsoft.com/en-us/library/bb490954.aspx https://en.wikibooks.org/wiki/Windows_Batch_Scripting
    1 point
  25. You can use ie.au3 to get data from website, and you can use my Debenu Quick PDF Library - UDF to manage PDF files , including fillilng form.
    1 point
  26. ripdad

    TCPRecv and v3.3.12.0

    jpm, That .exe is v3.3.11.5 beta. Are you saying to use this .exe - and for how long? I'm just trying to understand the logic here. Most people would like to upgrade when a stable version is out. At this point, I think people that use the TCP functions heavily, are staying with v3.3.8.1 or earlier because of this issue. Does the error codes in UDPTCP@error.txt apply to both the v3.3.11.5 beta .exe And v3.3.12.0 ? Also, what was wrong with TCPRecv in v3.3.8.1 ? Thanks for your time! -Edit- #2384 applies to this post: '?do=embed' frameborder='0' data-embedContent>> As far as I can tell, this is where this issue started - with UDPRecv. Why does this fix affect TCPRecv? If this function remains the same as it stands, then correction's need to be made in the help file - otherwise this will be a reoccurring issue. Thanks again!
    1 point
×
×
  • Create New...