
CalBoy
Members-
Posts
16 -
Joined
-
Last visited
CalBoy's Achievements

Seeker (1/7)
0
Reputation
-
Hi guys. I just need a hand with a quick renaming script. The script that I am looking at creating is one that renaming any type of file. As an example we will use tv shows. What happens is that the user inputs a series name and then the script finds all of the names of the files in a directory (wheather this be all at once or one at a time it doesn't matter) once this is done the script counts in five characters to dodge the characters at the front writes the series name that the user input earlier and then the final parts of the filename. Is this possible? I thought about writing the filename to a array but then lost my way :/. Any help with this would be great! If I didn't explain myself well enough then please let me know and I will try and reexplain! Thanks in advance, CalBoy
-
Only enable certain characters in a GUICtrlInput
CalBoy replied to CalBoy's topic in AutoIt GUI Help and Support
OH! And how could I go around disabling editing in a combo box? Like one of those drop down lists. Currently when users pick a item out of the list they can sometimes put a space in on the end or delete a character without noticing, this then causes the script to error when it looks for that variable. Is there a way to stop the combo box from being edited but still have the different choices within it? Thanks, CalBoy -
Only enable certain characters in a GUICtrlInput
CalBoy replied to CalBoy's topic in AutoIt GUI Help and Support
Thank you both very much. M23 you are a champion. That worked perfectly. Can't thank you enough how much you have helped me. Could I ask one more favour? I'm having trouble writing to a text document during a deployment process. When the script writes lines into the text file currently it errors sometimes when the line has " in it, instead of putting one " in it puts two. So a line that should be cmd.exe /c "etc etc", turns into cmd.exe /c ""etc etc"". Now for AutoIT if I am putting a " in a line I have to use "" in the line correct? I can't see what I have done wrong. Now below I have had to cut down the script as it contains sensitive data I'm afraid :/ but could you see if I have written anything wrong? Thanks alot. $name = GUICtrlRead($Computername) $softchoice = GUICtrlRead($installlist) _FileCreate("x:\sysprep.inf") $sysprep = FileOpen("x:\sysprep.inf", 1) FileWriteLine($sysprep, "[UserData]") FileWriteLine($sysprep, " FullName=""Admin""") FileWriteLine($sysprep, " OrgName=""Awesome""") FileWriteLine($sysprep, " ComputerName=" & $name) FileWriteLine($sysprep, "") FileWriteLine($sysprep, "[sysprep]") FileWriteLine($sysprep, "") FileWriteLine($sysprep, "[GuiRunOnce]") FileWriteLine($sysprep, "Command0=""cmd /c etc command""") If $softchoice = "None" Then Else FileWriteLine($sysprep, "Command0=""cmd /c rundll32.exe user32.dll, LockWorkStation""") If $softchoice = "Default" Then FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") Else EndIf If $softchoice = "Computing" Then FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") Else EndIf EndIf FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") FileWriteLine($sysprep, "Command0=""cmd /c SENSITIVE""") FileClose($sysprep) If I haven't made sense please tell me! Any help would be awesome. Thanks heaps. CalBoy -
Thaanks for that BlockInputEx script. That should help greatly, with creating the events to unlock the script. The disabling of Ctrl+Atl+Del doesn't quite fit this scenario though, unless I'm not thinking enough! I do want to lock the computer as later dates so disabling it altogether isn't the best option because it then means I have to go back around to change the settings all over again. I'm not sure how if at all it would be possible to make the script continue to function even though the computer is locked. Well past my AutoIT skills. Thanks everyone for the help CalBoy
-
Just tested your script and it does not work once the computer is locked, and then once it is unlocked the script fails to keep hold of the mouse and keyboard. Thanks everyone for your help but it seems this is not possible, looks like I will be walking around for a while yet trying to stop users from stuffing up my install! Thanks CalBoy
-
Thanks man! Thats getting somewhere! Now. Would this script work when the computer it locked? Like not just the mouse and keyboard but Windows+L? Also if I were to implement a key combination into it that would enable unlocking of the script, would the script be able to recognise the keys being pressed when the computer is locked, not just via the script but Windows+L? Thanks man CalBoy
-
I'm sorry but I'm not sure that you get the what I intend to do with this script. I am a Administrator for the deployment and up keep of the network a plan on using this on. Thanks for your help. I don't plan on changing the users settings in my GP just so that they do not stuff up my deployment process. Would there be any other ways for me to stop the users logging in over the top of me without changing their GP settings. A script like this was obviously my first choice. I mean no offence, just trying to a find a answer, CalBoy
-
Sweet. Would the script work whilst the computer is locked though? Also would there be any way to block the Ctrl+Alt+Del function? As the main reason for why I am creating the script would be to make sure that users can't unlock the computer and log over the top of the current user unless they knew how to unlock the script, so pretty much just disable Ctrl+Alt+Del until the script is unlocked. Am I making sense? Would the script be able to recognise the key combinations whilst the computer was locked? Thanks for your help. CalBoy
-
Add current user to administrators group with runas
CalBoy replied to EricL's topic in AutoIt General Help and Support
I guess you could add them using "net localgroup administrator YOURUSER /add" that should add them to the admin group. However I'm not sure if this will require a logon logoff to take effect or not. You might be able to run a gpupdate meaning you won't have to log off. But I can't be sure. Hope this helps CalBoy -
Hi all, I was wondering if anyone could help me with a script idea, well tell me if it were possible or not. What I was wondering was if were possible to create a script that would lock the keyboard and mouse (I know it can be doen with the mouse but what about the keyboard) and then continue working once the computer was locked. THEN to activate the keyboard and mouse again the user has to type in a key combination of some sort before the AutoIT script unlocks. Would this be possible? Basic idea of the script is to stop people unlocking the computer and stopping it from doing tasks or logging over the top. Any ideas? Would the script continue even though the computer is locked? Any input is greatly appreciated. Thanks CalBoy
-
Getting callbacks from gximage_com.dll or wimgapi.dll
CalBoy replied to CalBoy's topic in AutoIt GUI Help and Support
So I found some code in these forums and edited to to work with applying. #include <ProgressConstants.au3> ; You need it, but I am sure you had it! <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $objWIM = ObjCreate("GimageX.GimageXCtrl") If Not IsObj($objWIM) Then Runwait("regsvr32.exe /s gimagex_com.dll") $objWIM = ObjCreate("GimageX.GimageXCtrl") If Not IsObj($objWIM) Then MsgBox(0, "Error", "$objWIM isn't a valid Object.") Exit EndIf EndIf $obj_evenement = ObjEvent($objWIM, "WimEvent_") If @error Then MsgBox(0, "AutoIt COM Test", _ "WimEvent have this error: " & Hex(@error, 8)) Exit EndIf GUICreate("Progress Bar", 220, 100, (@DesktopWidth - 220) / 2, (@DesktopHeight - 100) / 2) $progress = GUICtrlCreateProgress(10, 10, 200, 20, $PBS_SMOOTH) $button = GUICtrlCreateButton("Percentage", 80, 65, 65, 25) $labelprogress = GUICtrlCreateLabel(" Complete", 70, 40, 100, 15) GUISetState() With $objWIM .Source = "c:\boot.wim" .Destination = "c:\test2\" .ImageIndex = 1 .Check = True .Verify = True EndWith ProgressOn("Compilation", "Compilation progression") $objWIM.ApplyImage Func WimEvent_Progress($Percent, $TimeRemaining) Do $msg = GUIGetMsg() If $msg = $button Then MsgBox(64, "Percentage", $Percent & "% Completed", 3) EndIf ; Update the progress in this section GUICtrlSetData($progress, $Percent + 1) GUICtrlSetData($progress, $Percent) GUICtrlSetData($labelprogress, $Percent & "% Completed") Until $Percent <= 100 EndFunc Sleep(200000) The problems with the code at the moment is that it hangs and doesn't update the progress correctly until the wim has finished applying and even then it only shows as 37% complete. Currently I am using gimagex_com.dll to apply the WIM. I am unsure whether it is the .dll which is the program or my scripting. Has anyone done anything like this with AutoIT and found this problem? Is there anything wrong with my code :/? Any help is very much appreciated. CalBoy -
I'm sorry if I use the incorrect terminology, but I will try my best! Any help is greatly appreciated! Currently I am attempting to complete a GUI for a Windows 7 Deployment through WinPE, the last thing I need to do is finish off the progress bar for the actual applying of the WIM. Currently I am applying it via ImageX and getting the progress via comparing the amount of space taken up on the drive, this however can not work correctly some of the time and the computer restarts before the WIM has finished applying and its messy with a CMD window open, what I wish to do somehow is use gximage_com.dll or wimgapi.dll to apply my WIM, which would mean no CMD window. So my actual question is, how would I go around putting one of these two dlls within the script and then get the call backs from them to update the progress bar? Current progress bar script. (Thanks to M23 for helping me clean it up) ;finds the boot letter $registry = RegRead("HKLM\SYSTEM\CurrentControlSet\Control\", "PEBootRamdiskSourceDrive") ;applies the wim $imagex = ShellExecute("imagex.exe", "/apply " & $registry & "sources\install.wim 1 H:\", @ScriptDir) ;minimises the command window WinMinimizeAll() ;creates the slider ;Deletes previous UI GUIDelete() GUICreate("Progress Bar", 220, 100, (@DesktopWidth - 220) / 2, (@DesktopHeight - 100) / 2) $progress = GUICtrlCreateProgress(10, 10, 200, 20, $PBS_SMOOTH) $button = GUICtrlCreateButton("Percentage", 80, 65, 65, 25) $labelprogress = GUICtrlCreateLabel(" Complete", 70, 40, 100, 15) GUISetState() Do ; Look for the button in this section $msg = GUIGetMsg() If $msg = $button Then MsgBox(64, "Percentage", $Percentage & "% Completed", 3) EndIf ; Update the progress in this section $Free = DriveSpaceFree("H:\") $total = DriveSpaceTotal("H:\") $taken = $total - $Free ;based on the total size of the wim which is 15802 $Percentage = Round($taken / (15802 / 100), 0) GUICtrlSetData($progress, $Percentage + 1) GUICtrlSetData($progress, $Percentage) GUICtrlSetData($labelprogress, $Percentage & "% Completed") Sleep(50) Until $Percentage >= 100 Thanks in advance for any help CalBoy
-
Interesting! Your little + 1 trick actually helped quite a bit even on Windows 7 I will make sure to use that in the future! I might have to include a quick sleep function though as I don't want the computer restarting before imagex is completely finished. While I have you (sorry to ask another question) do you know of a way to get the callbacks from wimgapi.dll or gimagex_com.dll? I would much rather image using one of those two and get the percentage through the callbacks, that way I could be 100% sure that the wim has finished applying, plus I wouldn't have a messy CMD window open. If not would there be a way for AutoIT to look at the current CMD window to get the % of completion? The thought just occurred to me today! Thanks for all your help man CalBoy
-
You kind sir are awesome! Thanks for the fast reply, very much appreciated. I have no idea why I said slider, shouldn't post late at night I guess. I will test tomorrow afternoon as I do not have the WIM file at the moment. I use GUIDelete() right at the start of the script to delete a previous part of the GUI, not a very good way to do it but it does the trick. One question however, the little Vista trick that you wrote down. I don't exactly see what that would have to do with the way that the progress bar would update, if I were to be adding 1 onto the progress every time wouldn't the progress bar finish before the WIM had finished applying? Sorry if I am looking at it incorrectly. It would be greatly appreciated if you could explain a little bit more what you are trying to show me there. Otherwise once that part of the script is compiled and completed my entire custom Windows 7 deployment is completed with the end of the GUI and the boot WIM and is ready to start being used. Very happy. Thanks once again CalBoy