Leaderboard
Popular Content
Showing content with the highest reputation on 10/28/2014 in all areas
-
Thanks a lot for the links but this kind of problem has already been solved I referred to functions such as _AD_SetAccountExpire and the different date/time formats they accept.1 point
-
That's what I call a quick fix.1 point
-
Opt("TrayIconDebug", 1), add that to the top of the script, and when you hover over the tray icon it will tell you what line it's executing.1 point
-
Active Directory UDF
colombeen reacted to JLogan3o13 for a topic
I use something similar, and basically you simply need to split out the string and then convert appropriately. I do something like this: $aSplit = StringSplit(GUICtrlRead($myDate), ", ") ...and then convert each element to a variable (month, day, year). Then just plug that into your _AD_SetAccountExpire call. Edit: Didn't think about the international formats. You know we Americans think it's all about us1 point -
This UDF was originally written by ProgAndy, who gave up Windows, and thus AutoIt, in favor of Linux. Apparently he was well liked and respected for his capabilities, and will be missed. I have been playing with this UDF and modifying it a bit for my own use and i wanted to post the code (permission was granted from ProgAndy after i finally managed to reach him). The original code is still available at progandy.de and is also added here as an attachment. My modified version is attached. You will need the ProgAndy version for the dll code and examples. I think this is a really cool project that could be useful to many, so it would be nice if we could work on it and improve it. I'm not very knowledgeable regarding the depths of AutoIt capabilities, and am especially weak in anything having to do with DLL's. I will post a complete example with a GUI in the near future, but for now, here is my modified UDF... #include-once ; #INDEX# ======================================================================================================================= ; Title .........: Hunspell Hypenate MyThes ; Description ...: This module contains various functions to call Hunspell, Hyphenate and MyThes ; Author ........: Prog@ndy http://progandy.co.cc/downloads/view.download/12 ; Licence .......: The DLLs are open source, taken from the NHunspell project (http://nhunspell.sf.net) ; NHunspell is licenced under: GPL/LGPL/MPL. ; Free use in commercial applications is permittet according to the LGPL and MPL licenses. ; Your commercial application can link against the NHunspell DLLs. ; =============================================================================================================================== OnAutoItExitRegister("__Spell_Shutdown") ; =============================================================================================================================== ; GLOBAL VARIABLES ; =============================================================================================================================== Global $hHunspellDll = -1, $hHunspell = -1 ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_Spell_HunspellAdd ;_Spell_HunspellAddWithAffix ;_Spell_HunspellAnalyze ;_Spell_HunspellFree ;_Spell_HunspellGenerate ;_Spell_HunspellInit ;_Spell_HunspellSpell ;_Spell_HunspellStem ;_Spell_HunspellSuggest ;_Spell_HyphenFree ;_Spell_HyphenHyphenate ;_Spell_HyphenInit ;_Spell_MyThesFree ;_Spell_MyThesInit ;_Spell_MyThesLookup ;_Spell_Startup ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ;__Spell_PtrStringReadW ;__Spell_HunspellReadStringArray ;__Spell_MyThesReadMarshalBuffer ;__Spell_MyThesReadMeaningBuffer ;__Spell_Shutdown ; =============================================================================================================================== ; #ORIGINAL_CALLCONV#============================================================================================================ ; definitions taken from sourcefile: /trunk/Hunspell/HunspellExportFunctions.cpp ; Link: http://nhunspell.svn.sourceforge.net/viewvc/nhunspell/trunk/Hunspell/ ; ; #define DLLEXPORT extern "C" _declspec( dllexport ) ==> CDECL ! ; ; DLLEXPORT NHunspell * HunspellInit(wchar_t * aff_file, wchar_t *dict_file, wchar_t * key) ; DLLEXPORT void HunspellFree(NHunspell * handle ) ; DLLEXPORT bool HunspellAdd(NHunspell * handle, wchar_t * word ) ; DLLEXPORT bool HunspellAddWithAffix(NHunspell * handle, wchar_t * word, wchar_t * affix ) ; DLLEXPORT bool HunspellSpell(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellSuggest(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellAnalyze(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellStem(NHunspell * handle, wchar_t * word ) ; DLLEXPORT void * HunspellGenerate(NHunspell * handle, wchar_t * word, wchar_t * word2 ) ; ; DLLEXPORT void * HyphenInit(wchar_t * dict_file) ; DLLEXPORT void HyphenFree(NHyphen * handle ) ; DLLEXPORT void * HyphenHyphenate(NHyphen * handle, wchar_t * word ) ; ; DLLEXPORT void * MyThesInit(wchar_t * idx_file, wchar_t * dat_file) ; DLLEXPORT void MyThesFree(NMyThes * handle ) ; DLLEXPORT void * MyThesLookup(NMyThes * handle, wchar_t * word ) ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAdd ; Description ...: add word to the run-time dictionary ; Syntax.........: _Spell_HunspellAdd($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to add ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellAddWithAffix ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAdd($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellAdd", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAddWithAffix ; Description ...: add word to the run-time dictionary with affix flags of the example (a dictionary word) ; Syntax.........: _Spell_HunspellAddWithAffix($hHunspell, $sWord, $sAffix) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to add ; $sAffix - Affix ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: Hunspell will recognize affixed forms of the new word, too. ; Related .......: _Spell_HunspellAdd ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAddWithAffix($hHunspell, $sWord, $sAffix) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellAddWithAffix", "ptr", $hHunspell, "wstr", $sWord, "wstr", $sAffix) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellAnalyze ; Description ...: morphological analysis of the word ; Syntax.........: _Spell_HunspellAnalyze($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to analyze ; Return values .: Success - array with analyzation result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellGenerate ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellAnalyze($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellAnalyze", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellFree ; Description ...: Frees memory associated with a Hunspell handle ; Syntax.........: _Spell_HunspellFree($hHunspell) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellFree($hHunspell) DllCall($hHunspellDll, "none:cdecl", "HunspellFree", "ptr", $hHunspell) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellGenerate ; Description ...: morphological generation by example(s) ; Syntax.........: _Spell_HunspellGenerate($hHunspell, $sWord, $sWord2) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - first word ; $sWord2 - second word ; Return values .: Success - array with result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellAnalyze ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellGenerate($hHunspell, $sWord, $sWord2) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellGenerate", "ptr", $hHunspell, "wstr", $sWord, "wstr", $sWord2) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2,0,0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellInit ; Description ...: Initializes Hunspell ; Syntax.........: _Spell_HunspellInit($sAff_file, $sDict_file, $sKey=0) ; Parameters ....: $sAff_file - Hunspell .aff-file ; $sDict_file - Hunspell .dict-file ; $sKey - [optional] a Key String ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellInit($sAff_file, $sDict_file, $sKey=0) Local $tpKey='ptr' If IsString($sKey) Then $tpKey='wstr' Local $aResult = DllCall($hHunspellDll, 'ptr:cdecl', 'HunspellInit', 'wstr', $sAff_file, 'wstr', $sDict_file, $tpKey, $sKey) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellSpell ; Description ...: Checks the spelling of the given word ; Syntax.........: _Spell_HunspellSpell($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the Word to check ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellSuggest ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellSpell($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "int:cdecl", "HunspellSpell", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellStem ; Description ...: stemmer function ; Syntax.........: _Spell_HunspellStem($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - the word to stem ; Return values .: Success - array with result ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func _Spell_HunspellStem($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellStem", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HunspellSuggest ; Description ...: Suggests alternatives for a misspelled word ; Syntax.........: _Spell_HunspellSuggest($hHunspell, $sWord) ; Parameters ....: $hHunspell - Hunspell handle returned from _Spell_HunspellInit ; $sWord - The word you want alternatives for ; Return values .: Success - Array with suggestions (0 based) ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: _Spell_HunspellSpell ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HunspellSuggest($hHunspell, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HunspellSuggest", "ptr", $hHunspell, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $aTemp = __Spell_HunspellReadStringArray($aResult[0]) If @error Then Return SetError(3, 0, 0) Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenFree ; Description ...: Frees memory associated with a Hyphen-handle ; Syntax.........: _Spell_HyphenFree($hHyphen) ; Parameters ....: $hHyphen - Hyphen-handle returned from _Spell_HyphenInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenFree($hHyphen) DllCall($hHunspellDll, "none:cdecl", "HyphenFree", "ptr", $hHyphen) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenHyphenate ; Description ...: Analyze a word for possible hyphenation ; Syntax.........: _Spell_HyphenHyphenate($hHyphen, $sWord) ; Parameters ....: $hHyphen - Hyphen-handle returned from _Spell_HyphenInit ; $sWord - Word to be analyzed ; Return values .: Success - Array with hyphenation result ; |$array[0] contains the siblings separated with = ; |$array[$i] is 0 if you can"t split the word after letter $i ; |$array[$i] is 1 if it is possible to split the word after letter $i ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenHyphenate($hHyphen, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HyphenHyphenate", "ptr", $hHyphen, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) If $aResult[0] = 0 Then Return SetError(2, 0, 0) Local $stHyphen = DllStructCreate("ptr;ptr;",$aResult[0]) Local $sTemp = __Spell_PtrStringReadW(DllStructGetData($stHyphen,1)) Local $iMax = StringLen($sWord), $iIndex Local $aTemp[$iMax+1] = [$sTemp] $stHyphen = DllStructCreate("byte[" & $iMax & "]",DllStructGetData($stHyphen,2)) If @error Then Return SetError(3, 0, 0) For $iIndex = 1 To $iMax $aTemp[$iIndex] = Mod(DllStructGetData($stHyphen,1,$iIndex),2) Next Return $aTemp EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_HyphenInit ; Description ...: Initializes a Hyphen-handle ; Syntax.........: _Spell_HyphenInit($sDict_file) ; Parameters ....: $sDict_file - Dictionary for hyphenation ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_HyphenInit($sDict_file) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "HyphenInit", "wstr", $sDict_file) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesFree ; Description ...: Frees memory associated with a MyThes handle ; Syntax.........: _Spell_MyThesFree($hMyThes) ; Parameters ....: $hMyThes - MyThes-handle returned from _Spell_MyThesInit ; Return values .: Failure - Sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesFree($hMyThes) DllCall($hHunspellDll, "none:cdecl", "MyThesFree", "ptr", $hMyThes) If @error Then Return SetError(1) EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesInit ; Description ...: Initializes a Thesaurus ; Syntax.........: _Spell_MyThesInit($sIdx_file, $sDat_file) ; Parameters ....: $sIdx_file - MyThes .idx-file ; $sDat_file - MyThes .dat-file ; Return values .: Success - 1 ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesInit($sIdx_file, $sDat_file) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "MyThesInit", "wstr", $sIdx_file, "wstr", $sDat_file) If @error Then Return SetError(1, 0, 0) Return $aResult[0] EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_MyThesLookup ; Description ...: Looks up the meanings and synonyms of a word ; Syntax.........: _Spell_MyThesLookup($hMyThes, $sWord) ; Parameters ....: $hMyThes - MyThes-handle returned from _Spell_MyThesInit ; $sWord - The word o analyze ; Return values .: Success - Array of Arrays: ; |$array[$i] - the entries for one meaning of the word ; |--> $subarray[0] - the description of the meaning ; |--> $subarray[$j] - synonyms for this meaning ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_MyThesLookup($hMyThes, $sWord) Local $aResult = DllCall($hHunspellDll, "ptr:cdecl", "MyThesLookup", "ptr", $hMyThes, "wstr", $sWord) If @error Then Return SetError(1, 0, 0) $aResult = __Spell_MyThesReadMarshalBuffer($aResult[0]) If @error Then Return SetError(2, 0, 0) Return $aResult EndFunc ; #FUNCTION# ==================================================================================================================== ; Name...........: _Spell_Startup ; Description ...: Loads the DLL containing Hunspell, Hyphen and Thesaurus (selects 32 or 64 bit automatically) ; Syntax.........: _Spell_Startup(directory path where dll can be found) ; Parameters ....: $sDLL - Hunspell.dll for 32 bit ; $sDLLx64 - Hunspell.dll for 64 bit ; Return values .: Success - 1 ; Failure - 0 and sets @error = 1 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: No Unload function included, AutoIt does it automatically on termination ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _Spell_Startup($sDir) If $hHunspellDll <> -1 Then Return 1 Local $sDLL = $sDir & "\Hunspell_x86.dll" If @AutoItX64 Then $sDLL = $sDir & "\Hunspell_x64.dll" $hHunspellDll = DllOpen($sDLL) If $hHunspellDll = -1 Then Return SetError(1, 0, 0) Return 1 EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_HunspellReadStringArray ; Description ...: Reads a zero-terminated array of pointers to wstrings (zero-terminated) ; Syntax.........: __Spell_HunspellReadStringArray($ptr) ; Parameters ....: $ptr - Pointer to array ; Return values .: Success - Array with read strings ; Failure - 0 ; Author ........: Prog@ndy, iCode ; Modified.......: 13-Jun-2014 ; Remarks .......: This function is used internally by _Spell_HunspellSuggest, _Spell_HunspellAnalyze, _Spell_HunspellStem, and _Spell_HunspellGenerate ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_HunspellReadStringArray($ptr) If $ptr = 0 Then Return SetError(1, 0, 0) Local $stPtr = DllStructCreate("ptr", $ptr) Local $asStrings[50], $iIndex = 0, $iMax = 49 While 1 $asStrings[$iIndex] = __Spell_PtrStringReadW(DllStructGetData($stPtr,1)) If @error = 1 Then ExitLoop $iIndex += 1 If $iIndex > $iMax Then $iMax += 50 ReDim $asStrings[$iMax+1] EndIf $stPtr = DllStructCreate("ptr", $ptr + DllStructGetSize($stPtr)*$iIndex) WEnd If $iIndex = 0 Then Return SetError(2, 0, 0) ReDim $asStrings[$iIndex] Return $asStrings EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_PtrStringReadW ; Description ...: Reads a zero-terminated wstrings from a pointer ; Syntax.........: __Spell_HunspellReadStringArray($ptr) ; Parameters ....: $ptr - Pointer to wstring ; Return values .: Success - read string ; Failure - empty string ("") ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by __Spell_HunspellReadStringArray, and __Spell_MyThesReadMeaningBuffer ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_PtrStringReadW($ptr) If $ptr = 0 Then Return SetError(1, 0 ,"") Local $aLen = DllCall("kernel32.dll", "int", "lstrlenW", "ptr", $ptr) If @error Or $aLen[0]=0 Then Return SetError(2, 0, "") Local $struct = DllStructCreate("wchar[" & ($aLen[0] + 1) & "]", $ptr) Return DllStructGetData($struct, 1) EndFunc ;==>__Spell_PtrStringReadW ; #INTERNAL_USE_ONLY# ==================================================================================================================== ; Name ..........: __Spell_Shutdown ; Description ...: close hunspell DLL ; Syntax ........: __Spell_Shutdown() ; Parameters ....: ; Return values .: None ; Author ........: iCode ; Modified ......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: No ; =============================================================================================================================== Func __Spell_Shutdown() If $hHunspellDll <> -1 Then DllClose($hHunspellDll) EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_MyThesReadMarshalBuffer ; Description ...: Reads the Marhal-Buffer for _Spell_MyThesLookup ; Syntax.........: __Spell_MyThesReadMarshalBuffer($pBuffer) ; Parameters ....: $pBuffer - Pointer to Marshal buffer ; Return values .: Success - Array of Arrays ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by _Spell_MyThesLookup ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_MyThesReadMarshalBuffer($pBuffer) Local $stPtr = DllStructCreate("int_ptr", $pBuffer) If @error Then Return SetError(1, 0, 0) Local $iCount = DllStructGetData($stPtr, 1) $stPtr = DllStructCreate("int_ptr;ptr[" & $iCount & "]", $pBuffer) Local $aMeanings[$iCount], $i For $i = 1 To $iCount $aMeanings[$i-1] = __Spell_MyThesReadMeaningBuffer(DllStructGetData($stPtr, 2, $i)) Next Return $aMeanings EndFunc ; #INTERNAL_USE_ONLY#============================================================================================================ ; Name...........: __Spell_MyThesReadMeaningBuffer ; Description ...: Helper to read the Marhal-Buffer for _Spell_MyThesLookup ; Syntax.........: __Spell_MyThesReadMeaningBuffer($pBuffer) ; Parameters ....: $pBuffer - Pointer to meaning-section in Marshal buffer ; Return values .: Success - Array of Strings ; Failure - 0 ; Author ........: Prog@ndy ; Modified.......: ; Remarks .......: This function is used internally by __Spell_MyThesReadMarshalBuffer ; Related .......: ; Link ..........; ; Example .......; ; =============================================================================================================================== Func __Spell_MyThesReadMeaningBuffer($pBuffer) Local $stPtr = DllStructCreate("int_ptr", $pBuffer) Local $iCount = DllStructGetData($stPtr,1) $stPtr = DllStructCreate("int_ptr;ptr;ptr[" & $iCount & "]", $pBuffer) Local $aSynonyms[$iCount+1], $i $aSynonyms[0] = __Spell_PtrStringReadW(DllStructGetData($stPtr, 2)) For $i = 1 To $iCount $aSynonyms[$i] = __Spell_PtrStringReadW(DllStructGetData($stPtr, 3, $i)) Next Return $aSynonyms EndFunc hunspell-0.9.2-ProgAndy.zip Hunspell_iCode_13_JUN_2014.zip1 point
-
Login script using AD group membership
Registered reacted to jazzyjeff for a topic
Hey Everyone, I'm having some issues getting this script to work. The goal is to scan for any mapped drives, and if they exist then the script will delete them. Once the network drives are removed, the script continues and is supposed to map drives based on the Active Directory group membership. Here is what I have: #include <constants.au3> #include <adfunctions.au3> Global $strHostServer = $objRootDSE.Get ("willowhilldc") ; Retrieve the name of the connected DC DriveMapDel ("H:") DriveMapDel ("M:") DriveMapDel ("N:") DriveMapDel ("O:") DriveMapDel ("S:") DriveMapDel ("T:") DriveMapDel ("W:") DriveMapDel ("X:") DriveMapDel ("Y:") Func _ADIsMemberOf($group, $user) $ObjGroup = ObjGet("LDAP://" & $strHostServer & "/" & $group) $ismember = $objGroup.IsMember ("LDAP://" & $strHostServer & "/" & $user) $ObjGroup = 0 Return -$ismember If $group = "Domain Admins" Then DriveMapAdd ("M:", "\\app2\apps") DriveMapAdd ("Y:", "\\operserver2\techdownloads") ElseIf $group = "Office" Then DriveMapAdd ("M:", "\\whserver\apps") DriveMapAdd ("O:", "\\whserver\OfficeShare$") DriveMapAdd ("T:", "\\whserver\TeacherShare$") ElseIf $group = "Students" Then DriveMapAdd ("H:", "\\whserver\NetBaskets$") DriveMapAdd ("M:", "\\whserver\apps") DriveMapAdd ("N:", "\\app2\K5-Common") ElseIf $group = "Teachers" Then DriveMapAdd ("H:", "\\whserver\NetBaskets$") DriveMapAdd ("M:", "\\whserver\apps") DriveMapAdd ("N:", "\\app2\K5-Common") DriveMapAdd ("T:", "\\whserver\TeacherShare$") EndIf EndFunc I've used part of the code from a VB script that I had working, but for some users has now stopped... Not sure why, but I figure I'd try and get a script working through AutoIT. Any help is much appreciated. Jeff1 point