Jump to content

Lattis2003

Members
  • Posts

    14
  • Joined

  • Last visited

Lattis2003's Achievements

Seeker

Seeker (1/7)

1

Reputation

  1. trancexx - do you think you will update the WinHTTP.au3 functions to include the new functions with Windows 8.x and later versions of winhttp.dll. Specifically trying to get WinHttpResetAutoProxy working. https://msdn.microsoft.com/en-us/library/windows/desktop/hh405357(v=vs.85).aspx Thanks
  2. See if this will help. May need some tweaking. Global $objWMIService, $strIPAddress , $wbemFlagReturnImmediately, $wbemFlagForwardOnly, $NetConnectionID, $Index Global $strComputer = @ComputerName $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") If $objWMIService = 0 Then MsgBox(0, "WMI Error", "Please Fix WMI") ElseIf $objWMIService <> 0 Then _GetIndex() EndIf Func _GetIndex() ;Gets Index Address based on IPAddress $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE', "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $strIPAddress = $objItem.IPAddress(0) $IpAddressLen = StringLeft($strIPAddress, 3) If $IpAddressLen = "192" Then $strIndex = $objItem.Index If StringLen($strIndex) = 1 Then $Index = "000" & $strIndex If StringLen($strIndex) = 2 Then $Index = "00" & $strIndex _NetConnectionID() MsgBox(0, "Network Name", $NetConnectionID) EndIf Next EndIf EndFunc ;==>_GetIndex Func _NetConnectionID() ;Gets NetConnectionID, ie 'Local Area Connection' $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter where Index=" & $Index, "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems $NetConnectionID = $objItem.NetConnectionID Next Else EndIf EndFunc ;==>_NetConnectionID
  3. Trying to creating a shortcut for a network folder using FileCreateShortcut. The script is running as a local admin. If the drive letter exists then the shortcut is created successfull. The full path does not have to exist. If the drive letter does not exist then the shortcut truncates the target to 8 characters. Creating a shortcut to a file works even if the drive letter or path does not exist. FileCreateShortcut("R:\TestFolder", @DesktopDir & "\Shortcut to TestFolder") Vbscript has the same behavior. I can copy the shortcut but looking for other ways since i have never ran into this. Thanks Lattis
  4. Turns out to be a corrupt entry in the names.nsf. Nothing worng with the script. My fault for over looking a few things. Lattis
  5. Danny35d, I do have com error handling i just did not post it in the example. I should have stated that. It never throws a com error. I can force it to throw a com error so i know that's working. I am testing the address book with 6 entries. All the data gets written correctly with the error. If i manually look at the default data from say "Title: it is "" If i select any entry like Mr. and then change it back to none the value changes to "0" and the errors disappear for this field. Same thing for "Suffix". It also gets the same error on "PhoneNumber" but if i add an entry and remove it the value goes back to the default "" and the errors disappear for "PhoneNumber". If i populate all fields with data the error never occurs. If i test it with one entry and the fields are null the error never occurs. It only happens when it loops the next document. I have tried setting the values in the script to "" before it loops to the next document with no luck. I have tried to suppress the error with no luck. I am going to put this into a vbscript today and test it. Thanks Lattis
  6. I am trying to export Lotus Notes names.nsf address book to a csv file. All data is written correctly to the csv file. I get this error on several of the objects if the field is blank on some of the address book entries: C:\TestLotusNotes.au3 (59) : ==> Object referenced outside a "With" statement.: $Title = $Addr_Doc.GetFirstItem("Title" ).Text $Title = $Addr_Doc.GetFirstItem("Title" )^ ERROR If i populate all the address's with Title information i do not get the error. Local $Addr_Doc, $FirstName, $MiddleName, $LastName, $Fullname, $Title, $Suffix, $CompanyName, $Department Local $JobTitle, $Comment, $BusinessPhone, $BusinessFax, $BusinessStreet, $BusinessCity, $BusinessState, $BusinessZip, $BusinessCountry Local $HomePhone, $HomeFax, $MobilePhone, $HomeStreet, $HomeCity, $HomeState, $HomeZip, $HomeCountry Local $EmailAddress, $Birthday, $Anniversary, $WebPage, $Manager, $Assistant, $Spouse, $Children, $Location, $Pager, $BusinessPager $Session = ObjCreate("Notes.NotesSession") $Addr_db = $Session.GetDatabase("", "Names.nsf") $Addr_view = $Addr_db.GetView("People") $Addr_Doc = $Addr_view.GetFirstDocument $File = "C:\AddressBook.csv" FileWrite($File, "First Name" & _ "," & "Middle Name" & _ "," & "Last Name" & _ "," & "Full name" & _ "," & "Title" & _ "," & "Suffix" & _ "," & "Company" & _ "," & "Department" & _ "," & "JobTitle" & _ "," & "Comment" & _ "," & "Business Phone" & _ "," & "Business Fax" & _ "," & "Business Street" & _ "," & "Business City" & _ "," & "Business State" & _ "," & "Business Postal Code" & _ "," & "Business Country" & _ "," & "Home Phone" & _ "," & "Home Fax" & _ "," & "Mobile Phone" & _ "," & "Home Street" & _ "," & "Home City" & _ "," & "Home State" & _ "," & "Home Postal Code" & _ "," & "Home Country" & _ "," & "E-Mail Address" & _ "," & "Birthday" & _ "," & "Anniversary" & _ "," & "Web Page" & _ "," & "Manager's Name" & _ "," & "Assistant's Name" & _ "," & "Spouse" & _ "," & "Children" & _ "," & "Business Pager" & _ "," & "Personal Pager" & _ "," & "Location" & @CRLF) While 1 If Not IsObj($Addr_Doc) Then ExitLoop $FirstName = $Addr_Doc.GetFirstItem("FirstName" ).Text $MiddleName = $Addr_Doc.GetFirstItem("MiddleInitial" ).Text $LastName = $Addr_Doc.GetFirstItem("LastName" ).Text $Fullname = $Addr_Doc.GetFirstItem("FullName" ).Text $Title = $Addr_Doc.GetFirstItem("Title" ).Text $Suffix = $Addr_Doc.GetFirstItem("Suffix" ).Text $CompanyName = $Addr_Doc.GetFirstItem("CompanyName" ).Text $Department = $Addr_Doc.GetFirstItem("Department" ).Text $JobTitle = $Addr_Doc.GetFirstItem("JobTitle" ).Text $Comment = $Addr_Doc.GetFirstItem("Comment" ).Text $BusinessPhone = $Addr_Doc.GetFirstItem("OfficePhoneNumber" ).Text $HomePhone = $Addr_Doc.GetFirstItem("PhoneNumber" ).Text $MobilePhone = $Addr_Doc.GetFirstItem("CellPhoneNumber" ).Text $BusinessFax = $Addr_Doc.GetFirstItem("OfficeFaxPhoneNumber" ).Text $HomeFax = $Addr_Doc.GetFirstItem("HomeFaxPhoneNumber" ).Text $BusinessCity = $Addr_Doc.GetFirstItem("OfficeCity" ).Text $BusinessStreet = $Addr_Doc.GetFirstItem("OfficeStreetAddress" ).Text $BusinessState = $Addr_Doc.GetFirstItem("OfficeState" ).Text $BusinessZip = $Addr_Doc.GetFirstItem("OfficeZip" ).Text $BusinessCountry = $Addr_Doc.GetFirstItem("OfficeCountry" ).Text $HomeCity = $Addr_Doc.GetFirstItem("City" ).Text $HomeStreet = $Addr_Doc.GetFirstItem("StreetAddress" ).Text $HomeState = $Addr_Doc.GetFirstItem("State" ).Text $HomeZip = $Addr_Doc.GetFirstItem("Zip" ).Text $HomeCountry = $Addr_Doc.GetFirstItem("Country" ).Text $EmailAddress = $Addr_Doc.GetFirstItem("InternetAddress" ).Text $Birthday = $Addr_Doc.GetFirstItem("Birthday" ).Text $Anniversary = $Addr_Doc.GetFirstItem("Anniversary" ).Text $WebPage = $Addr_Doc.GetFirstItem("WebSite" ).Text $Manager = $Addr_Doc.GetFirstItem("Manager" ).Text $Assistant = $Addr_Doc.GetFirstItem("Assistant" ).Text $Spouse = $Addr_Doc.GetFirstItem("Spouse" ).Text $Children = $Addr_Doc.GetFirstItem("Children" ).Text $BusinessPager = $Addr_Doc.GetFirstItem("PhoneNumber_6" ).Text $Pager = $Addr_Doc.GetFirstItem("PersPager" ).Text $Location = $Addr_Doc.GetFirstItem("Location" ).Text MsgBox(0, "", "FirstName: " & $FirstName & @CRLF & _ "MiddleName: " & $MiddleName & @CRLF & _ "LastName: " & $LastName & @CRLF & _ "FullName: " & $Fullname & @CRLF & _ "Title: " & $Title & @CRLF & _ "Suffix: " & $Suffix & @CRLF & _ "CompanyName: " & $CompanyName & @CRLF & _ "Department: " & $Department & @CRLF & _ "Job Title: " & $JobTitle & @CRLF & _ "Comment: " & $Comment & @CRLF & _ "Business Phone: " & $BusinessPhone & @CRLF & _ "Business Fax: " & $BusinessFax & @CRLF & _ "Business Street: " & $BusinessStreet & @CRLF & _ "Business City: " & $BusinessCity & @CRLF & _ "Business State: " & $BusinessState & @CRLF & _ "Business Postal Code: " & $BusinessZip & @CRLF & _ "Business Country: " & $BusinessCountry & @CRLF & _ "Home Phone: " & $HomePhone & @CRLF & _ "Home Fax: " & $HomeFax & @CRLF & _ "Mobile Phone: " & $MobilePhone & @CRLF & _ "Home Street: " & $HomeStreet & @CRLF & _ "Home City: " & $HomeCity & @CRLF & _ "Home State: " & $HomeState & @CRLF & _ "Home Postal Code: " & $HomeZip & @CRLF & _ "Home Country: " & $HomeCountry & @CRLF & _ "E-Mail Address: " & $EmailAddress & @CRLF & _ "Birthday: " & $Birthday & @CRLF & _ "Anniversary: " & $Anniversary & @CRLF & _ "Webpage: " & $WebPage & @CRLF & _ "Manager's Name: " & $Manager & @CRLF & _ "Assistant's Name: " & $Assistant & @CRLF & _ "Spouse: " & $Spouse & @CRLF & _ "Children: " & $Children & @CRLF & _ "Business Pager: " & $BusinessPager & @CRLF & _ "Pager: " & $Pager & @CRLF & _ "Location: " & $Location) FileWrite($File, $FirstName & _ "," & $MiddleName & _ "," & $LastName & _ "," & $Fullname & _ "," & $Title & _ "," & $Suffix & _ "," & $CompanyName & _ "," & $Department & _ "," & $JobTitle & _ "," & $Comment & _ "," & $BusinessPhone & _ "," & $BusinessFax & _ "," & $BusinessStreet & _ "," & $BusinessCity & _ "," & $BusinessState & _ "," & $BusinessZip & _ "," & $BusinessCountry & _ "," & $HomePhone & _ "," & $HomeFax & _ "," & $MobilePhone & _ "," & $HomeStreet & _ "," & $HomeCity & _ "," & $HomeState & _ "," & $HomeZip & _ "," & $HomeCountry & _ "," & $EmailAddress & _ "," & $Birthday & _ "," & $Anniversary & _ "," & $WebPage & _ "," & $Manager & _ "," & $Assistant & _ "," & $Spouse & _ "," & $Children & _ "," & $BusinessPager & _ "," & $Pager & _ "," & $Location & @CRLF) $Addr_Doc = $Addr_view.GetnextDocument($Addr_Doc) WEnd
  7. In a nutshell. The changes made with gpedit are saved to registry.pol files in System32\GroupPolicy\User and \Machine folders. Make the changes you want on a test laptop and copy over the registry.pol files to the laptops to be locked down. Deny permissions for the Administrators group to the \User and \Machine folders so the policies don't apply to admins logging in. Run gpupdate /force to apply the policies to the computers. Hope this helps.
  8. PM sent.Always good to have different methods. Looking forward to see what you have done. Thanks
  9. @monoceres & weaponx Thanks for your help. I will continue to look at getting this working. Reading C++ stuff and trying to understand the code is to tough for me. I just can't put the logic to it yet.
  10. I am calling the compiled version of this code to get the SATA hard drive manufactors serial number. WMI does not get the serial number under Windows XP for SATA. I have searched the forums for a way better way to get the serial numbers with no luck for the SATA drives without 3rd party tools. This is the C++ code i am using. Is it possible to convert the code to Autoit. C++ Code Any suggestions welcomed. Thanks 2006_06_29_150445_HardwareSerialHDD.zip
  11. Thanks PsaltyDS I went the long way around finding my mistake. I made a vbscript with some input boxes to test my output and when i entered " \\" i automatically hit the space bar to add the correct space and bam it hit me. I felt like an idiot. Thanks for the debug tip as this will come in very handy for me. It's just going to take me a few weeks to get in the groove again as i have been away from scripting a couple years. I decided to try AutoIt since it gives so much more to work with. Plus it makes it more fun to start again. Thanks Again for your help.
  12. Solved. I was failing to put a space in for the " \\" RunWait("printmig.exe -r E:\Printers\Printers.cab" & "\\" & $strComputerName) RunWait("printmig.exe -r E:\Printers\Printers.cab" & " \\" & $strComputerName) Thanks everyone.
  13. PsaltyDS I did remove the stray double quote after $strComputer and get no error in SciTE. I pasted the wrong code due to trying to many strings. The problem is i never can get the varaible to pass to the command printmig.exe. I have set the variable $strComputerName = GUICtrlRead($strComputer) in my loop. The msg box echo's the correct info. CODE Func Printer1() RunWait("printmig.exe -r E:\Printers\Printers.cab" & "\\" & $strComputerName) MsgBox(0, "Variable for The Computer Name", $strComputerName) EndFunc I have also set $strComputerName = "\\" & GUICtrlRead($strComputer) This echo's the correct string. CODE Func Printer1() RunWait("printmig.exe -r E:\Printers\Printers.cab" & $strComputerName) MsgBox(0, "Variable for The Computer Name", $strComputerName) EndFunc either should run the exe as printmig.exe -r e:\printers\printers.cab \\remotecomputer I am at a loss. Thanks
  14. New to Autoit. Trying to move away from vbscript. Need to pass the variable $strComputer at the end of the printmig.exe to restore printers. Not getting any syntax errors and i have tried different syntax's at the end for strComputer Thanks printmig.exe switches usage: PRINTMIG [options] [server] [-?] Display this message [-b] Backup - followed by CAB file name [-r] Restore - followed by CAB file name [-l] Attempt to convert LPR Ports to SPM [-i] Suppress warning popups. Info still written to log file If server is not specified then the local machine is implied. Example command line to restore an existing config to a server: printmig -r d:\print\ps1.cab \\prt-srvr1 Example command line to backup a server to the specified file: printmig -b "\\filesrv\store\print server 2.cab" \\prt-srvr2 CODE ;This works Func Printer1() RunWait("printmig.exe -r E:\Printers\Printers.cab \\remotecomputername") MsgBox(0, "Verify input strComputer", GUICtrlRead($strComputer)) EndFunc ;This does not work Func Printer1() RunWait("printmig.exe -r E:\Printers\Printers.cab" & "\\" & $strComputer ") MsgBox(0, "Verify input strComputer", GUICtrlRead($strComputer)) EndFunc
×
×
  • Create New...