Jump to content

vickerps

Active Members
  • Posts

    175
  • Joined

  • Last visited

Everything posted by vickerps

  1. Thanks LarsJ I can see lot of other ways I could use the MessageHandler() so thank you for this
  2. Thanks for your post but no it doesn't solve the issue. In fact by adding $WS_EX_CONTROLPARENT it detaches the child from the parent so it is moveable which something I don't want. Unless anything has a better idea I think I'm going to have to create the buttons on the child form instead of the parent which is something I didn't want to do. here a workable example of what I am trying to achieve. All I want is the tab order to include the button on the parent form. #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.10.2 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Global $gFontName = 'Tahoma' Global $gFontSizeHeaderLarge = 18 Global $gFontSizeDetailLarge = 12 Global $gFontSizeDetailNormal = 10 Global $gFontSizeDetailSmall = 8 Global $gFontSizeButtonNormal = 9 Global $gFontSizeButtonSmall = 8 Global $gAnwserFile = @ScriptDir &'\'& StringTrimRight(@ScriptName,3) & 'ini' #INCLUDE-ONCE #INCLUDE <Array.au3> #INCLUDE <ButtonConstants.au3> #INCLUDE <ComboConstants.au3> #INCLUDE <EditConstants.au3> #INCLUDE <File.au3> #INCLUDE <FontConstants.au3> #INCLUDE <GUIConstants.au3> #INCLUDE <GUIConstantsEx.au3> #INCLUDE <GuiEdit.au3> #INCLUDE <GuiIPAddress.au3> #INCLUDE <ListviewConstants.au3> #INCLUDE <Process.au3> #INCLUDE <ProgressConstants.au3> #INCLUDE <StaticConstants.au3> #INCLUDE <_SQL.au3> #INCLUDE <UpdownConstants.au3> #INCLUDE <WinAPI.au3> #INCLUDE <WindowsConstants.au3> IF @DesktopWidth = 800 AND @DesktopHeight = 600 Then $gFW = @DesktopWidth/1.2 $gFH = @DesktopHeight/1.25 $gFX = @DesktopWidth/9.5 $gFY = @DesktopHeight/11 ElseIf @DesktopWidth = 1024 AND @DesktopHeight = 768 Then $gFW = @DesktopWidth/1.4 $gFH = @DesktopHeight/1.6 $gFX = @DesktopWidth/6 $gFY = @DesktopHeight/5 ElseIf @DesktopWidth = 1280 AND @DesktopHeight = 720 Then $gFW = @DesktopWidth/1.6 $gFH = @DesktopHeight/1.5 $gFX = @DesktopWidth/4.5 $gFY = @DesktopHeight/6 ElseIf @DesktopWidth = 1280 AND @DesktopHeight = 1022 Then $gFW = @DesktopWidth/1.6 $gFH = @DesktopHeight/2.1 $gFX = @DesktopWidth/4.5 $gFY = @DesktopHeight/6 ElseIf @DesktopWidth = 1280 AND @DesktopHeight = 1024 Then $gFW = @DesktopWidth/1.6 $gFH = @DesktopHeight/2.1 $gFX = @DesktopWidth/4.5 $gFY = @DesktopHeight/6 ElseIf @DesktopWidth = 1920 AND @DesktopHeight = 1080 Then $gFW = @DesktopWidth/2 $gFH = @DesktopHeight/1.9 $gFX = @DesktopWidth/3.5 $gFY = @DesktopHeight/4 Else Msgbox(16,'Resolution not supported','This resolution ( '& @DesktopWidth & 'x' & @DesktopHeight & ' ) has not been predicted.') $gFW = @DesktopWidth/1.2 $gFH = @DesktopHeight/1.25 $gFX = @DesktopWidth/9.5 $gFY = @DesktopHeight/11 Endif $gWorkingFile = @ScriptDir &'\'& StringTrimRight(@ScriptName,4) & '_Answers.log' $gLookupFile = StringStripWS(IniRead($gAnwserFile,'General Settings','LookupFile',@ScriptDir & '\Lookup.ini'),3) $gLog = StringStripWS(IniRead($gAnwserFile,'General Settings','Log', StringTrimRight(@ScriptName,4) & '_Actions.log'),3) $gGuiTitle=StringStripWS(IniRead($gAnwserFile,'General Settings','GuiTitle',''),3) $gCustomer=StringStripWS(IniRead($gAnwserFile,'General Settings','Customer',''),3) $gComputerNamePrefix=StringStripWS(IniRead($gAnwserFile,'General Settings','ComputerNamePrefix',''),3) $gComputerNameDivider=StringStripWS(IniRead($gAnwserFile,'General Settings','ComputerNameDivider',''),3) $gForm = GuiCreate($gGuiTitle & ' ' & StringUpper($gCustomer),$gFW,$gFH,$gFX,$gFY,BITOR($WS_CAPTION,$WS_SYSMENU,$WS_MINIMIZEBOX)) GUICtrlSetState($gForm,$GUI_DISABLE) GUISetBkColor(0xF0F0F0,$gForm) GUICtrlSetDefBkColor(0xF0F0F0) $Hdr = GUICtrlCreateGraphic(0,70 ,$gFW, 5,$SS_SUNKEN) $Lbl_InstVer = GUICtrlCreateLabel('v' & FileGetVersion(@ScriptFullPath,'FileVersion'),10,0,$gFW-20,12,$SS_RIGHT) GUICtrlSetState($Lbl_InstVer,$GUI_DISABLE) GUICtrlSetFont($Lbl_InstVer,$gFontSizeDetailSmall,$FW_NORMAL,0,$gFontName) $gLbl_Title = GUICtrlCreateLabel('',10,20,$gFW-20,35) GUICtrlSetFont($gLbl_Title,$gFontSizeHeaderLarge,$FW_NORMAL,0,$gFontName) $Ftr = GUICtrlCreateGraphic(0,$gFH-55,$gFW,5,$SS_SUNKEN) $gB_Button1 = GUICtrlCreateButton('&Next',$gFW-102,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button1,0xF0F0F0) GUICtrlSetFont($gB_Button1,$gFontSizeButtonNormal) $gB_Button2 = GUICtrlCreateButton('&Reject',$gFW-205,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button2,0xF0F0F0) GUICtrlSetFont($gB_Button2,$gFontSizeButtonNormal) GUICtrlSetState($gB_Button2,$GUI_Hide) $gB_Button3 = GUICtrlCreateButton('&Log',05,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button3,0xF0F0F0) GUICtrlSetFont($gB_Button3,$gFontSizeButtonNormal) GUICtrlSetState($gB_Button3,$GUI_Hide) GUISetState(@SW_SHOW,$gForm) $Chk = Child($gFW,$gFH-140,0,80) Func Child($FW,$FH,$FX,$FY) $F = GuiCreate('',$FW,$FH,$FX,$FY,$WS_Popup,$WS_EX_MDICHILD,$gForm) GUICtrlSetData($gLbl_Title,'') GUISetBkColor(0xF0F0F0,$F) GUISetFont($gFontSizeDetailLarge,$FW_NORMAL,0,$gFontName) $Lbl_Message1 = GUICtrlCreateLabel('',10,10,$FW-20,40) $Lbl_Computername = GUICtrlCreateLabel('&Computer name:',60,70,130,20) $I_ComputerName = GUICtrlCreateInput(@ComputerName,200,70,150,25,$ES_UPPERCASE) $Lbl_WorkGroup = GUICtrlCreateLabel('&WorkGroup:',60,100,130,20) $I_WorkGroup = GUICtrlCreateInput('',200,100,150,25,$ES_UPPERCASE) $Lbl_Message2 = GUICtrlCreateLabel('',10,140,$FW-20,40) $Lbl_IP = GUICtrlCreateLabel('Static &IP address:',60,200,130,20) $I_IP = _GUICtrlIpAddress_Create ($F,200,200,150,25) _GUICtrlIpAddress_SetFont($I_IP,"Arial",12) $Lbl_Subnet = GUICtrlCreateLabel('Subnet &mask:',60,230,130,25) $I_Subnet = _GUICtrlIpAddress_Create($F,200,230,150,25) _GUICtrlIpAddress_SetFont($I_Subnet,"Arial",12) $Lbl_Gateway= GUICtrlCreateLabel('Default &gateway:',60,260,130,20) $I_Gateway = _GUICtrlIpAddress_Create($F,200,260,150,25) _GUICtrlIpAddress_SetFont($I_Gateway,"Arial",12) $Lbl_PDNS= GUICtrlCreateLabel('&Preferred DNS:',60,290,130,20) $I_PDNS = _GUICtrlIpAddress_Create($F,200,290,150,25,$WS_TABSTOP) _GUICtrlIpAddress_SetFont($I_PDNS,"Arial",12) $Lbl_ADNS= GUICtrlCreateLabel('&Alternate DNS:',60,320,130,20) $I_ADNS = _GUICtrlIpAddress_Create($F,200,320,150,25,$WS_TABSTOP) _GUICtrlIpAddress_SetFont($I_ADNS,"Arial",12) GUISetState(@SW_SHOW,$F) WHILE 1 $Msg=GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE $RVal = 1 ExitLoop Case $gB_Button1 ExitLoop EndSwitch WEnd EndFunc
  3. Hi I'm wondering if it is possible to tab cycle between controls that are on different windows. currently if the child window get focus and I can tab across all of its control but the tab cycle ignores the buttons that exist on the parent windows. $gForm = GuiCreate($gGuiTitle & ' ' & StringUpper($gCustomer),$gFW,$gFH,$gFX,$gFY,BITOR($WS_CAPTION,$WS_SYSMENU,$WS_MINIMIZEBOX)) GUICtrlSetState($gForm,$GUI_DISABLE) GUISetBkColor(0xF0F0F0,$gForm) GUICtrlSetDefBkColor(0xF0F0F0) $Hdr = GUICtrlCreateGraphic(0,70 ,$gFW, 5,$SS_SUNKEN) $Lbl_InstVer = GUICtrlCreateLabel('v' & FileGetVersion(@ScriptFullPath,'FileVersion'),10,0,$gFW-20,12,$SS_RIGHT) GUICtrlSetState($Lbl_InstVer,$GUI_DISABLE) GUICtrlSetFont($Lbl_InstVer,$gFontSizeDetailSmall,$FW_NORMAL,0,$gFontName) $gLbl_Title = GUICtrlCreateLabel('',10,20,$gFW-20,35) GUICtrlSetFont($gLbl_Title,$gFontSizeHeaderLarge,$FW_NORMAL,0,$gFontName) $Ftr = GUICtrlCreateGraphic(0,$gFH-55,$gFW,5,$SS_SUNKEN) $gB_Button1 = GUICtrlCreateButton('&Next',$gFW-102,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button1,0xF0F0F0) GUICtrlSetFont($gB_Button1,$gFontSizeButtonNormal) $gB_Button2 = GUICtrlCreateButton('&Reject',$gFW-205,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button2,0xF0F0F0) GUICtrlSetFont($gB_Button2,$gFontSizeButtonNormal) GUICtrlSetState($gB_Button2,$GUI_Hide) $gB_Button3 = GUICtrlCreateButton('&Log',05,$gFH-43,100,40,$BS_DEFPUSHBUTTON) GUICtrlSetBkColor($gB_Button3,0xF0F0F0) GUICtrlSetFont($gB_Button3,$gFontSizeButtonNormal) GUICtrlSetState($gB_Button3,$GUI_Hide) GUISetState(@SW_SHOW,$gForm) $F = GuiCreate('',$FW,$FH,$FX,$FY,$WS_Popup,$WS_EX_MDICHILD,$gForm) GUICtrlSetData($gLbl_Title,$Title) GUISetBkColor(0xF0F0F0,$F) GUISetFont($gFontSizeDetailLarge,$FW_NORMAL,0,$gFontName) $Lbl_Message1 = GUICtrlCreateLabel($Message1,10,10,$FW-20,40) $Lbl_Computername = GUICtrlCreateLabel('&Computer name:',60,70,130,20) $I_ComputerName = GUICtrlCreateInput($A_ComputerName,200,70,150,25,$ES_UPPERCASE) $Lbl_WorkGroup = GUICtrlCreateLabel('&WorkGroup:',60,100,130,20) $I_WorkGroup = GUICtrlCreateInput($A_WorkGroup,200,100,150,25,$ES_UPPERCASE) $Lbl_Message2 = GUICtrlCreateLabel($Message2,10,140,$FW-20,40) $Lbl_IP = GUICtrlCreateLabel('Static &IP address:',60,200,130,20) $I_IP = _GUICtrlIpAddress_Create ($F,200,200,150,25) _GUICtrlIpAddress_SetFont($I_IP,"Arial",12) IF NOT ($A_IP='') THEN _GUICtrlIpAddress_Set ($I_IP,$A_IP) $Lbl_Subnet = GUICtrlCreateLabel('Subnet &mask:',60,230,130,25) $I_Subnet = _GUICtrlIpAddress_Create($F,200,230,150,25) _GUICtrlIpAddress_SetFont($I_Subnet,"Arial",12) IF NOT ($A_Subnet='') THEN _GUICtrlIpAddress_Set ($I_Subnet,$A_Subnet) $Lbl_Gateway= GUICtrlCreateLabel('Default &gateway:',60,260,130,20) $I_Gateway = _GUICtrlIpAddress_Create($F,200,260,150,25) _GUICtrlIpAddress_SetFont($I_Gateway,"Arial",12) IF NOT ($A_Gateway='') THEN _GUICtrlIpAddress_Set ($I_Gateway,$A_Gateway) $Lbl_PDNS= GUICtrlCreateLabel('&Preferred DNS:',60,290,130,20) $I_PDNS = _GUICtrlIpAddress_Create($F,200,290,150,25,$WS_TABSTOP) _GUICtrlIpAddress_SetFont($I_PDNS,"Arial",12) IF NOT ($A_PDNS='') THEN _GUICtrlIpAddress_Set ($I_PDNS,$A_PDNS) $Lbl_ADNS= GUICtrlCreateLabel('&Alternate DNS:',60,320,130,20) $I_ADNS = _GUICtrlIpAddress_Create($F,200,320,150,25,$WS_TABSTOP) _GUICtrlIpAddress_SetFont($I_ADNS,"Arial",12) IF NOT ($A_ADNS='') THEN _GUICtrlIpAddress_Set ($I_ADNS,$A_ADNS)
  4. Hi Guys I have recently found that autoit can now link into Powershell which is great news. However things are never simple and i have found a flaw which im hoping someone can solve for me. I have a problem with any dll compiled from .net 4. For example the following script work fine with .net 2 dll but doesn't work .net 4. #include <GUIConstants.au3> #include <Array.au3> #include <File.au3> Dim $ActiveXPosh Const $OUTPUT_CONSOLE = 0 Const $OUTPUT_WINDOW = 1 Const $OUTPUT_BUFFER = 2 CreateActiveXPosh() $File = FileOpen('result.txt',10) $dll = "C:\Windows\system32\mfcm100.dll" $sPSCmd = '[Reflection.Assembly]::LoadFrom("' & $dll &'").ImageRuntimeVersion' $val = ExecuteCMD($sPSCmd) Filewrite($File,$Dll & ' ' & $val & @CRLF) $dll = "C:\Windows\system32\dnscmmc.dll" $sPSCmd = '[Reflection.Assembly]::LoadFrom("' & $dll &'").ImageRuntimeVersion' $val = ExecuteCMD($sPSCmd) Filewrite($File,$Dll & ' ' & $val & @CRLF) Func CreateActiveXPosh() Local $success ; Create the PowerShell connector object $ActiveXPosh = ObjCreate("SAPIEN.ActiveXPoSH") $success = $ActiveXPosh.Init(False) ;Do not load profiles If $success <> 0 then Consolewrite( "Init failed" & @CR) endif If $ActiveXPosh.IsPowerShellInstalled Then Consolewrite( "Ready to run PowerShell commands" & @CR & @CR) Else Consolewrite( "PowerShell not installed" & @CR & @CR) EndIf ; Set the output mode $ActiveXPosh.OutputMode = $OUTPUT_CONSOLE $ActiveXPosh.OutputWidth = 250 EndFunc Func ExecuteCMD($sPSCmd) Local $outtext = '' ; Set the $OUTPUT mode to $BUFFER $ActiveXPosh.OutputMode = $OUTPUT_BUFFER $ActiveXPosh.Execute($sPSCmd) $outtext = $ActiveXPosh.OutputString $ActiveXPosh.ClearOutput() Return $outtext EndFunc By trawling the internet I have found to interigate .net4 dll's with powershell you need to add a config file (Powershell.exe.config) <?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0.30319"/> <supportedRuntime version="v2.0.50727"/> </startup> </configuration> However adding this doesn't work from a autoit script. Can anyone help?
  5. Ok think i solved my own problem $F = GuiCreate('',$fW,$fh,$fx,$fy,$WS_Popup,$WS_EX_MDICHILD,$Form)
  6. Anyone know of a way to give focus to a child gui form for the purpose of tabing between controls? Any help would be appreciated #include <WindowsConstants.au3> #include <GUIConstants.au3> #include <ComboConstants.au3> #Include <GuiIPAddress.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <GUIConstants.au3> Global $Lbl_Title,$Version,$AnwserFile,$WorkingFile,$Form,$Bmp,$fW = @DesktopWidth/2, $fh = @DesktopHeight/2, $fx = @DesktopWidth/3.5, $fy = @DesktopHeight/4,$B_Button1 $Version = 'V1.0' $AnwserFile = StringTrimRight(@ScriptName,3) & "ini" $WorkingFile = @ScriptDir & "\Working.ini" $BMP = @ScriptDir & "\BackGround.bmp" $Title = IniRead ($AnwserFile,"Settings","Title","TITLE GOES HERE") $Form = GuiCreate('',$fW,$fh,$fx,$fy,$WS_CAPTION+$WS_SYSMENU+$WS_MINIMIZEBOX) GUICtrlCreatePic ($BMP,0,0,$fW,$fh) GUICtrlSetState(-1,$GUI_DISABLE) $Lbl_InstVer = GUICtrlCreateLabel($Version,10,0,$fW-20,12,$SS_RIGHT) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,8) GUICtrlSetState(-1,$GUI_DISABLE) $Lbl_Title = GUICtrlCreateLabel($Title,10,$fh-$fh+20,$fW-20,35) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,18,250,0,'Tahoma') $Hdr = GUICtrlCreateGraphic(0, $fh-$fh+60 ,$fW, 5,$SS_SUNKEN) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) $Ftr = GUICtrlCreateGraphic(0, $fh-55,$fW,5,$SS_SUNKEN) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUISetState(@SW_SHOW,$Form) Form2($fw,$fh,0,0) Func form2($fw,$fh,$fx,$Fy) Global $B_Button1 $Message1 = "No Message provided" $F = GuiCreate('',$fW,$fh,$fx,$fy,$WS_CHILD,'',$Form) GUICtrlSetData($Lbl_Title,$Title) $Lbl_Message1 = GUICtrlCreateLabel($Message1,10,70,$FW-20,65) $Lbl_Computername = GUICtrlCreateLabel("&Computer name:",60,140,130,20) $I_ComputerName = GUICtrlCreateInput('',200,140,150,20,$ES_UPPERCASE) $Lbl_IP = GUICtrlCreateLabel("Static &IP address:",60,280,130,20) $I_IP = _GUICtrlIpAddress_Create ($F,200,280,110,20) $Lbl_Subnet = GUICtrlCreateLabel("Subnet &mask:",60,305,130,20) $I_Subnet = _GUICtrlIpAddress_Create($F,200,305,110,20) $Lbl_Gateway= GUICtrlCreateLabel("Default &gateway:",60,330,130,20) $I_Gateway = _GUICtrlIpAddress_Create($F,200,330,110,20) $B_Button1 = GUICtrlCreateButton('&Next',$fW-102,$fh-43,100,40,$BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW,$F) WHILE 1 $Msg=GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit 1 Case $B_Button1 ExitLoop EndSwitch WEnd GUIDelete($F) EndFunc
  7. Hi Guys Im trying to create a script that allow someone to enter a number of ip adresses. when i use _GUICtrlIpAddress_Create on the 17th address the box disappears from the sub form. Anyone tell me why this is? ;Include Functions #Include <GuiIPAddress.au3> #INCLUDE <GUIConstants.au3> #include <Array.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ListviewConstants.au3> Global $Avarray[30],$I_IP $BMP = @ScriptDir & "\BackGround.bmp" $TextColour = "0x000000" $POSTotal = 20 $n=1 Opt("GUICoordMode",1) $F = GuiCreate("Torex",@DesktopWidth,@DesktopHeight,0,0,$WS_SYSMENU,$WS_EX_TOPMOST) GUICtrlCreatePic ($BMP,0,0,@DesktopWidth,@DesktopHeight) GUICtrlSetState(-1,$GUI_DISABLE) $E_Nodes_IPs = GUICtrlCreateListView(" | ",60,210,295,450,$LVS_NOCOLUMNHEADER+$LVS_NOSORTHEADER) GUICtrlSetFont(-1,12) GUISetState(@SW_SHOW,$F) IF $n < $postotal Then Do Subform($n) $AVarray[$n] = GUICtrlCreateListViewItem($n & "|" & _GUICtrlIpAddress_Get($I_IP),$E_Nodes_IPs) ;$AVarray[$n] = GUICtrlCreateListViewItem("Till" & $n & "|" & GUICtrlRead($I_IP), $E_Nodes_IPs) $n = $n +1 until $n > $POSTotal endif Func Subform($x) GUISetState(@SW_DISABLE,$F) $SubF = GuiCreate("Manual Setup",400 ,200,500,230,$DS_CONTEXTHELP,$WS_EX_TOPMOST) GUICtrlCreatePic ($BMP,0,0,400,200) GUICtrlSetState(-1,$GUI_DISABLE) $Lbl_Message = GUICtrlCreateLabel($x ,10,10,390,20) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,12) GUICtrlSetColor (-1,$TextColour) $Lbl_IP = GUICtrlCreateLabel("IP address:",10,60,130,20) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,12) GUICtrlSetColor (-1,$TextColour) $I_IP = _GUICtrlIpAddress_Create ($SubF,140,60,110,20) ;$I_IP = GUICtrlCreateInput("",140,60,110,20) GUICtrlSetLimit(-1,15) GUICtrlSetFont(-1,10) $B_OK = GUICtrlCreateButton("&OK",300,137,90,35) GUISetState(@SW_SHOW,$SubF) While 1 $Msg=GUIGetMsg() Switch $Msg Case $B_OK ExitLoop EndSwitch Wend GUISetState(@SW_HIDE,$SubF) GUISetState(@SW_ENABLE,$F) ENdfunc
  8. Works perfectly! Thankyou all for the help very much appreciated
  9. Thanks for you help both of you. Although good to know Water's scripts are all based around AD. I am doing this on a Local system account and the AD script don't work. I have tried wrapping brackets around $User.put("Userflags", $flags OR "&H10000") but no joy.
  10. Hi guys Can someone help me convert this vbs script so that i can include it in my autoit script. I don't want to run it as a seperate script if i can help it. The following is a vbs script for changing a user account "Password never expires setting" strComputer = "." strUser = "temp" Set User = Getobject("WinNT://" & strComputer & "/" & strUser) Flags = User.Get("UserFlags") User.put "Userflags", flags OR &H10000 user.setinfo Set User = nothing This is my attempt to change it to autoit $strComputer = "." $strUser = "temp" $User = ObjGet("WinNT://" & $strComputer & "/" & $strUser) $Flags = $User.Get("UserFlags") $User.put "Userflags", $flags OR "&H10000" $user.setinfo $User = "nothing" It error on the $user.put line. Thanks in advance for any help.
  11. Solved my problem by understand ChrisL _sql.au3 Thanks ChrisL for your hard work
  12. Hi I wondering if someone alot smarter than I can solve a problem of mine. I need to update a table within a .mdf file with either autoit (preferable) or somthing like vbs For example Database = MYDB.mdf Table= customers I need to update [name] to equal Jack where Name = Paul. Any help would be appreciated
  13. Thanks for the reply. Yeah OpenSSL does seem the way to do it but I can't find out how you use OpenSSL statements. I think you need Visual studio or something.
  14. Hi I wondering if any one know how to retrieve information held within a .CRT file I would like to read the expiry information which found within the details tab of most .CRT files Thanks in advance for any help
  15. Does anyone know of a way to copy an open file. I have found a way which work great http://blogs.msdn.com/b/adioltean/archive/2005/01/05/346793.aspx I have also failed abysmally in trying to convert it to an autoit script here is my failed attempt ; Script Start - Add your code below here #include <Process.au3> local $CALLBACK_SCRIPT If NOT ($CALLBACK_SCRIPT=="") Then IS_CALLBACK() IF $CmdLine[0] = 0 Then Msgbox (0,"Source and dest","must enter source and dest") $s = $CmdLine[1] $SOURCE_DRIVE_LETTER=StringLeft($s,2) $SOURCE_RELATIVE_PATH=StringtrimLeft($s,3) $DESTINATION_PATH=$CmdLine[2] $CALLBACK_SCRIPT=@ScriptFullPath $TEMP_GENERATED_SCRIPT="GeneratedVarsTempScript.cmd" _Rundos("\vshadow.exe -script=" & $TEMP_GENERATED_SCRIPT & "-exec=" & $CALLBACK_SCRIPT &" "& $SOURCE_DRIVE_LETTER) FileDelete ($TEMP_GENERATED_SCRIPT) Func IS_CALLBACK() Run($TEMP_GENERATED_SCRIPT) filecopy ($SHADOW_DEVICE_1 & "\" & $SOURCE_RELATIVE_PATH,$DESTINATION_PATH) EndFunc
  16. Thanks for the reply Melba23 I see your point but rather than replacing the value with 255 it would be better if it simply remove the entry all together and blank the incorrectly entered octet
  17. Hi Does anyone have the problem when using _GUICtrlIpAddress_Create and the user is an idiot and enters a value greater than 255. The Function correct the user error by reverting it to 255 but then stop movement to next octet. eg. if I enter 150.7.500. the function automatically changes it to 150.7.|255. but the cursor go behind the 255 which stops you entering anything.
  18. Hi guys I need to write a script to change the regional and language option for different users. I can doing everything via registry changes except changing the keyboard layout Default input language. Does anyone now a way of change this via a script.
  19. I have look through the help file and found FileCreateShortcut which create a shorcut for a file however i want to create a internet shortcut. Does anyone know a way to do this through autoit?
  20. Hi I have created a program that run list of actions upon loading up into a user account each user account could have it own start up list. I have create a sleep,n command(n= seconds to sleep) which the user and use to slow the process down if needed. I have deployed this script to over 2000 machine and all except a random 6-10 machines on of the 2000 machine behave perfectly. However 6-10 machines every night get stuck on the on the msgbox which controls the the sleep cycle. As soon as to click the ok button the script continues to process. Has anyone expeience problem with using the sleep function built into the msgbox command? Here my code HotKeySet("{esc}","Endloop") ;Include some additional autoit funcutions into my script #Include <process.au3> ;Declaring some varibles Dim $errormessage,$admin,$x ;Read Values from ini file $SynchTime = IniRead (@ScriptDir & "\load.ini","General","SynchTime","No") $SynchTimeComputer = IniRead (@ScriptDir & "\load.ini","General","SynchTimeComputer","") $WaitforTimeServer = IniRead (@ScriptDir & "\load.ini","General","WaitforTimeServer","No") $MapADriveToComp = IniRead (@ScriptDir & "\load.ini","General","MapADriveToComp","No") $MapPath = IniRead (@ScriptDir & "\load.ini","General","MapPath","No") $DeleteTempDir = IniRead (@ScriptDir & "\load.ini","General","SynchTime","No") $DeletecustomDir = IniRead (@ScriptDir & "\load.ini","General","SynchTime","No") $DeleteCustomDirPath = IniRead (@ScriptDir & "\load.ini","General","SynchTime","") $RunState = IniRead (@ScriptDir & "\load.ini","General","RunState","@SW_HIDE") IF Not FileExists (@ScriptDir & "\load.ini") THEN Exit IF $WaitforTimeServer = "Yes" THEN Do SplashTextOn ("","Waiting For " & $SynchTimeComputer &@CRLF&@CRLF& "Press Esc to skip",200,100,-1,-1,1,"",16) $p = Ping ($SynchTimeComputer) IF $X = 1 THEN Exitloop Until $p > "0" SplashOff() ENDIF HotKeySet("{esc}") IF $MapADriveToComp = "Yes" THEN SplashTextOn ("","Mapping drive" ,200,100,-1,-1,1,"",16) Run ($MapPath,"",@SW_HIDE) ENDIF Splashoff() IF $SynchTime = "Yes" THEN _Rundos ("net time \\" & $SynchTimeComputer & " /set /y") IF $DeleteTempDir = "Yes" THEN FileDelete ("c:\temp\*.*") IF $DeletecustomDir = "Yes" THEN FileDelete ($DeleteCustomDirPath) $DoOnce = IniReadSection (@ScriptDir & "\load.ini","DoOnce") IF $DoOnce = 1 Then Action(@UserName) Exit Else Action("DoOnce") IniDelete (@ScriptDir & "\load.ini","DoOnce") Exit EndIf Func Action($Section) $user = IniReadSection (@ScriptDir & "\load.ini",$Section) IF @error=1 THEN Exit For $n = 1 to $user [0] [0] $z = $user [$n] [1] $s = StringSplit ($z,",") IF $s[1] = "sleep" THEN msgbox (64,"Pausing for "& $s[2] & " seconds","Click OK to abort the pause",$s[2]) ELSEIF $s[1] == "<ChangeName>" THEN ChangeName($s[2]) ELSEIF StringInStr($z,"Chkdsk") THEN Run (@ComSpec & " /c " & $z,"",$RunState) ELSEIF $z == "<Reboot>" THEN IniDelete (@ScriptDir & "\load.ini","DoOnce") Shutdown(2) Else Run ($z,"",$RunState) IF @error THEN $errormessage = MsgBox(54,"Error unable to run command", "Unable to run " & $s[1]) IF $errormessage = 2 THEN EXIT IF $errormessage = 10 THEN $n = $n -1 Endif Next ENDFUNC Func ChangeName($ComputerName) IF $ComputerName == "*" Then $ComputerName = "TmpName" & Random (00000000,99999999,1) SplashTextOn ( "", ".....Please Wait..... Changing ComputerName",@DesktopWidth,140,-1,@DesktopHeight-140,1,"",18) Sleep(2000) $strComputer = "." $objWMIService = ObjGet("winmgmts:" & "{impersonationLevel=impersonate}!\\" & $strComputer & "\root\cimv2") $colComputers = $objWMIService.ExecQuery ("Select * from Win32_ComputerSystem") For $objComputer in $colComputers $ObjComputer.Rename($ComputerName) Next SplashOff() Endfunc Func Endloop() $x = 1 ENDFUNC
  21. Can't seem to update an access database via autoit. IS it possible? I have search the topic and found a few posts giving example that it can be done however none of them work. Global Const $ProviderJET = 'Microsoft.Jet.OLEDB.4.0; ' Global $oAccessADO, $rsAccess, $AccessDB Dim $SQL $AccessDB = "c:\database\database.mdb" $SQL = "UPDATE OPERATOR SET USUAL_BRANCH = '111'" $oAccessADO = _adoAccessOpen($AccessDB) $oAccessADO.execute($SQL) Exit Func _adoAccessOpen($AccessDB) $oAccessADO = ObjCreate("ADODB.Connection") $oAccessADO.Provider = $ProviderJET $oAccessADO.Open($AccessDB) If @error Then MsgBox(0, "ERROR", "Cant open Access Database , handle = " & $oAccessADO) EndIf Return $oAccessADO EndFunc ;==>_adoAccessOpen When I run the code i get the following error E:\Customers\scoop\New AutoIt v3 Script.au3 (36) : ==> The requested action with this object has failed.: $oAccessADO.Open($AccessDB) $oAccessADO.Open($AccessDB)^ ERROR
  22. Wondering if there is a way of getting the total size of a folder while providing and exception list of sub folders i don't want to be included in the final count. For example I have a folder z:\Builds. Within 'Builds' there are many sub folders however in each sub folder there is a folder called archive. I want each archive folder from each sub folder to be included in the folder size of z:\builds. Hope this make sense Can anyone help?
  23. Hello can anyone help me with a problem I am having with changing the limit range on a textbox basically I have set the text box to have a limit of 1 to 9 which is fine for POS. However for back office I want it to be 90 to 99 I can change the initial value by using GUICtrlSetData to 99 however when I then use the up-down arrows it reverts to a range of 1 to 9 again. How can update the new value for GUICtrlSetLimit? Hope this make sense #INCLUDE <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <UpdownConstants.au3> #include <ComboConstants.au3> ;Declaring Variables that yet have no value ;Creating Variables $Version = "Version 1" ;Version Control $AnwserFile = StringTrimRight(@ScriptName,3) & "ini";Name of Anwser File $WorkingFile = @ScriptDir & "\Config.working.ini" $TextColour = IniRead ($AnwserFile,"Settings","TextColour","0x000000") $NextButtonName = IniRead ($AnwserFile,"Settings","NextButtonName","Next") $PosType = IniRead ($AnwserFile,"Settings","postype","BackOffice|POS" ) $Postype_Default = IniRead ($AnwserFile,"Settings","Postype_Default","POS" ) $POSNo_Default = IniRead ($AnwserFile,"Settings","POSNo_Default","1") $POSNo_Range_Min = IniRead ($AnwserFile,"Settings","POSNo_Range_Min","1") $POSNo_Range_Max = IniRead ($AnwserFile,"Settings","POSNo_Range_Max","9") $iXPos = 0 $iYPos = 0 $iWidth=@DesktopWidth ;Used to create form IF @DesktopWidth =1024 Then $iHeight=768 ElseIF @DesktopWidth =800 Then $iHeight=600 Else Msgbox(0,"Screen Resolution","Please set the screen resolution to either 1024x768 or 800x600 to run this program") Terminate() Endif ; Creating the Gui(Form) Opt("GUICoordMode",1) $F = GuiCreate("",$iWidth,$iHeight,$iXPos,$iYPos,$WS_SYSMENU,$WS_EX_TOPMOST) GUICtrlSetState(-1,$GUI_DISABLE) $Lbl_Type = GUICtrlCreateLabel("&System Type:",10,140,100,20) GUICtrlSetBkColor(-1,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont(-1,12) $C_Pos = GUICtrlCreateCombo("",110,140,160,-1,$CBS_DROPDOWNLIST) GUICtrlSetFont(-1,10) GUICtrlSetData(-1,$postype,$Postype_Default) $Lbl_POSNo = GUICtrlCreateLabel("&POS Number:",110,180,100,20) GUICtrlSetBkColor($Lbl_POSNo,$GUI_BKCOLOR_TRANSPARENT) GUICtrlSetFont($Lbl_POSNo,12) $I_POSNo = GUICtrlCreateInput($POSNo_Default,220,180,50,25) GUICtrlSetFont(-1,12) $I_POSNo_UpDown = GUICtrlCreateUpdown($I_POSNo,$UDS_ARROWKEYS+$UDS_WRAP) $I_POSNo_UpDown_SL = GUICtrlSetLimit (-1,$POSNo_Range_Max,$POSNo_Range_Min) GUISetState(@SW_SHOW,$F) WHILE 1 ; Creating an infinite loop $Msg=GUIGetMsg() IF $Msg = $C_Pos Then IF Guictrlread($C_Pos) = "BackOffice" Then GUICtrlSetData($Lbl_POSNo,"B/o Number") GUICtrlSetData($I_POSNo,"99") ElseIF Guictrlread($C_Pos) = "POS" Then GUICtrlSetData($Lbl_POSNo,"POS Number") GUICtrlSetData($I_POSNo,"1") ENDIF EndIf Switch $Msg Case $GUI_EVENT_CLOSE ;Actions to be carried out upon pressing the upper right X IniWrite($WorkingFile,"Shutdown","Abort","Yes"); write an entry to an ini file IF ProcessExists("OnScreenKeyboard.exe") Then ProcessClose("OnScreenKeyboard.exe") Terminate() ;Stops the script EndSwitch WEnd
  24. Sorry forgot to mention that I can do this by using a simple windows prompt command: dir /s *.gho >c:\results.txt This work great and does exactly what I want (However the it list the info it to complex). All i want is a simple list that like: c:\example1.gho c:\example2.gho c:\subfolder1\example3.gho c:\subfolder2\example4.gho
  25. Hi Can anyone tell me how to perform a search for a particular file type. What i want to do is create a list of all *.gho file that exist on a drive.
×
×
  • Create New...