Jump to content

SlowCoder74

Active Members
  • Posts

    178
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by SlowCoder74

  1. I'm assuming that $this and $num are defined outside your function? Not sure what you're expecting with your next() statement, but you can't use next in this manner. Next is part of a for/next statement. Are you sure you're coding in AutoIT?
  2. For some reason I received a PM requesting I assist him. Not sure why he'd be in such a hurry that he needs to send random people PMs. I don't even have a high post count, nor am I a big contributor (yet).
  3. Excellent! That works. Now, I'm trying to obtain the descriptions of the computers. I change the field list to "name,description", The output adds another field, but the 2nd field is blank. When I look in AD, the descriptions are full of data. Am I missing something? Even when I just put in "description", the data is blank. Scratch that. I played with the code a bit more, and it's working now. Thank you!
  4. I need to run a presumably simple search for computers in AD. From a search, I found this thread: and downloaded adfunctions.au3. Here is my code: #include "H:AutoIT Projects_Routinesadfunctions.au3" Global $aComputers $sOU = $strDNSDomain $retVal = _ADGetObjectsInOU($aComputers,$sOU,"(objectclass=computer,name=nfdv*)",2,"name") msgbox(0,"",$retVal) _ArrayDisplay($aComputers)Based on notes in the adfunctions routine, I added "name=nfdv*" to retrieve all PCs starting with "nfdv", which should yield about 50. It took just a few seconds, but the $retVal = 0, which is (from what I can tell) the return code for no objects found. I don't know if it helps at all, but the computernames I need are nested 2 layers deep from the top domain. In other words: MyDomain top > OU 1 > OU 2 computername1 computername2 ... etc. ... Also, if I need to get the object description, is the proper fieldname to add to $datatoretrieve called "description"?
  5. I have 2 AutoIT programs. AutoIT program #1 calls (runwait) AutoIT program #2 and waits for it to finish. AutoIT program #2 needs to return data to AutoIT program #1. Is there a way to accomplish this without writing data to the hard drive?
  6. Thank you. I'll look into it.
  7. I know this is only 6 years late ... I needed a small utility that can quickly tell if the caps, num and scroll lock keys were on. I decided to modify Micha1405's code, rather than start from the ground up. I didn't want the GUI to always be visible, but it needed to be easily found. Therefore, here is my modified version of his program. The major changes are: - The GUI is not immediately visible. - Tray icon is re-enabled. - Hovering over the icon shows a quick tool-tip of the key states. - Left-click and hold on the icon pops up the GUI. - Right-click allows the program to be terminated. ;Original code by Micha1405 (http://www.autoitscript.com/forum/topic/25459-for-keyboards-without-leds-for-locks) ;Modified by SlowCoder 05/16/2012 ;Main modifications: ;- GUI is hidden on startup. ;- Tray icon is re-enabled. ;- Hovering over the icon shows a quick tool-tip of the key states. ;- Left-click and hold on the icon brings up the GUI. ;- Right-click allows the program to be terminated. #include <GUIConstantsEx.au3> #include <Constants.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> opt("TrayMenuMode",1) Global Const $VK_NUMLOCK = 0x90 Global Const $VK_SCROLL = 0x91 Global Const $VK_CAPITAL = 0x14 $Apps="KeyStat" $Off=0x999999 $On=0x00ff00 $x = @DesktopWidth - 100 $y = @DesktopHeight - 100 $mainGui=GUICreate($Apps,100,48,$x,$y,BitOR($WS_OVERLAPPED,$WS_SYSMENU),BitOR($WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) $label1=GUICtrlCreateLabel("Num",3,10) $labelNum=GUICtrlCreateLabel(" ",5,0,15,8,$SS_SUNKEN) $labelCaps=GUICtrlCreateLabel(" ",35,0,15,8,$SS_SUNKEN) $label2=GUICtrlCreateLabel("Caps",33,10) $labelScroll=GUICtrlCreateLabel(" ",65,0,15,8,$SS_SUNKEN) $label3=GUICtrlCreateLabel("Scroll",63,10) GUISetState(@SW_HIDE) ;set up tray icon menu $TrayExit = TrayCreateItem("Exit") TraySetClick (16) ;set so menu only shows when right-clicking _main() Func _main() While 1 $msg = GUIGetMsg() Switch $msg case $gui_event_close ExitLoop EndSwitch switch TrayGetMsg() case $TRAY_EVENT_PRIMARYDOWN GUISetState(@sw_show,$mainGui) case $TRAY_EVENT_PRIMARYUP GUISetState(@sw_hide,$mainGui) case $TrayExit Exit EndSwitch _toggleKeys() sleep(100) WEnd exit EndFunc Func _toggleKeys() $ToolTipText = "" if _getNumLock() =0 then GUICtrlSetBkColor($labelNum,$Off) $ToolTipText = "Num=OFF" Else GUICtrlSetBkColor($labelNum,$on) $ToolTipText = "Num=ON" EndIf if _GetCapsLock() =0 Then GUICtrlSetBkColor($labelCaps,$Off) $ToolTipText = $ToolTipText & ",Caps=OFF" Else GUICtrlSetBkColor($labelCaps,$on) $ToolTipText = $ToolTipText & ",Caps=ON" EndIf if _GetScrollLock() =0 Then GUICtrlSetBkColor($labelScroll,$Off) $ToolTipText = $ToolTipText & ",Scroll=OFF" Else GUICtrlSetBkColor($labelScroll,$on) $ToolTipText = $ToolTipText & ",Scroll=ON" EndIf ; TraySetToolTip($ToolTipText) EndFunc ;Code from gafrost ==> http://www.autoitscript.com/forum/index.php?showtopic=12056 Func _GetNumLock() Local $ret $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_NUMLOCK) Return $ret[0] EndFunc Func _GetScrollLock() Local $ret $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_SCROLL) Return $ret[0] EndFunc Func _GetCapsLock() Local $ret $ret = DllCall("user32.dll","long","GetKeyState","long",$VK_CAPITAL) Return $ret[0] EndFunc
  8. I would like to be able to popup a graphical window when the mouse is hovered over the script's tray icon. I checked TrayGetMsg, and it doesn't seem to support that function. Is there any way to make it happen without actually clicking on the icon?
  9. ... but not the directory itself ... DirRemove does exactly what I need to do, except that it also deletes the parent directory, and there is no option to leave the parent. Why is this a problem? Take a directory that has specific permissions set on it. The contents need to be deleted, but if the parent directory is deleted, then recreated under my program's user context, then the original permissions are lost. What are my options? To enumerate the subs of the directory, and delete them individually?
  10. Thank you all, for sticking with me through this.
  11. I'm currently using Koda to create my AutoIT GUIs. It's not a bad program. But I'm interested in seeing if there are any other GUI Editors available for AutoIT? Is there anything in the plans to create a GUI IDE built into AutiIT?
  12. Yes! That does make it clear. I'll have to adjust my thinking for this difference.
  13. No, local aArray[1] = [0] Unless I'm reading it wrong, it says to me that this is a 1-based array. not a 0-based array. And I don't understand what the [0] part all by itself means. Why is it confusing to want to be able to assign a value to $aArray[0]? That is a 0-based array, right? I'm a builder. Mr. Element #1 comes to me to build a house for him. I decide I want to give Mr. Element #1 house address 0. So I build the house ($aArray[0]), and name the house Mr. Element #1's name. ($aArray[0] = "Mr. Element #1"). This is not EXACTLY what my initial post was for, but the essence is the same.
  14. Can you explain what this is supposed to do?
  15. Yes, this is exactly what I'm saying. 0-based array, but AutoIT doesn't seem to (currently) support it. Typically data can be stored at [0] in other languages. If this is not doable at this time, I'm sure I can find a way around it. LOL! I just got back here to read all of your responses.
  16. They all fail. Yes, I am administrator on the machine, and can manage registry data through regedit.
  17. Here's my code: UpdateAutoLogon(1,"Mylogin","MyPassword","MyDomain") Func UpdateAutoLogon($iEnabled,$sAutoLogonUserName,$sAutoLogonPassword,$sAutoLogonDomain) local $ErrorNum = 0 local $sHive $sHive = "HKLM" if @OSArch = "X64" or @OSArch = "IA64" then $sHive = "HKLM64" ; RegWrite($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon","REG_SZ",$iEnabled) if @error<>0 then $ErrorNum = @error RegWrite($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","ForceAutoLogon","REG_SZ",$iEnabled) if @error<>0 then $ErrorNum = @error RegWrite($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName","REG_SZ",$sAutoLogonUserName) if @error<>0 then $ErrorNum = @error RegWrite($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultPassword","REG_SZ",$sAutoLogonPassword) if @error<>0 then $ErrorNum = @error RegWrite($sHive & "\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultDomainName","REG_SZ",$sAutoLogonDomain) if @error<>0 then $ErrorNum = @error return $ErrorNum EndFunc It works great in XP. But when I try to use it in Windows 7, I get an error 1, which means it can't find the key. I added the if @OSArch = "X64" or @OSArch = "IA64" then $sHive = "HKLM64" to see if that was the problem. I don't even know if it's relevent. In any case, it didn't fix the problem. Any ideas?
  18. I'm not sure what you're referring to, but I'm guessing you're talking about the "0 elements", which I updated to mean "an index of 0" in post #3.
  19. Any good OS isn't going to allow you to run a program with elevated privileges without proper credentials. This means, if you want to run your application under an administrator level account, you'll need to know the password. I'm not saying that you're intentions are bad, but to ask such a question about elevating your privileges without knowing the admin password just screams big trouble ... on many levels. If you need administrative access to the PC(s), then you need to ask your administrator for the password. If he declines your request, he doesn't want you in his system.
  20. Sorry, got my terms mixed up. I should have said "index" instead of "elements", because index 0 is the first element. It's getting late. I've never run into a language, apparently until now, that didn't allow an array to be dimensioned with a ubound of 0. That still allows for 1 element at index 0. Am I missing something here with AutoIT?
  21. Hey all. Strange happenings here. Hoping you can help. Here's my very simple test code: $retVal = MyFunc() Func MyFunc() local $MyArr[0] EndFunc If I try to assign my local array with 0 elements, does it return "Array variable subscript badly formatted"? If I assign simply change it to $MyArr[1], it works without errors. I've even tried to assign it with 1 element, then redim it to 0 elements, and it still chokes at the redim statement. I need my array to start at 0.
  22. Ok, my next issue ... Due to the fact that the output from my program is saved to a file, and must be user-readable, and that not all binary/expanded binary values are user readable, I've set up my program to create a string of chrs like such: Binary: chr(49) & chr(50) & chr(51) & chr(52) & chr(128) & chr(255) MultiString: chr(49) & chr(0) & chr(50) & chr(0) & chr(51) & chr(0) & chr(52) & chr(0) & chr(172) & chr(32) & chr(255) & chr(0) & chr(0) & chr(0) & chr(0) & chr(0) ExpandedString: chr(49) & chr(0) & chr(50) & chr(0) & chr(51) & chr(0) & chr(52) & chr(0) & chr(172) & chr(32) & chr(255) & chr(0) & chr(0) & chr(0) I think my Binary conversion is correct. But the Multi and Expanded strings are still problematic, as they have 2 values. For instance, decimal 172 and 32 somehow are calculated to create chr(128). Can someone explain how this is calculated? Edit: for clarification ... The values I saved to Registry were "1234" +chr(128)+chr(255). The data saved in the chr(128) position for Expanded and Multi strings is "AC 20", which when pulled from the registry and converted to decimal are "172 and 32". So I need to understand how I can calculate these values to equal back to 128. Another edit ... Here is the function I wrote to convert the information pulled from the registry export file. $BinaryData is the value data exactly as it was extracted from the file. e.g.: 31,32,33,34,80,ff for Binary (which works fine) 31,00,32,00,33,00,34,00,ac,20,ff,00,00,00 for ExString (which has 2 values for each character). func ConvertBinaryToStringOfChrs($BinaryData) $BinaryValues = stringsplit($BinaryData,",") $BinaryData = "" if $BinaryValues[0] > 0 Then for $intA = 1 to $BinaryValues[0] $BinaryData = $BinaryData & "chr(" & dec($BinaryValues[$intA]) & ") & " Next $BinaryData = stringleft($BinaryData,stringlen($BinaryData)-3) ;remove trailing " & " EndIf return $BinaryData EndFunc I realize the function is not yet working for multi character conversion, but that's not the issue. I just need to understand how I can combine the 2 characters for ExString into one correct value.
  23. I've written a program that automatically converts a registry export file (.reg) into an AutoIT script for easy import into an existing AutoIT program. The exported binary values are listed like ... "hex:31,32,33,34,80,ff" for their string equivalent of "1234" + chr(128) + chr(255). I need to convert this binary data into string. I'm sure this is a long shot, but ... Does AutoIT have a way to internally convert a binary registry value into its string equivalent? I'm not asking for a bunch of code. I'm just wondering if AutoIT has it built in.
  24. Yep. Thanks guys! I got it working!
  25. I've built a script that has functionality that needs to be restricted to only users who are members of a certain Active Directory group. If AutoIT knows the username and password of a user, can it inquire for group memberships?
×
×
  • Create New...