Leaderboard
Popular Content
Showing content with the highest reputation on 09/18/2012 in all areas
-
Can Autoit be used to connect to a vpn and map drives?
shabbaranks reacted to JLogan3o13 for a topic
Hi, shabbaranks, welcome to the forum. The short answer to your two questions is yes, AutoIt can do that (it's rare that we say AutoIt can't do something). I would suggest using the forum search for VPN, which should give you some idea of what others have done in the past. It really depends on a lot of variables, such as the type of VPN (it is far different scripting a PPTP VPN vs. a Juniper SSL VPN). Once you've looked at what others have done, try writing something out. If you get stuck, feel free to post back here (even if it doesn't work) and we'll be glad to help1 point -
You just want to scramble a sequence of numbers? If you want to do it fast you'd avoid using any _Array() functions or calling Random() more than once per number output... #include <Array.au3> ; test ; load test array Dim $Array[141] = [140] For $x = 1 to 140 $Array[$x] = $x Next _ArrayDisplay($Array) ; test ; scramble it For $i= $Array[0] to 2 Step -1 $new = Random(1, $i, 1) $tmp = $Array[$i] $Array[$i] = $Array[$new] $Array[$new] = $tmp Next _ArrayDisplay($Array) ; test1 point
-
How to get own default e-mail address ?
MrMitchell reacted to guinness for a topic
Did you forget it?1 point -
Java 6 is old anyway, so I updated the snippet above.1 point
-
Just some scripts
jvanegmond reacted to Ruben for a topic
Well i was bored so i decided to make some scripts for fun. Screen dpi checker, use this to know the real dpi of your screen #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 293, 112, 192, 114) $Input1 = GUICtrlCreateInput("16", 20, 20, 31, 21) $Input2 = GUICtrlCreateInput("9", 60, 20, 31, 21) $Input3 = GUICtrlCreateInput("24", 100, 20, 21, 21) $Input4 = GUICtrlCreateInput("1920", 20, 50, 111, 21) $Input5 = GUICtrlCreateInput("1080", 20, 80, 111, 21) $Label1 = GUICtrlCreateLabel("Label1", 150, 30, 123, 60) GUICtrlSetFont(-1, 24, 400, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel(":", 54, 22, 5, 17) $Label3 = GUICtrlCreateLabel("''", 125, 20, 8, 17) $Label4 = GUICtrlCreateLabel("x", 10, 66, 9, 17) GUICtrlSetColor(-1, 0x000000) GUISetState(@SW_SHOW) While 1 $ratio_w = GUICtrlRead($Input1) $ratio_h = GUICtrlRead($Input2) $d = Sqrt($ratio_w^2 + $ratio_h^2) $size = GUICtrlRead($Input3) $porp = $size / $d $w = $ratio_w*$porp $h = $ratio_h*$porp $res_w = GUICtrlRead($Input4) $res_h = GUICtrlRead($Input5) $dpi = Round($res_w/$w,1) GUICtrlSetData ( $Label1, $dpi & " dpi" ) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch Sleep(1) WEnd Desktop replicator, it shows the whole desktop in a small window in realtime, it may be useful to someone for some project maybe? #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ScreenCapture.au3> $Form2 = GUICreate("Form2", 503, 294, 235, 329) $Pic1 = GUICtrlCreatePic(@ScriptDir & "temp.bmp",10, 10, 480, 270) GUISetBkColor(0x000000) GUISetState(@SW_SHOW) While 1 _ScreenCapture_Capture(@ScriptDir & "temp.bmp",0, 0, @DesktopWidth, @DeskTopHeight,False) Sleep(16) GUICtrlSetImage ( $Pic1, @ScriptDir & "temp.bmp") WEnd This is another print screen to file, im sure there are other scripts that do this already... well here's it anyway... use printscreen button to save a screenshot of the active window and win+printscreen for the whole desktop, it will save them in the same dir of the script. #include <ScreenCapture.au3> #include <Date.au3> HotKeySet('{PRINTSCREEN}','winscreen') HotKeySet('#{PRINTSCREEN}','deskscreen') Sleeping() Func winscreen() Local $i = 01 Local $size = WinGetPos("[ACTIVE]") Local $namewin = WinGetTitle("[active]") If @error = 1 Then MsgBox(0, "", "Error") EndIf $search = FileFindFirstFile(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg") While 1 If $search = -1 Then _ScreenCapture_Capture(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg", $size[0], $size[1], $size[0]+$size[2], $size[1]+$size[3],False) ExitLoop Else $i = $i+1 $search = FileFindFirstFile(@ScriptDir & "" & $namewin & "_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg") EndIf WEnd Sleeping() EndFunc Func deskscreen() Local $i = 01 $search = FileFindFirstFile(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg") While 1 If $search = -1 Then _ScreenCapture_Capture(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg", 0,0, @DeskTopWidth, @DeskTopHeight,False) ExitLoop Else $i = $i+1 $search = FileFindFirstFile(@ScriptDir & "desktop_" & $i & "_" & _DateTimeFormat(_NowCalc(), 2) & ".jpg") EndIf WEnd Sleeping() EndFunc Func Sleeping() While 1 Sleep(500) WEnd EndFunc1 point -
I can at least give you an explanation as to why this doesn't work. Maybe in hope that other people won't be so stupid as to try and break the rules. @HotKeyPressed only returns the last key - which has been assigned as a hotkey - triggered by HotKeySet. So calling: HotKeySet(@HotKeyPressed, "func") Is worthless because @HotKeyPressed is returning nothing.1 point
-
1 point
-
Great. Just post in the help file thread I would look at it in due course. Edit: Whoops! I re-read it and realised it was your documentation.1 point
-
Anyone can make a stupid keylogger. could you make something more usefull?1 point
-
Really think you should be here boasting about your keylogging spy tool? Do you care that it is not a really great advertizement for autoit and attracts all manner of pricks?1 point
-
Random number generation in a interval and koda designer window style
James reacted to somdcomputerguy for a topic
Another similar meaning phrase that you may run into, is 'elbow room'. Just to help you some maybe..1 point -
Windows 7 I've had a chance to test the script on Windows 7. To be able to browse system folders e.g. the Control Panel on Windows 7 you have to run the script, EnumDesktopGUI.au3, in the proper way. If you are using Windows 7 64 bit you have to run the script as a 64 bit program to be able to browse the system folders. On Windows XP the generel look and appearance of the GUI is OK. There are problems on Windows 7: The menu bar doesn't look good. Disabled icons are looking very bad. The drop down menu of some of the buttons can erase parts of other controls. The grouping in the ListView of the items in Computer folder is looking very clumsy and the items seems to be mixed up in some way. Also for the Control Panel some items are mixed up and some items appears both as folders and files. I will try to find a solution to these issues. Update #2: 2012-08-20 See first post dated 2012-04-19 below. zip-files are attached to the bottom of the post. Severe error Fixed an error which could lead to a crash immediately before GUI was closed down. Data for the TreeView was deleted and memory freed while the TreeView still had focus. Sorting _GUICtrlListView_RegisterSortCallBack() and related functions are used for sorting. The functions are modified to group files and folders, and to properly sort by size, by type and by time. The functions are provided in the file SortListView.au3. It can be time consuming to sort a large number of files and folders. To prevent using time on both updating and sorting the ListView when a new folder is selected in the TreeView, the sorting mechanism is reset to default when a new folder is selected. The default sorting is the order of files and folders as provided in the "While $IEnumIDList.Next() ... WEnd" loops. Virtual folders It can be a lengthy process to expand a large number of subfolders in the TreeView. To avoid this multiple subfolders can be grouped into a number of virtual folders with a specific number of subfolders in each virtual folder. The virtual folders are only created in the TreeView and ListView. Not on the disk. Virtual folders will be used when the number of subfolders exceeds 300. The number of subfolders in each virtual folder is set to 100. These limits can be changed in the options. And the functionality can be disabled completely. This is testet in a folder with 4000 subfolders and 100 pictures in each subfolder. Expanding the subfolders is much much faster when using virtual folders. In this example there will be created 40 virtual folders named "1 - 100", "101 - 200", ..., "3901 - 4000". Each virtual folder will contain 100 subfolders. But the 100 subfolders will not be expanded until you click a virtual folder. That means that in stead of creating 4000 subfolders at one time (which is extremely time consuming) there will be created 40 virtual folders, and when you click a virtual folder there will be created 100 subfolders at a time. Other updates Right click menu in TreeView: Refresh Added a SplitterBar control between the TreeView and ListView Added grouping information to the ListView for My Computer folder If an icon file EnumDesktopGUI.ico exists, this icon will be used for the GUI Option to save GUI position and size on exit Option to set TreeView startup folder More info to the Details View Fixed some minor issues Update #1: 2012-04-25 In post #3 wraithdu pointed out that the built-in function ObjCreateInterface could be used in stead of AutoItObject. An advantage in using ObjCreateInterface is that according to the helpfile you can use a struct as a parameter in the description string for the methods of the interface. It works in this example. No need for a lot of calls to DllStructGetPtr(). With ObjCreateInterface enumeration of a folder looks like this: ; The address that receives an IShellFolder Interface pointer $pParentFolder = GetParentFolder( ... ) ; Create an IDispatch-Object for the IShellFolder Interface $IShellFolder = ObjCreateInterface( $pParentFolder, $sIID_IShellFolder, $dtagIShellFolder ) ; $pIEnumIDList is the address that receives an IEnumIDList interface pointer of the enumeration object If $IShellFolder.EnumObjects( $NULL, BitOR( $SHCONTF_FOLDERS, $SHCONTF_INCLUDEHIDDEN ), $pIEnumIDList ) = $S_OK Then ; Create an IDispatch-Object for the IEnumIDList Interface $IEnumIDList = ObjCreateInterface( $pIEnumIDList, $sIID_IEnumIDList, $dtagIEnumIDList ) ; Enumerate the folders ; Param 1 [in] : Step value as in a For-loop While $IEnumIDList.Next( 1, $pidlRel, $iFetched ) = $S_OK ; Param 2 [out]: PIDL relative to parent folder $iFolders += 1 ; Param 3 [out]: 0 if no more PIDLs, 1 else ... ... ... WEnd EndIf The zipfile below is updated with new au3-files (the 3 EnumDesktop-files) that uses ObjCreateInterface. This version is not depending on AutoItObject and AutoItObject.au3 is not included. In this example ObjCreateInterface seems to be working flawlessly. 2012-04-19 I've been looking at AutoItObject for some time. I've got inspiration for this example from a similar C++ example and from this thread http://www.autoitscript.com/forum/index.php?showtopic=123365. The GUI in the example is a Windows Explorer Viewer with a TreeView and a ListView. The root of the TreeView is the Desktop. You can browse the Desktop by expanding the folders in the TreeView. Select a folder to show the subfolders and files in the ListView. Right click on an item in the ListView to get file properties. Right click in the free area of the ListView to print a list of item names. Double click or press Enter on an item in the ListView to open a file or execute a program. With AutoItObject a folder doesn't have to be a file system folder. It can be any folder in the Desktop e.g. the Control Panel. The Desktop in this case means the root of the Shell's namespace. To enumerate a folder using AutoItObject you use code like this: ; The address that receives an IShellFolder Interface pointer $pParentFolder = GetParentFolder( ... ) ; Create an IDispatch-Object for the IShellFolder Interface $IShellFolder = _AutoItObject_WrapperCreate( $pParentFolder, $dtagIShellFolder ) ; The address that receives an IEnumIDList interface pointer of the enumeration object $aRet = $IShellFolder.EnumObjects( $NULL, BitOR( $SHCONTF_FOLDERS, $SHCONTF_INCLUDEHIDDEN ), 0 ) If $aRet[0] = $S_OK Then $pIEnumIDList = $aRet[3] ; Create an IDispatch-Object for the IEnumIDList Interface $IEnumIDList = _AutoItObject_WrapperCreate( $pIEnumIDList, $dtagIEnumIDList ) ; Enumerate the folders $aRet = $IEnumIDList.Next( 1, 0, 0 ) ; Param 1 [in] : Step value as in a For-loop While $aRet[3] ; Param 2 [out]: PIDL relative to parent folder $iFolders += 1 ; Param 3 [out]: 0 if no more PIDLs, 1 else ... ... ... $aRet = $IEnumIDList.Next( 1, 0, 0 ) WEnd EndIf Enumeration of a folder in this way uses PIDLs (pointers to ITEMIDLIST structures) in stead of file and folder names. See http://msdn.microsoft.com/en-us/library/windows/desktop/cc144090(v=vs.85).aspx. The zipfile below contains a number of files: EnumDesktopConsts.au3 - definitions and declarationsEnumDesktopFuncs.au3 - functions for the enumerationsEnumDesktopGUI.au3 - the GUI, run this fileFunctions.au3 - different functionsGetIcon.au3 - icon functionsWindows.au3 - child windows for options and infoStringSize.au3 - by Melba23, see http://www.autoitscript.com/forum/index.php?showtopic=114034HourglassOff.au3 - turn hourglass off, see belowres\ - 4 icons and WSP.dll by Yashied, see http://www.autoitscript.com/forum/index.php?showtopic=83621 post #16WSP.dll is used for NM_RETURN notifications in the ListView. The central file in the example is EnumDesktopFuncs.au3. The most important functions in the file are GetParentFolder() - returns an IShellFolder Interface pointer to the parent folderEnumTreeViewObjects() - expands the folders of the parent folder in the TreeViewEnumListViewObjects() - shows the folders and files in the ListView for the parent folderInvokeCommand() - opens a file or runs a program when an item in the ListView is activatedYou need AutoItObject by the AutoItObject team and APIConstants.au3 and WinAPIEx.au3 version 3.6 or 3.7 by Yashied. If the script fails for some reason and you are left with an hourglass cursor, then run HourglassOff.au3 to get the normal cursor back. Run EnumDesktopGUI.au3 in the zipfile. Testet on XP SP3. The zip-files can be opened with 7-Zip. 2012-04-19: Implemented with AutoItObject EnumDesktop.zip Update #2 2012-08-20: Implemented with ObjCreateInterface() (no need for AutoItObject, not included) EnumDesktop.zip EnumDesktop.zip1 point
-
x64 Added! Tested and this worked too! #include <Array.au3> #include <WinAPI.au3> Local $aArray = _JavaVersion() _ArrayDisplay($aArray) Func _JavaVersion() Local $sCurrentVersion = RegRead('HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment', 'CurrentVersion') Local $aReturn[3] = [RegRead('HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment', 'Java7FamilyVersion'), _ RegRead('HKEY_LOCAL_MACHINESoftwareJavaSoftJava Runtime Environment' & $sCurrentVersion, 'JavaHome')] $aReturn[2] = StringRegExpReplace(_WinAPI_ExpandEnvironmentStrings(RegRead('HKEY_LOCAL_MACHINESoftwareClassesJNLPFileShellOpenCommand', '')), '.*?"((?:[^"/]+[/])+([^"/]+))".*', '1') Return $aReturn EndFunc ;==>_JavaVersion1 point