Jump to content

cdjphoenix

Active Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by cdjphoenix

  1. I have note seen this filegetshortname yet so I will go play around with it. sounds useful.
  2. I found the issue, it turned out to be a piece of code a little farther down. I couldn't tell because the path was so long it truncated the useful info.
  3. Sorry for the delay in responding, go sick over the weekend. I will test both your theories and let you know what happens. I did notice something as I was playing around with it yesterday though. While it does not seem to be able to create the new folder it still seems like it will create the new file despite the error.
  4. Hello again everyone, I have another issue I was hoping someone could point out what I did wrong because I have no clue at this point. The part that is giving me trouble is just a FileCopy command but it says it cannot find the path. My only speculation is that the path is to long but I don't know. Here is what I have an it works. *Note: I had to do some sanitizing so it's not word for word but still should work. Also, I've been using msgbox to verify that the path being used is what I expect it to be. Case $msg = $CheckListSetup $ServerName = InputBox("Server Name", "What is the name of your server?") $Location = StringLeft($ServerName, 3) MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH) if $Location = "aaa" Then FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH) And when I go one folder deeper it stops working: Case $msg = $CheckListSetup $ServerName = InputBox("Server Name", "What is the name of your server?") $Location = StringLeft($ServerName, 3) MsgBox(0,"","\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm \\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH) if $Location = "aaa" Then FileCopy("\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Server_Builds\Windows Server Build Checklist.dotm", "\\Server\IT\Operations\ITServer\Server_Team\SERVERS\Group1\" & $ServerName & "\" & $ServerName & " Windows Server Build Checklist.dotm",$FC_CREATEPATH) Thank you for your time.
  5. I Figured out how to do what I was looking to do. Here is the code just in case someone else comes searching for something similar: #include "mysql.au3" #include "array.au3" $sql = _MySQLConnect('user','password','table','SQLSystem') $row = _Query($sql, "SELECT * FROM fax") Global $aArray,$aArray2 Global $sFill, $sFill2 Global $aArray_Base [1] [3] $aArray = $aArray_Base with $row While NOT .EOF Global $FirstName = .Fields("firstname").value Global $LastName = .Fields("lastname").value Global $FaxNumber = .Fields("faxnumber").value Local $sFill[2] [3] = [[$FirstName, $LastName,$FaxNumber]] _ArrayAdd($aArray, $sFill) .MoveNext WEnd EndWith _ArrayDisplay($aArray, "Test Array") _MySQLEnd($sql)
  6. I knew it would be something simple, this gets the correct data into the correct spots....for the most part. whatever reason each piece of data is in the correct column but it's one piece per row.
  7. It must be, I have no doubt there are errors but the reason i say it works is that when i run it I see my data in a table...all in one column, but it's still a table. Right now in order to update certain user info I have to go to two serperate spots to update it and I find this annoying. What I'm trying to do is get this data into a MySQL database and use autoit to update this database along with Active Directory. Thanks for the input though, I see if i can add in some error checking. *Edit here is my original code before i went crazy and started trying wierd things to get those coulmns. #include "mysql.au3" #include "array.au3" $sql = _MySQLConnect('user','password','test','TestSystem') $row = _Query($sql, "SELECT * FROM fax") Global $aArray,$aArray2 Global $sFill, $sFill2 Global $aArray_Base [1] [3] $aArray = $aArray_Base with $row While NOT .EOF Global $FirstName = .Fields("firstname").value Global $LastName = .Fields("lastname").value Global $FaxNumber = .Fields("faxnumber").value $sFill =$FirstName $sFill2 =$LastName $sFill3 =$FaxNumber _ArrayAdd($aArray, $sFill) _ArrayAdd($aArray, $sFill2, 1) _ArrayAdd($aArray, $sFill3, 2) .MoveNext ;MsgBox(0,"TEST",$FirstName) WEnd EndWith _ArrayDisplay($aArray, "Test Array") _MySQLEnd($sql)
  8. There were all in the same array at one point but I've been trying everything I can think of in order to get this to show the way i want.
  9. I'm hoping someone here can shed some light on a problem I've been having combining some arrays. I've searched the forum and found some posts but I'm still having troubles My goal is to have an array that I can display with 3 seperate columns, I'd actually be happy with anyway to get 3 arrays on a table. I have a MySQL server that I am pulling 3 different fields from "firstname", "lastname" and "phone" and I can pull the data without any problems, it's just combining them. Here is what I have currently code wise. It's not very pretty but it works... #include "mysql.au3" #include "array.au3" $sql = _MySQLConnect('username','password','table','TestSystem') $row = _Query($sql, "SELECT * FROM fax") Global $aArray Global $sFill Global $aArray_Base [1] [3] $aArray = $aArray_Base Global $aArray2 Global $sFill2 Global $aArray_Base2 [1] [3] $aArray2 = $aArray_Base2 Global $aArray3 Global $sFill3 Global $aArray_Base3 [1] [3] $aArray3 = $aArray_Base3 with $row While NOT .EOF Global $FirstName = .Fields("firstname").value Global $LastName = .Fields("lastname").value Global $FaxNumber = .Fields("faxnumber").value $sFill = $FirstName $sFill2 = $LastName $sFill3 = $FaxNumber _ArrayAdd($aArray, $sFill) _ArrayAdd($aArray2, $sFill2) _ArrayAdd($aArray3, $sFill3) .MoveNext ;MsgBox(0,"TEST",$FirstName &" " & $LastName & " " & $FaxNumber) WEnd EndWith _ArrayDisplay($aArray, "Test Array") _ArrayDisplay($aArray2, "Test Array") _MySQLEnd($sql) Thank you for taking the time to look at my code/problem.
  10. I made the suggested changes to my code and it works perfetly. Thank you for the help and your time.
  11. Thanks, I believe i have found what you were talking about.. Although, it does not seem to be working for me. From what I understand from the help file is that you need to add GUICtrlSetState(-1, $GUI_SHOW) under the tab you wish to be dislplayed first. For example my script would look like: $hTab = GUICtrlCreateTab(10, 10, 400, 900) $tab1 = GUICtrlCreateTabItem("General") GUICtrlSetState(-1,$GUI_SHOW) GUICtrlCreateLabel("User Name: " & @UserName, 15,40) GUICtrlCreateLabel("Machine Name: " & $CSArray[0], 15,60) GUICtrlCreateLabel("Domain: " & $CSArray[1], 15,80) GUICtrlCreateLabel("Manufacturer: " & $CSArray[2], 15,100) GUICtrlCreateLabel("Model: " & $CSArray[3], 15,120) GUICtrlCreateLabel("Operating System: " & $OSArray[0] & " " & $OSArray[1], 15,140) $tab2 = GUICtrlCreateTabItem("Drives") GUICtrlCreateLabel($HDDArray, 15,40) $tab3 = GUICtrlCreateTabItem("Memory") GUICtrlCreateLabel($MemArray[0], 15,40) $tab4 = GUICtrlCreateTabItem("Processor") GUICtrlCreateLabel("Processor: " & $ProcArray[0], 15,40) GUICtrlCreateLabel("Device ID: " & $ProcArray[1], 15,60) GUICtrlCreateLabel("Socket: " & $ProcArray[2], 15,80) GUICtrlCreateLabel("Max CLock Speed: " & $ProcArray[3], 15,100) $tab5 = GUICtrlCreateTabItem("Software") GUICtrlCreateLabel("AntiVirus: " & $AntiVirusArray[0], 15,40) GUICtrlCreateLabel("Office Version: " & $OfficeVersion, 15,60) GUICtrlCreateLabel("Office Key: " & $OfficeKey, 15,80) If StringInStr($SoftwareTest[0],"QuickBooks") Then $QuickBooksTest = "QuickBooks is installed" Else $QuickBooksTest = "QuickBooks not installed" EndIf GUICtrlCreateLabel($QuickBooksTest, 15,100) ;GUICtrlCreateLabel(" ;GUICtrlCreateLabel(" GUISetState(@SW_SHOW) GUICtrlCreateTabItem("") Did i miss something interpret that wrong or did i miss something real simple? Thanks again for all your help.
  12. It works! I was hoping that it was just a line of code and not an entire section that i managed to break. Although, I have one follow up question. Right now when you open the program it starts on tab5 insted of tab1, is there a way to change this? Thanks again for you help.
  13. I didn't think it was relavant to the problem. I have updated the post with the full script as requested.
  14. I am currently working on a program to grab system info and software licenses and I've hit a problem with tabs and scrollbars. What I am trying to do is have a tab for each catagory like, Memory, Hard Drives, Processors. I have the tabs and info working the way i want but since some of these tabs have a lot of information on them I would like them to be scrollable. I am using Melba23's UDF for scrollbars so that I dont make this any harder that it needs to be. When I add the scrollbars they show up as I want but then the first tab appears blank. I can then click on the 2nd tab and scroll as i want. The odd thing is after select tab2 and then go back tab1, tab1 has all of it's info back. I've gone as far as i can on solving this problem and would aprieciate any help i can get. Here is what i have so far. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.8.1 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <File.au3> #include <GUIConstantsEx.au3> #include "GUIScrollbars_Ex.au3" Global $CSArray = Win32_ComputerSystem() Global $MemArray = Win32_PhysicalMemory() Global $OSArray = Win32_OperatingSystem() Global $ProcArray = win32_processor() Global $HDDArray = Win32_LogicalDisk() Global $AntiVirusArray = Antivirus() Global $OfficeVersion = MSOffice() Global $OfficeKey = OfficeKey() Global $SoftwareTest = SWTest() Global $hGuiWin = GUICreate ( "System Info", 420, 500) $SaveButton = GUICtrlCreateButton("Save ", 250, 960, 75) _GUIScrollbars_Generate($hGuiWin, 390, 1000, 0, 0, True) GUISetState() $hTab = GUICtrlCreateTab(10, 10, 400, 900) $tab1 = GUICtrlCreateTabItem("General") GUICtrlCreateLabel("User Name: " & @UserName, 15,40) GUICtrlCreateLabel("Machine Name: " & $CSArray[0], 15,60) GUICtrlCreateLabel("Domain: " & $CSArray[1], 15,80) GUICtrlCreateLabel("Manufacturer: " & $CSArray[2], 15,100) GUICtrlCreateLabel("Model: " & $CSArray[3], 15,120) GUICtrlCreateLabel("Operating System: " & $OSArray[0] & " " & $OSArray[1], 15,140) $tab2 = GUICtrlCreateTabItem("Drives") GUICtrlCreateLabel($HDDArray, 15,40) $tab3 = GUICtrlCreateTabItem("Memory") GUICtrlCreateLabel($MemArray[0], 15,40) $tab4 = GUICtrlCreateTabItem("Processor") GUICtrlCreateLabel("Processor: " & $ProcArray[0], 15,40) GUICtrlCreateLabel("Device ID: " & $ProcArray[1], 15,60) GUICtrlCreateLabel("Socket: " & $ProcArray[2], 15,80) GUICtrlCreateLabel("Max CLock Speed: " & $ProcArray[3], 15,100) $tab5 = GUICtrlCreateTabItem("Software") GUICtrlCreateLabel("AntiVirus: " & $AntiVirusArray[0], 15,40) GUICtrlCreateLabel("Office Version: " & $OfficeVersion, 15,60) GUICtrlCreateLabel("Office Key: " & $OfficeKey, 15,80) If StringInStr($SoftwareTest[0],"QuickBooks") Then $QuickBooksTest = "QuickBooks is installed" Else $QuickBooksTest = "QuickBooks not installed" EndIf GUICtrlCreateLabel($QuickBooksTest, 15,100) ;GUICtrlCreateLabel(" ;GUICtrlCreateLabel(" ;GUISetState(@SW_SHOW) While 3 $msg = GUIGetMsg() Select Case $msg = $RebootButton2 Case $msg = $CancelRebootButton GUISetState(@SW_HIDE) ExitLoop Case $msg = $SaveButton Local $file = FileOpen(@ComputerName & " SysInfo.txt" , 1) MsgBox(0,"Debug Msg", "Debug Msg") FileWriteLine($file, "Username: " & @username) FileWriteLine($file, "Machine Name: " & $CSArray[0]) FileWriteLine($file, "Domain: " & $CSArray[1]) FileWriteLine($file, "Manufacturer: " & $CSArray[2]) FileWriteLine($file, "Operating System: " & $OSArray[0] & " " & $OSArray[1]) FileWriteLine($file, " ") FileWriteLine($file, $HDDArray) FileWriteLine($file, " ") FileWriteLine($file, $MemArray[0]) FileWriteLine($file, " ") FileWriteLine($file, "Proccessor: " & $ProcArray[0]) FileWriteLine($file, "Proccessor ID: " & $ProcArray[1]) FileWriteLine($file, "Socket Type: " & $ProcArray[2]) FileWriteLine($file, "Max CLock Speed: " & $ProcArray[3]) FileWriteLine($file, " ") FileWriteLine($file, "AntiVirus: " & $AntiVirusArray[0]) FileWriteLine($file, " ") FileWriteLine($file, "Office Version: " & $OfficeVersion) FileWriteLine($file, "Office License: " & $OfficeKey) FileWriteLine($file, " ") FileWriteLine($file,$QuickBooksTest) ;FileWriteLine($file, FileClose($file) EndSelect WEnd ;Do ; $msg = GUIGetMsg() ; Select ; Case $msg = $SaveButton ;GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO GENERAL INFO Func Win32_ComputerSystem() Local $oWMIService = ObjGet("winmgmts:\\.\") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_ComputerSystem", "WQL", 0x30) Local $CSDescription[4] If IsObj($oColItems) Then For $oObjectItem In $oColItems $CSDescription[0] &= $oObjectItem.Name $CSDescription[1] &= $oObjectItem.Domain $CSDescription[2] &= $oObjectItem.Manufacturer $CSDescription[3] &= $oObjectItem.Model Next Return $CSDescription EndIf Return SetError(1, 1, 0) EndFunc ;MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO MEMORY INFO Func Win32_PhysicalMemory() Local $oWMIService = ObjGet("winmgmts:\\.\") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_PhysicalMemory", "WQL", 0x30) Local $MemDescription[4] If IsObj($oColItems) Then For $oObjectItem In $oColItems $MemDescription[0] &= $oObjectItem.banklabel & @CRLF & "Manufacturer: " & $oObjectItem.manufacturer & @CRLF & "Size: " & ($oObjectItem.capacity / 1024 ^ 3) & "GB" & @CRLF & "Part Number: " & $oObjectItem.partnumber & @CRLF & @CRLF ;$MemDescription[1] &= $oObjectItem.manufacturer ;$MemDescription[2] &= $oObjectItem.capacity ;$MemDescription[3] &= $oObjectItem.partnumber Next Return $MemDescription EndIf Return SetError(1, 1, 0) EndFunc ;OPERATING SYSTEM INFO OPERATING SYSTEM INFO OPERATING SYSTEM INFO OPERATING SYSTEM INFO OPERATING SYSTEM INFO OPERATING SYSTEM INFO OPERATING SYSTEM INFO Func Win32_OperatingSystem() Local $oWMIService = ObjGet("winmgmts:\\.\") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_OperatingSystem", "WQL", 0x30) Local $OSDescription[4] If IsObj($oColItems) Then For $oObjectItem In $oColItems $OSDescription[0] &= $oObjectItem.Caption $OSDescription[1] &= $oObjectItem.OSArchitecture Next Return $OSDescription EndIf Return SetError(1, 1, 0) EndFunc ;PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO PROCESSOR INFO Func win32_processor() Local $oWMIService = ObjGet("winmgmts:\\.\") Local $oColItems = $oWMIService.ExecQuery("Select * From win32_processor", "WQL", 0x30) Local $ProcDescription[4] If IsObj($oColItems) Then For $oObjectItem In $oColItems $ProcDescription[0] &= $oObjectItem.Name $ProcDescription[1] &= $oObjectItem.DeviceID $ProcDescription[2] &= $oObjectItem.SocketDesignation $ProcDescription[3] &= ($oObjectItem.MaxClockSpeed / 1000 & "GHz") Next Return $ProcDescription EndIf Return SetError(1, 1, 0) EndFunc ;HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO HDD INFO Func Win32_LogicalDisk() Local $HDDdescription $strComputer = "." $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colItems = $objWMIService.ExecQuery("Select * from Win32_LogicalDisk") For $objItem In $colItems $HDDdescription &= "Drive Letter: " & $objItem.DeviceID & @CRLF & _ "Size: " & Int($objItem.Size / 1024 ^ 3) & "GB" & @CRLF & _ "Free Space: " & Int($objItem.FreeSpace / 1024 ^ 3) & "GB" & @CRLF & _ "Mapped Drive: " & ($objItem.ProviderName) & @CRLF & @CRLF Next Return $HDDdescription EndFunc ;AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus AntiVirus Func AntiVirus() Local $AntiVirusDiscription[4] $oWMI = ObjGet("winmgmts:\\localhost\root\SecurityCenter2") $colItems = $oWMI.ExecQuery("Select * from AntiVirusProduct where not displayname= 'Windows Defender'") For $objAntiVirusProduct In $colItems $AntiVirusDiscription[0] = $objAntiVirusProduct.DisplayName Next Return $AntiVirusDiscription EndFunc ;MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info MS Office Info ;MVP ;MsgBox(0, '', MSOffice()) Func MSOffice() Dim $ls_key, $ls_return, $ls_pom, $ls_name, $ls_ver1, $ls_ver2, $ls_ver3, $ls_subkey, $ls_value Dim $n, $ul_pom ; 1) first quick check if Office installed and get approximate version $ls_key = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office" $n = 1 While 1 $ls_subkey = RegEnumKey($ls_key, $n) If @error Then ExitLoop $ls_value = RegEnumKey($ls_key & "\" & $ls_subkey & "\Registration", 1) If Not @error Then $ls_ver1 = $ls_subkey ; 14.0 $ls_return = 'Microsoft Office ' + $ls_subkey ExitLoop EndIf $n += 1 WEnd If $ls_return = '' Then Return '' ; isn't Office ; 2) check exact name/version from Uninstall $ls_key = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall" $n = 0 While 1 $n += 1 $ls_subkey = RegEnumKey($ls_key, $n) If @error Then ExitLoop $ls_name = RegRead($ls_key & "\" & $ls_subkey, "DisplayName") If @error Then ContinueLoop ; skip other applications than Office and also Office components If Not (StringInStr($ls_name, 'Microsoft Office') > 0 And StringInStr($ls_name, 'Web Components') = 0) Then ContinueLoop $ls_pom = RegRead($ls_key & "\" & $ls_subkey, "ParentKeyName") If Not @error Then ContinueLoop ; skip those With Parent $ul_pom = RegRead($ls_key & "\" & $ls_subkey, "SystemComponent") If Not @error And $ul_pom = 1 Then ContinueLoop ; skip SystemComponents = 1 - - > MUI(Czech), ... $ls_ver2 = RegRead($ls_key & "\" & $ls_subkey, "DisplayVersion") If @error Then ContinueLoop ; skip those without version ; note: base version number must be the same with the one from first step ; Microsoft Office Professional Plus 2010 (14.0.4763.1000) If StringLeft($ls_ver2, StringLen($ls_ver1)) = $ls_ver1 Then ; 3) beware: in registry there isn't version included service packs, therefore check exact version from EXE? (14.0.6106.5005) - SP1 ; InstallLocation - C:\Program Files (x86)\Microsoft Office\ ; ls_ver3 = ... ;Return $ls_name Return $ls_name & ' (' & $ls_ver2 & ')' EndIf WEnd ; if not found exact version from Uninstall, then return at least approximate version from first step Return $ls_return EndFunc ;==>uf_get_office_ver ;Office Key Office Key Office Key Office Key Office Key Office Key Office Key Office Key Office Key Office Key Office Key Office Key Func OfficeKey() Local $sKey[29], $Value = 0, $hi = 0, $n = 0, $i = 0, $dlen = 29, $slen = 15, $Result, $bKey, $iKeyOffset = 52, $RegKey if StringInStr($OfficeVersion,"XP") Then $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\10.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\10.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next ElseIf StringInStr($OfficeVersion,"2003") Then $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\11.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\11.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next ElseIf StringInStr($OfficeVersion,"2007") Then $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\12.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\12.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next ElseIf StringInStr($OfficeVersion,"2010") Then $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\14.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\14.0\Registration' For $i = 1 To 100 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 ElseIf StringInStr($OfficeVersion,"2013") Then $RegKey = 'HKLM\SOFTWARE\Microsoft\Office\15.0\Registration' If @OSArch = 'x64' Then $RegKey = 'HKLM64\SOFTWARE\Wow6432Node\Microsoft\Office\15.0\Registration' For $i = 1 To 1024 $var = RegEnumKey($RegKey, $i) If @error <> 0 Then ExitLoop $bKey = RegRead($RegKey & '\' & $var, 'DigitalProductId') If Not @error Then ExitLoop Next $iKeyOffset = 0x328 EndIf If Not BinaryLen($bKey) Then Return "" Local $aKeys[BinaryLen($bKey)] For $i = 0 To UBound($aKeys) - 1 $aKeys[$i] = Int(BinaryMid($bKey, $i + 1, 1)) Next Local Const $isWin8 = BitAND(BitShift($aKeys[$iKeyOffset + 14], 3), 1) $aKeys[$iKeyOffset + 14] = BitOR(BitAND($aKeys[$iKeyOffset + 14], 0xF7), BitShift(BitAND($isWin8, 2), -2)) $i = 24 Local $sChars = "BCDFGHJKMPQRTVWXY2346789", $iCur, $iX, $sKeyOutput, $iLast While $i > -1 $iCur = 0 $iX = 14 While $iX > -1 $iCur = BitShift($iCur, -8) $iCur = $aKeys[$iX + $iKeyOffset] + $iCur $aKeys[$iX + $iKeyOffset] = Int($iCur / 24) $iCur = Mod($iCur, 24) $iX -= 1 WEnd $i -= 1 $sKeyOutput = StringMid($sChars, $iCur + 1, 1) & $sKeyOutput $iLast = $iCur WEnd If $isWin8 Then $sKeyOutput = StringMid($sKeyOutput, 2, $iLast) & "N" & StringTrimLeft($sKeyOutput, $iLast + 1) EndIf $FinalKey = StringRegExpReplace($sKeyOutput, '(\w{5})(\w{5})(\w{5})(\w{5})(\w{5})', '\1-\2-\3-\4-\5') Return $FinalKey EndFunc ;Software Installed Test Software Installed Test Software Installed Test Software Installed Test Software Installed Test Software Installed Test Func SWTest() Local $oWMIService = ObjGet("winmgmts:\\.\") Local $oColItems = $oWMIService.ExecQuery("Select * From Win32_Product", "WQL", 0x30) Local $SWDescription[4] If IsObj($oColItems) Then For $oObjectItem In $oColItems $SWDescription[0] &= $oObjectItem.Name $SWDescription[1] &= $oObjectItem.Vendor $SWDescription[2] &= $oObjectItem.Version $SWDescription[3] &= $oObjectItem.Caption Next Return $SWDescription EndIf Return SetError(1, 1, 0) EndFunc
  15. Awesome, I got it working Brewman. I just had a small misunderstanding on how the code was ran. I moved the GUIctrlread sections farther down the script to right before the transfer is exicuted and it works flawlessly. Thanks again everyone -cdjphoenix-
  16. I have made the suggested changes to my script by adding GUIctrlread to retreave the contents of the variables. Here is my new code: $tab3 = GUICtrlCreateTabItem("Data Transfer") GUICtrlCreateLabel("Source", 25, 100, 121, 21) $SourceDriveInput = GUICtrlCreateInput("", 70, 100, 121, 21) $SourceDrive = GUICtrlRead($SourceDriveInput) GUICtrlCreateLabel("Target", 25, 130, 121, 21) $TargetDriveInput = GUICtrlCreateInput("", 70, 130, 121, 21) $TargetDrive = GUICtrlRead($TargetDriveInput) GUICtrlCreateLabel("User", 25, 160, 121, 21) $SourceUserInput = GUICtrlCreateInput("", 70, 160, 121, 21) $SourceUser = GUICtrlRead($SourceUserInput) $DataTransferButton = GUICtrlCreateButton("Start", 25, 190, 75) RunWait(@ComSpec & " /c xcopy " & $SourceDrive & "Users" & $SourceUser & "Desktop* %userprofile%Desktop* /e /c /h") I have a new problem where i get cmd windows saying that "File Not Found - * ". I went with K-Marts suggestion of msboxing out my vairables and got some interesting results. TargetDrive = "Empty" TargetDriveInput= 34 SourceDrive = "Empty" SourceDriveInput = 32 SourceUser = "Empty" SourceUserInput = 36 The data entered for each was: TargetDrive = C: SourceDrive = C: SourceUser = Creed I hope this makes sense to someone because I'm lost. Thanks Again -cdjphoenix-
  17. I have ran into what I think is an odd problem with one of my scripts. I have a script that asks you for a source drive and a target drive along with the target user profile that you want to copy. When I had it setup to use multiple input boxes the script worked without a problem. Here is a example of some code from it: Dim $TargetDrive = InputBox("Target Drive", "Enter Target Drive Letter.", "", " M2") Dim $SourceDrive = InputBox("Source Drive", "Enter Source Drive Letter.", "", " M2") Dim $SourceUser = InputBox("Source User", "Enter Source User Name.", "") ;Win7 > Win7 if FileExists($TargetDrive & "\Users") and FileExists ($SourceDrive & "\Users") Then RunWait(@ComSpec & " /c xcopy " & $SourceDrive & "\Users\" & $SourceUser & "\Desktop\* %userprofile%\Desktop\* /e /c /h") However I merged this script into one of my other programs and gave it it's own tab. To get around the input boxes from popping up at the wrong time i decided to use GUICtrlCreateInput instead. Here is a section of the revised code: $tab3 = GUICtrlCreateTabItem("Data Transfer") GUICtrlCreateLabel("Source", 25, 100, 121, 21) $SourceDrive = GUICtrlCreateInput("", 70, 100, 121, 21) GUICtrlCreateLabel("Target", 25, 130, 121, 21) $TargetDrive = GUICtrlCreateInput("", 70, 130, 121, 21) GUICtrlCreateLabel("User", 25, 160, 121, 21) $SourceUser = GUICtrlCreateInput("", 70, 160, 121, 21) $DataTransferButton = GUICtrlCreateButton("Start", 25, 190, 75) case $msg = $DataTransferButton ;Win7 > Win7 if FileExists($TargetDrive & "\Users") and FileExists ($SourceDrive & "\Users") Then RunWait(@ComSpec & " /c xcopy " & $SourceDrive & "\Users\" & $SourceUser & "\Desktop\* %userprofile%\Desktop\* /e /c /h") Now when ever I try to run it, by hitting start, I just get a bunch of "invalid number of parameter" cmd windows. I have gone back and looked for errors/typos but everything was copy and pasted and is identical. I am completely lost here on why input boxes seem to work but GUICtrlCreateInput does not. Any help would be greatly appreciated. -Thanks- cdjphoenix
  18. Lets just leave it at Thanks then. I have it working and understand how do do it with other files. Thanks -cdjphoenix-
  19. Alright, I have it figured out. As it turns out you have to select Build rather than just right clicking and hit compile. I have one more question if you are feeling extra helpful today =). I have my image but it is massive and changing the settings in the script do not change it's size although it can change its location. Is there something I'm missing or should i just change its size in another program? Thanks Again -cdjphoenix-
  20. I have tried compiling it and have triple checked the path and no go yet. I'll play around with it and let you know if I figure out whats going on.
  21. Thanks for the input, I finaly got the resources.au3 loading without crashing my script. I have made a couple changes in to the example script to try to get the image loaded but I have had no luck. Any idea on what I have managed to break here? #include <GUIConstantsEx.au3> #include <resources.au3> #AutoIt3Wrapper_Res_File_Add=C:LetterHead.jpg, rt_rcdata, TEST_JPG_1 $gui = GUICreate("Data from resources simple example 1",420, 300) $pic1 = GUICtrlCreatePic("",0,0,250,50) _ResourceSetImageToCtrl($pic1, "TEST_JPG_1") ; set JPG image to picture control from resource GUISetState(@SW_SHOW) While 1 If GUIGetMsg() = -3 Then Exit WEnd
  22. I am currently trying to add an jpg to the main screen on my GUI and have it be available after I compile and move the exe off to another computer. I have tried to add the jpg as a resource, #AutoIt3Wrapper_Res_File_Add=C:\LetterHead.jpg, and then called it with GUICtrlCreatePic("LetterHead.jpg", 0, 0,250, 50). This seems to work on the machine, after compiling the exe I can delete the original jpg and it will still show up. However once i transfer the exe to another machine it no longer shows up. I have tried to play around with FileInstall but for whatever reason I cannot get it to work. I have also tried to use the UDF at but it does not want to load resources.au3 when I put #include <resources.au3>. Ideally I would like to do this without adding a UDF but I am all out of ideas and would appreciate any help you guys can offer. -cdjphoenix-
  23. Thanks, That was the problem and it works wonderfully. Although, I'm not sure if I should be happy my coding was right or sad that it was something simple that I should of known lol. Thanks Again.
  24. I am pretty new to AuotIt and thought that I had a decent grasp on how to do stuff but I cannot get my script to work right no matter what I try. Basically what I am trying to accomplish is making a script that will copy all the User files, such as My Documents and Desktop, off an external HDD that has an old Windows install to the local drive that is running the current Windows Install. Here is what I have so far: #include <GUIConstants.au3> ;Dim $TargetDrive = InputBox("Target Drive", "Enter Target Drive Letter.", "", " M2") Dim $SourceDrive = InputBox("Source Drive", "Enter Source Drive Letter.", "", " M2") Dim $SourceUser = InputBox("Source User", "Enter Source User Name.", "") DirCopy($SourceDrive & "\users\" & $SourceUser & "\Desktop", @UserProfileDir & "\Desktop\", 1) DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Documents", @MyDocumentsDir, 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\Downloads", @UserProfileDir & "\Downloads\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\Favorites", @UserProfileDir & "\Favorites\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Music", @UserProfileDir & "\My Music\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Pictures", @UserProfileDir & "\My Pictures\", 1) ;DirCopy($SourceDrive & "\users\" & $SourceUser & "\My Videos", @UserProfileDir & "\My Videos\", 1) As it stands the folders with just one word such as Downloads and Desktop work just fine but the folders with two words such as My Pictures and My Documents fail. Any insight on what I am doing wrong would be greatly apreciated. Side Note: I know that some of the lines are commented out, I disabled them so I could test one working line of code vs one broken line. Thanks
×
×
  • Create New...