Leaderboard
Popular Content
Showing content with the highest reputation on 03/23/2017 in all areas
-
Or you could modify the LDAP query so it only returns records where displayname<>""2 points
-
Need Help
Xandy reacted to AlexFing17 for a topic
hello I am totally new to autoIt. But i have a project to finish . My group and I have to create program that will automate Task. We have to create a program will functions like schedule pc to turn off at specific time, creates a folder and move files from one for to it, delete a file from a specific, play all music in a folder. We are have all this functions coded. But the problem here is that. The main program has to be a program that user will select what they want to be automated and the click on generate to generate an exe file that would automate spefic functions that was selected from the main program. So if i should select functions like ( play music, shutdown after 4 hours, create folder and move files from specific folder to it) from the main gui of the main program and then click on generate. The main program has to generate an exe file with the select functions only. How can i do that please. I really need help. Thank you.1 point -
1 point
-
possibly, its coming up with an error when reading the lines in the FileReadLine. Try put an "if @error then return: or maybe in the _shuffle func put "If IsArray($aIn) then" or something like that.1 point
-
Hey AutoIT scripters, I found a neat little application I wanted to share with you. SpyEx is a tool which enumerates all of the Windows for each process running on computer, gives you a detailed DOM structure of any open IE windows, Enumerate UI Automation and Active Accessibility tree, and "Spy" on a window to see a list of the windows messages and their parameters that it receives in real time. All from within a single, portable executable. The developer has also made some other interesting tools as well, so I would highly recommend checking them out.1 point
-
While I can understand your caution, one of the tools located on the Website (compton HD benchmark tool) is used in (and actually displayed on the product's download page) one of Eli the Computer Guy's educational videos. I can assure you, as long as you are using the tools correctly, no harm done.1 point
-
Here is the _AD_GetObjectsInOU with the proper LDAP query that should get you what you need. As mentioned by water. This query only finds user accounts, and not computer accounts. $aUserInfo = _AD_GetObjectsInOU($aNames[$i], "(&(objectCategory=Person)(objectclass=user)(displayName=*))", "", "displayName,distinguishedName") Here is some info on using LDAP Queries. Adam1 point
-
Hi @taylansan, I think you could analyze the html of the page, but maybe the quickest way is the search one by one. P.S. Some time ago I wrote a function to extract tables from raw html (without the need to make use of a browser), and to test it I also wrote an example script that allows to browse all tables in an html page, If you want to test it below there is the link, you have to use the second script (the example script), from that script you can enter the link of your page. It show all the tables in the page and allows you to visually chose the tables one by one. maybe it can be of use to search your wanted table:1 point
-
Issues with Select Case and ContinueCase
albertocastillo2001 reacted to Melba23 for a topic
albertocastillo2001, My pleasure as always. M231 point -
There are better ways using regular expressions but this is a possible method to grab what you are after with loops and arrays, you can assign the variables from the last array at the end: include <Array.au3> $string="P:4 |G: 1.2.0| L : 77770 |N: 0866746526" $varArray=StringSplit($string,"|") _ArrayDisplay($varArray); before any cleansing for $a=0 to UBound($varArray)-1 $varArray[$a]=StringStripWS($varArray[$a],8) $varArray[$a]=StringTrimLeft($varArray[$a],2) Next _ArrayDisplay($varArray); this one shows you the data to assign1 point
-
Hello. Nice find Larsj I think it's no hard to traslate to AutoIt Maybe I'll do later. (I'm busy right now.) Also Here is the 39#'s Stack Object Example. ;~ #AutoIt3Wrapper_UseX64=y #include <Memory.au3> Global Const $S_OK = 0 Global Const $sTag_CLRMetaHost = _ "GetRuntime hresult(wstr;struct*;ptr);" & _ "GetVersionFromFile hresult(ptr;ptr;ptr);" & _ "EnumerateInstalledRuntimes hresult(ptr);" & _ "EnumerateLoadedRuntimes hresult(ptr;ptr);" & _ "RequestRuntimeLoadedNotification hresult(ptr,ptr,ptr):" & _ "QueryLegacyV2RuntimeBinding hresult(ptr;ptr);" & _ "ExitProcess hresult(int);" Global Const $sTag_CLRRuntimeInfo = _ "GetVersionString hresult(ptr;ptr);" & _ "GetRuntimeDirectory hresult(ptr;ptr);" & _ "IsLoaded hresult(ptr;ptr);" & _ "LoadErrorString hresult(ptr;ptr;ptr;ptr);" & _ "LoadLibrary hresult(ptr;ptr);" & _ "GetProcAddress hresult(ptr;ptr);" & _ "GetInterface hresult(ptr;ptr;ptr);" & _ "IsLoadable hresult(Bool*);" & _ "SetDefaultStartupFlags hresult(ptr;ptr);" & _ "GetDefaultStartupFlags hresult(ptr;ptr;ptr);" & _ "BindAsLegacyV2Runtime hresult();" & _ "IsStarted hresult(ptr;ptr);" Global Const $sTag_CLRRuntimeHost = _ "Start hresult();" & _ "Stop hresult();" & _ "SetHostControl hresult(ptr);" & _ "GetCLRControl hresult(ptr*);" & _ "UnloadAppDomain hresult(ptr;ptr);" & _ "ExecuteInAppDomain hresult(ptr;ptr;ptr);" & _ "GetCurrentAppDomainId hresult(ptr);" & _ "ExecuteApplication hresult(ptr;ptr;ptr;ptr;ptr;ptr);" & _ "ExecuteInDefaultAppDomain hresult(wstr;wstr;wstr;wstr;ptr*);" Global Const $sIID_AppDomain = "{05F696DC-2B29-3663-AD8B-C4389CF2A713}" Global Const $sTag_AppDomain = _ "GetTypeInfoCount hresult();" & _ "GetTypeInfo hresult();" & _ "GetIDsOfNames hresult();" & _ "Invoke hresult();" & _ "get_ToString hresult();" & _ "Equals hresult();" & _ "GetHashCode hresult();" & _ "GetType hresult();" & _ "InitializeLifetimeService hresult();" & _ "GetLifetimeService hresult();" & _ "get_Evidence hresult();" & _ "add_DomainUnload hresult();" & _ "remove_DomainUnload hresult();" & _ "add_AssemblyLoad hresult();" & _ "remove_AssemblyLoad hresult();" & _ "add_ProcessExit hresult();" & _ "remove_ProcessExit hresult();" & _ "add_TypeResolve hresult();" & _ "remove_TypeResolve hresult();" & _ "add_ResourceResolve hresult();" & _ "remove_ResourceResolve hresult();" & _ "add_AssemblyResolve hresult();" & _ "remove_AssemblyResolve hresult();" & _ "add_UnhandledException hresult();" & _ "remove_UnhandledException hresult();" & _ "DefineDynamicAssembly hresult();" & _ "DefineDynamicAssembly_2 hresult();" & _ "DefineDynamicAssembly_3 hresult();" & _ "DefineDynamicAssembly_4 hresult();" & _ "DefineDynamicAssembly_5 hresult();" & _ "DefineDynamicAssembly_6 hresult();" & _ "DefineDynamicAssembly_7 hresult();" & _ "DefineDynamicAssembly_8 hresult();" & _ "DefineDynamicAssembly_9 hresult();" & _ "CreateInstance hresult(bstr;bstr;object*);" & _ "CreateInstanceFrom hresult();" & _ "CreateInstance_2 hresult();" & _ "CreateInstanceFrom_2 hresult();" & _ "CreateInstance_3 hresult();" & _ "CreateInstanceFrom_3 hresult();" & _ "Load hresult();" & _ "Load_2 hresult();" & _ "Load_3 hresult();" & _ "Load_4 hresult();" & _ "Load_5 hresult();" & _ "Load_6 hresult();" & _ "Load_7 hresult();" & _ "ExecuteAssembly hresult();" & _ "ExecuteAssembly_2 hresult();" & _ "ExecuteAssembly_3 hresult();" & _ "get_FriendlyName hresult();" & _ "get_BaseDirectory hresult();" & _ "get_RelativeSearchPath hresult();" & _ "get_ShadowCopyFiles hresult();" & _ "GetAssemblies hresult();" & _ "AppendPrivatePath hresult();" & _ "ClearPrivatePath ) = 0; hresult();" & _ "SetShadowCopyPath hresult();" & _ "ClearShadowCopyPath ) = 0; hresult();" & _ "SetCachePath hresult();" & _ "SetData hresult();" & _ "GetData hresult();" & _ "SetAppDomainPolicy hresult();" & _ "SetThreadPrincipal hresult();" & _ "SetPrincipalPolicy hresult();" & _ "DoCallBack hresult();" & _ "get_DynamicDirectory hresult();" Global Const $sTag_ICorRuntimeHost = _ "CreateLogicalThreadState hresult();" & _ "DeleteLogicalThreadState hresult();" & _ "SwitchInLogicalThreadState hresult();" & _ "SwitchOutLogicalThreadState hresult();" & _ "LocksHeldByLogicalThread hresult();" & _ "MapFile hresult();" & _ "GetConfiguration hresult();" & _ "Start hresult();" & _ "Stop hresult();" & _ "CreateDomain hresult();" & _ "GetDefaultDomain hresult(ptr*);" & _ "EnumDomains hresult();" & _ "NextDomain hresult();" & _ "CloseEnum hresult();" & _ "CreateDomainEx hresult();" & _ "CreateDomainSetup hresult();" & _ "CreateEvidence hresult();" & _ "UnloadDomain hresult();" & _ "CurrentDomain hresult();" Global Const $sCLSID_CLRMetaHost = "{9280188d-0e8e-4867-b30c-7fa83884e8de}" Global Const $sIID_ICLRMetaHost = "{d332db9e-b9b3-4125-8207-a14884f53216}" Global Const $sIID_ICLRRuntimeInfo = "{BD39D1D2-BA2F-486a-89B0-B4B0CB466891}" Global Const $sCLSID_CLRRuntimeHost = "{90F1A06E-7712-4762-86B5-7A5EBA6BDB02}" Global Const $sIID_ICLRRuntimeHost = "{90F1A06C-7712-4762-86B5-7A5EBA6BDB02}" Global $tCLSID_CLRMetaHost = _WinAPI_CLSIDFromString($sCLSID_CLRMetaHost) Global $tIID_ICLRMetaHost = _WinAPI_CLSIDFromString($sIID_ICLRMetaHost) Global $tIID_ICLRRuntimeInfo = _WinAPI_CLSIDFromString($sIID_ICLRRuntimeInfo) Global $tCLSID_CLRRuntimeHost = _WinAPI_CLSIDFromString($sCLSID_CLRRuntimeHost) Global $tIID_ICLRRuntimeHost = _WinAPI_CLSIDFromString($sIID_ICLRRuntimeHost) Global Const $sCLSID_CorRuntimeHost = "{CB2F6723-AB3A-11D2-9C40-00C04FA30A3E}" Global Const $sIID_ICorRuntimeHost = "{CB2F6722-AB3A-11D2-9C40-00C04FA30A3E}" Global $tCLSID_CorRuntimeHost = _WinAPI_CLSIDFromString($sCLSID_CorRuntimeHost) Global $tIID_ICorRuntimeHost = _WinAPI_CLSIDFromString($sIID_ICorRuntimeHost) Local $hMSCorEE = DllOpen("MSCorEE.DLL") Local $aRet = DllCall($hMSCorEE, "long", "CLRCreateInstance", "struct*", $tCLSID_CLRMetaHost, "struct*", $tIID_ICLRMetaHost, "ptr*", 0) If $aRet[0] = $S_OK Then Local $pClrHost = $aRet[3] Local $oClrHost = ObjCreateInterface($pClrHost, $sIID_ICLRMetaHost, $sTag_CLRMetaHost) ConsoleWrite(">oClrHost: " & IsObj($oClrHost) & @CRLF) Local $sNETFrameworkVersion = "v4.0.30319" Local $tCLRRuntimeInfo = DllStructCreate("ptr") $oClrHost.GetRuntime($sNETFrameworkVersion, $tIID_ICLRRuntimeInfo, DllStructGetPtr($tCLRRuntimeInfo)) Local $pCLRRuntimeInfo = DllStructGetData($tCLRRuntimeInfo, 1) ConsoleWrite(">pCLRRuntimeInfo: " & $pCLRRuntimeInfo & @CRLF) Local $oCLRRuntimeInfo = ObjCreateInterface($pCLRRuntimeInfo, $sIID_ICLRRuntimeInfo, $sTag_CLRRuntimeInfo) ConsoleWrite(">oCLRRuntimeInfo: " & IsObj($oCLRRuntimeInfo) & @CRLF) Local $isIsLoadable = 0 $oCLRRuntimeInfo.IsLoadable($isIsLoadable) ConsoleWrite(">IsLoadable: " & $isIsLoadable & @CRLF) If $isIsLoadable Then Local $tCLRRuntimeHost = DllStructCreate("ptr") $oCLRRuntimeInfo.GetInterface(DllStructGetPtr($tCLSID_CLRRuntimeHost), DllStructGetPtr($tIID_ICLRRuntimeHost), DllStructGetPtr($tCLRRuntimeHost)) Local $pCLRRuntimeHost = DllStructGetData($tCLRRuntimeHost, 1) ConsoleWrite(">pCLRRuntimeHost: " & $pCLRRuntimeHost & @CRLF) Local $oCLRRuntimeHost = ObjCreateInterface($pCLRRuntimeHost, $sIID_ICLRRuntimeHost, $sTag_CLRRuntimeHost) ConsoleWrite(">oCLRRuntimeHost: " & IsObj($oCLRRuntimeHost) & @CRLF) Local $iRet = 0 $oCLRRuntimeHost.Start() ;$oCLRRuntimeHost.ExecuteInDefaultAppDomain(@ScriptDir & "\C#Library.dll", "ClassLibraryDemo.ClassDemo", "NetMsgBox", "AutoIt Rocks!!! " & @CRLF & "Danyfirex does too lol!!!", $iRet) ;ConsoleWrite(">Ret: " & $iRet & @CRLF) Local $tCorRuntimeHost = DllStructCreate("ptr") $oCLRRuntimeInfo.GetInterface(DllStructGetPtr($tCLSID_CorRuntimeHost), DllStructGetPtr($tIID_ICorRuntimeHost), DllStructGetPtr($tCorRuntimeHost)) Local $pCorRuntimeHost = DllStructGetData($tCorRuntimeHost, 1) ;~ ConsoleWrite("$pCorRuntimeHost = " & $pCorRuntimeHost & @CRLF) Local $oCorRuntimeHost = ObjCreateInterface($pCorRuntimeHost, $sIID_ICorRuntimeHost, $sTag_ICorRuntimeHost) ConsoleWrite("IsObj( $oCorRuntimeHost ) = " & IsObj($oCorRuntimeHost) & @CRLF) $oCorRuntimeHost.Start() Local $pAppDomain = 0 $oCorRuntimeHost.GetDefaultDomain($pAppDomain) ConsoleWrite("$pAppDomain = " & Ptr($pAppDomain) & @CRLF) Local $oAppDomain = ObjCreateInterface($pAppDomain, $sIID_AppDomain, $sTag_AppDomain) ConsoleWrite("IsObj( $oAppDomain ) = " & IsObj($oAppDomain) & @CRLF) Local $oObject = 0 $oAppDomain.CreateInstance("mscorlib", "System.Collections.Stack", $oObject) ConsoleWrite("IsObj($oObject): " & IsObj($oObject) & @CRLF) Local $oStack = $oObject.Unwrap If IsObj($oStack) Then ConsoleWrite("IsObj($oStack): " & IsObj($oStack) & @CRLF) $oStack.Push("+Bye Bye!!! ^.^") $oStack.Push("+I'm a Stack Object!!!") $oStack.Push("+AutoIt Rocks!!!") ConsoleWrite($oStack.Pop & @CRLF) ConsoleWrite($oStack.Pop & @CRLF) ConsoleWrite($oStack.Pop & @CRLF) $oStack = 0 EndIf EndIf EndIf DllClose($hMSCorEE) ;free Func _WinAPI_CLSIDFromString($sGUID) $tGUID = DllStructCreate('ulong Data1;ushort Data2;ushort Data3;byte Data4[8]') $iRet = DllCall('ole32.dll', 'uint', 'CLSIDFromString', 'wstr', $sGUID, 'ptr', DllStructGetPtr($tGUID)) If (@error) Or ($iRet[0]) Then Return SetError(@error, @extended, 0) EndIf Return $tGUID EndFunc ;==>_WinAPI_CLSIDFromString Updated. Saludos1 point
-
Where should I fly to? Seriously: One difference could be the fact that the FileSelectFolder() function will also change the workdir to the selected path. Jos1 point
-
Thank to: https://commandwindows.com/assoc.htm The solution is to add " %1" to the 5th line of the association script: FileExtAssoc("tcr0", "C:\Users\HP\Desktop\crypt\cryptIt.exe") Func FileExtAssoc($sExt, $sApplication) RunWait(@COMSPEC & " /c ASSOC ." & $sExt & "=ExTest", "", @SW_HIDE) RunWait(@COMSPEC & " /c FTYPE ExTest=" & $sApplication & ' "%1"', "", @SW_HIDE) MsgBox(0,"File Extension Application Association",'"' & $sExt & '"is now asscoiated with "' & $sApplication & '"',3) EndFunc1 point
-
AlexFing17, Welcome to the AutoIt forums. Wow - as a first task in AutoIt you have chosen a really difficult one! However, I can certainly confirm that it is not an impossible one, You say that you have created the individual functions for each of the tasks - a great start. As I understand it you now need some form of GUI where the user can select which of these functions to run - I would suggest an array of Checkbox controls which you can read to indicate the functions required. That should not be too difficult to code - look at GUICtrlCreateCheckbox in the Help file to see how it is done. But the production of an executable including the required functions is the tricky bit. I produced an example script some time ago which showed how you can do something like this by creating an .au3 script "on the fly" and then compiling it. Although not precisely what you are looking for, the script shows the various steps required and merits a close look to see how I managed to do it. Have a go at producing something with your group and by all means come back if you run into problems. M231 point
-
Have you looked at the macros? @IPAddress1, @IPAddress2 etc... You could also use: TCPStartup() $sComputer = TCPNameToIP(@ComputerName) TCPShutdown() MsgBox(64, "Local Computer Ip Address", @ComputerName & " IP Address " & $sComputer)1 point
-
Another method: #include <IE.au3> $oIE = _IECreate("https://www.supermakler.pkobp.pl/plus/demo/", 1) $oDivs1 = _IETagNameGetCollection($oIE, "Div") For $oDiv1 In $oDivs1 If StringInStr($oDiv1.id, "x-auto-") Then If StringStripWS($oDiv1.innertext, 8) = "Zlecenia" Then $oDivs2 = _IETagNameGetCollection($oDiv1, "Div") For $oDiv2 In $oDivs2 If StringStripWS($oDiv2.ClassName, 7) = "x-nodrag x-tool-refresh x-tool epm-toolButton x-component" Then _IEAction($oDiv2, "Click") EndIf Next EndIf EndIf Next1 point
-
Listview scroll event?
pixelsearch reacted to LarsJ for a topic
GUIRegisterMsg is able to catch messages which are send to the GUI. The scrollbars are child windows of the listview. WM_VSCROLL messages are always send to the parent window. In this case the listview. The GUI will never receive the messages and GUIRegisterMsg cannot catch them. You can catch the messages by subclassing the listview: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <WinAPIShellEx.au3> Global $iFire = 0 $Form1 = GUICreate("Form1", 374, 217, 219, 155) $ListView = GUICtrlCreateListView("A", 8, 8, 354, 206) $hListView = GUICtrlGetHandle($ListView) GUICtrlSendMsg(-1, $LVM_SETCOLUMNWIDTH, 0, 50) For $i = 0 To 100 GUICtrlCreateListViewItem("a", $ListView) Next GUISetState(@SW_SHOW) GUIRegisterMsg($WM_VSCROLL, "WM_VSCROLL") GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") $pListViewCallback = DllCallbackGetPtr( DllCallbackRegister( "ListViewCallback", "lresult", "hwnd;uint;wparam;lparam;uint_ptr;dword_ptr" ) ) _WinAPI_SetWindowSubclass( $hListView, $pListViewCallback, 9999, 0 ) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd _WinAPI_RemoveWindowSubclass( $hListView, $pListViewCallback, 9999 ) Func ListViewCallback( $hWnd, $iMsg, $wParam, $lParam, $iSubclassId, $pData ) Switch $iMsg Case $WM_VSCROLL ConsoleWrite("ListViewCallback WM_VSCROLL" & @CRLF) EndSwitch ; Call next function in subclass chain Return DllCall( "comctl32.dll", "lresult", "DefSubclassProc", "hwnd", $hWnd, "uint", $iMsg, "wparam", $wParam, "lparam", $lParam )[0] #forceref $iSubclassId, $pData EndFunc Func WM_VSCROLL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam ConsoleWrite("WM_VSCROLL" & @CRLF) Return $GUI_RUNDEFMSG EndFunc ;==>WM_EXITSIZEMOVE Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hListView Switch $iCode Case $LVN_BEGINSCROLL $iFire += 1 ConsoleWrite("LVN_BEGINSCROLL " & $iFire & @CRLF) Case $LVN_ENDSCROLL $iFire += 1 ConsoleWrite("LVN_ENDSCROLL " & $iFire & @CRLF) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY1 point -
Here is a simple function to return either an array sorted on the FT.. Flags or Filename #include <Array.au3> #include <File.au3> Local $sLatestFileCreated = _FileVersion(@MyDocumentsDir, "*.xlsx", 1, False) MsgBox(64, "Latest Created File Version", $sLatestFileCreated) Local $aLatestFileCreated = _FileVersion(@MyDocumentsDir, "*.xlsx", 1, True) _ArrayDisplay($aLatestFileCreated) ; #FUNCTION# ==================================================================================================================== ; Name ..........: _FileVersion ; Description ...: ; Syntax ........: _FileVersion($sFilePath[, $sMask = "*.*"[, $iFlag = 0[, $bFormat = True]]]) ; Parameters ....: $sFilePath - Folder Path to Search ; $sMask - [optional] File Mask. Default is "*.*". ; $iFlag - [optional] Flag to indicate which timestamp ; - $FT_MODIFIED (0) = Last modified (default) ; - $FT_CREATED (1) = Created ; - $FT_ACCESSED (2) = Last accessed ; $bFormat - [optional] To specify type of return ; - True = Retrun an Array (default) ; - False = Return latest Filename for iFlag Type ; Return values .: An array or string ; Author ........: Subz ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func _FileVersion($sFilePath, $sMask = "*.*", $iFlag = 0, $bFormat = True) Local $aFileList = _FileListToArrayRec($sFilePath, $sMask, 1, 0, 0, 2) If @error Then Return 0 Local $aFileVersion[0][4] _ArrayAdd($aFileVersion, UBound($aFileList) - 1 & "|Modified|Created|Accessed") For $i = 1 to $aFileList[0] _ArrayAdd($aFileVersion, $aFileList[$i] & "|" & FileGetTime($aFileList[$i], 0, 1) & "|" & FileGetTime($aFileList[$i], 1, 1) & "|" & FileGetTime($aFileList[$i], 2, 1)) Next Switch $iFlag Case 1 _ArraySort($aFileVersion, 1, 1, 0, 2) Case 2 _ArraySort($aFileVersion, 1, 1, 0, 3) Case Else _ArraySort($aFileVersion, 1, 1, 0, 1) EndSwitch Return $bFormat = True ? $aFileVersion : $aFileVersion[1][0] EndFunc1 point
-
Issues with Select Case and ContinueCase
albertocastillo2001 reacted to Melba23 for a topic
albertocastillo2001, Welcome to the AutoIt forums. As this is not possible, you will have to use another way - this could well be a possibility (untested) Func _mapFTM() _easyMap("K:", "\\Location\Public") _easyMap("P:", "\\Location\Users\" & @UserName) ; Now check each group in turn For $i = 1 To 3 ; If the user is in the group If _inGroup("group" & $i, @UserName) Then ; Act accordingly Switch $i Case 1 _easyMap("M:", "\\Location\Primedia") _easyMap("X:", "\\Location\Course Management System 4.0") Case 2 _easyMap("S:", "\\Location\example1") Case 3 _easyMap("Z:", "\\Location\Example2") EndSwitch EndIf Next EndFunc Now you test the user against all groups. M231 point -
Hi all, A couple of recent threads have brought up the idea of an AutoIt script compiling another script from within itself - in both cases I mentioned that I had done such a thing as a coding exercise in the past. I thought it might be useful to show how such a thing could be done - so I went back to my old code (it was actually the first large script I ever wrote in AutoIt back in 2008 ) and updated it for the current release. The idea for WrapIt came from theWRAP - I found this app very useful as I was dabbling in JBasic at the time and was getting annoyed with all the run-time and image files that were needed to get the code to run. The idea of packing them all into a single executable which would expand them, run one of the expanded executables, and then delete all the files again seemed a good solution. However, as the author of theWRAP had left us the only available (unregistered) version was very limited in the number of files it could wrap. I was also investigating AutoIt at that time (you can guess which one I adopted long term! ) and realised that I could do the same sort of thing using FileInstall and Run. And so here is my version - WrapIt. The zip contains the following: WrapIt.au3 - the script WrapIt.ico - an icon for the executable when compiled WrapIt_Default.ico - a default icon for the wrapped executable WrapIt.chm - a help file There are also 3 of my UDFs which I have now incorporated into the script (replacing some very clunky code from 2008! ) GUIExtender.au3, ChooseFileFolder.au3, RecFileListToArray.au3 And here it is: WrapIt.zip Just unzip them all into a folder and have a play. You will need to set the correct path for your own versions of Aut2Exe.exe, AutoItSC.bin, and upx.exe in the FileInstall string literals at lines #252, #253 and #256 - you do not need to compile the script for it to work. As I only did this as a coding exercise (and no longer use JBasic so no longer need the capability) I am not really interested in maintaining the script. However, comments on how it might be improved are always welcome - it is never too late to learn. M231 point
-
Somehow parts of your code look familiar to me.... Br, UEZ1 point
-
Another example. #include <Array.au3> local $MyArray[100][6] = [["A", "B", "C", "D", "E", "F"], _ ["A", "B", "C", "D", "E", "XXX"], _ ["A", "B", "C", "D", "E", "F"], _ ["A", "B", "C", "QQ", "E", "F"], _ ["1", "2", "3", "4", "5", "6"], _ ["A", "B", "C", "D", "E", "XXX"]] ;etc.. Local $aDuplicatelessArray = _ArrayRemoveDuplicateRows($MyArray) _ArrayDisplay($aDuplicatelessArray) Func _ArrayRemoveDuplicateRows($MyArray) Local $sString, $sNoDupStr = "", $iCount = 0 Local $aNoDupsArray[UBound($MyArray, 1)][UBound($MyArray, 2)] For $i = 0 To UBound($MyArray) - 1 $sString = $MyArray[$i][0] & $MyArray[$i][1] & $MyArray[$i][2] & _ $MyArray[$i][3] & $MyArray[$i][4] & $MyArray[$i][5] & @CRLF If StringInStr($sNoDupStr, $sString) = 0 Then ; Check if $sString is in $sNoDupStr string $sNoDupStr &= $sString & @CRLF ; Update $sNoDupStr string $aNoDupsArray[$iCount][0] = $MyArray[$i][0] $aNoDupsArray[$iCount][1] = $MyArray[$i][1] $aNoDupsArray[$iCount][2] = $MyArray[$i][2] $aNoDupsArray[$iCount][3] = $MyArray[$i][3] $aNoDupsArray[$iCount][4] = $MyArray[$i][4] $aNoDupsArray[$iCount][5] = $MyArray[$i][5] $iCount += 1 EndIf Next ReDim $aNoDupsArray[$iCount][UBound($MyArray, 2)] Return $aNoDupsArray EndFunc ;==>_ArrayRemoveDuplicateRows1 point