Andy2520 Posted May 4, 2013 Share Posted May 4, 2013 Hi Team, I am new in this scripting please help asap ..... I am creating the script that take the inputs from the user as path of file name and run the command on that file path . i have created the below script .. When i click button it should run the command on selected user path . If you see the function Nfixup() that does not work .. Please guide me how to run the command on Path which taken input from users ... #include <GUIConstants.au3> Dim $msg Dim $Button1 Dim $Button2 Dim $Button3 Dim $path Dim $test main() Func main() GUICreate(" Archive Maintanance", 430, 300) GUICtrlCreateLabel("Select The Nsf File**", 100, 20) $path = GUICtrlCreateInput("",10,53,200,23) $browse = GUICtrlCreateButton("Browse File", 235, 53,100, 30) $Button1 = GUICtrlCreateButton("NFixup", 135, 125, 100, 30) $Button2= GUICtrlCreateButton("Nupdall", 135, 170, 100, 30) $Button3= GUICtrlCreateButton("Ncompact", 135, 215, 100,30) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $browse $File2open = FileOpenDialog ("Browse", "C:\", "Text Documents (*.nsf)") ;returns the file path GUICtrlSetData($path, $File2open) ;set input data $test = GUICtrlSetData($path, $File2open) MsgBox(0 ,"Path",$test ) Case $msg = $Button1 MsgBox(4096,"","You have pressed Nfixup command " ) nfixup() Case $msg = $Button2 MsgBox(4096,"","You have pressed Nupdall command " ) Case $msg = $Button3 MsgBox(4096,"","You have pressed Ncompactcommand " ) ;GUICtrlCreateLabel("Lotus Notes Installation location should be in below path", 30, 10) ;GUICtrlCreateLabel("C:\Program Files\IBM\Lotus\Notes\", 30, 30) Case Else ;;;;;;; EndSelect WEnd EndFunc Func nfixup() $display = GUICtrlRead(4,1) $Cmd= "/k cd %programfiles% & cd Lotus & cd notes & Nfixup -F " MsgBox(0,"NFixup",$display) Run(@ComSpec & $cmd ,$ display "",@SW_Show) EndFunc Link to comment Share on other sites More sharing options...
mikell Posted May 4, 2013 Share Posted May 4, 2013 (edited) It seems that there is a missing space before the /k : " /k cd etc..." and an unwanted one in '$ display' Edited May 4, 2013 by mikell Link to comment Share on other sites More sharing options...
Andy2520 Posted May 4, 2013 Author Share Posted May 4, 2013 It seems that there is a missing space before the /k : " /k cd etc..."and an unwanted one in '$ display'Thanks For replying ..I have done the changes wht u said . Func nfixup() $display = GUICtrlRead(4,1) $Cmd= " /k cd %programfiles% & cd Lotus & cd notes " ;MsgBox(0,"NFixup",$display) Run(@ComSpec &$cmd &" /k Nfixup -F "&$display "",@SW_Show) EndFuncI am trying to run the command as above $dispaly : is the path of file which i need to run this command ..Please help me ... Link to comment Share on other sites More sharing options...
BrewManNH Posted May 4, 2013 Share Posted May 4, 2013 Why not just run the program directly and not use the command console, most of what you're doing in the $Cmd variable is just changing folders, which isn't needed, and you're using /k twice which also isn't needed and probably is what is causing your problem. Just run the program using the full path name to the file, and use the folder as the workingdir parameter if needed. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Andy2520 Posted May 4, 2013 Author Share Posted May 4, 2013 Why not just run the program directly and not use the command console, most of what you're doing in the $Cmd variable is just changing folders, which isn't needed, and you're using /k twice which also isn't needed and probably is what is causing your problem.Just run the program using the full path name to the file, and use the folder as the workingdir parameter if needed.Thanks Brew ..You mean like below ..Func nfixup() $display = GUICtrlRead(4,1) Run("C:Program FilesIBMLotusNotesNfixup.exe -F", & $display,@SW_SHOW) EndFunci did this still not working pls help me ... Link to comment Share on other sites More sharing options...
DucViet321 Posted May 4, 2013 Share Posted May 4, 2013 (edited) This should work, I think Func nfixup() $display = GUICtrlRead(4,1) $Cmd= " /k cd %programfiles%\Lotus\notes" Run(@ComSpec & $cmd & " & Nfixup -F " & $display,@SW_Show) EndFunc Have you try it from "Run"? Edited May 4, 2013 by DucViet321 $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
BrewManNH Posted May 4, 2013 Share Posted May 4, 2013 (edited) You'd want to run it like this. Run("C:\Program Files\IBM\Lotus\Notes\Nfixup.exe -F", $display, @SW_SHOW) You had an "&" in before the $display variable. There's hardly ever a reason to use @Comspec before the command unless it's an internal Windows command, or you need to run it in the command console for some reason. If it's GUI based and a Windows program, you don't need it, and it can also cause it's own issues because you can't access the PID, of the program you're running, directly. Edited May 4, 2013 by BrewManNH If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Andy2520 Posted May 4, 2013 Author Share Posted May 4, 2013 This should work, I think Func nfixup() $display = GUICtrlRead(4,1) $Cmd= " /k cd %programfiles%\Lotus\notes" Run(@ComSpec & $cmd & " & Nfixup -F " & $display,@SW_Show) EndFunc Have you try it from "Run"? HI thanks for reply Func nfixup() $display = GUICtrlRead(4,1) $Cmd= " /k cd %programfiles%IBMLotusnotes" Run(@ComSpec & $cmd & " Nfixup -F " & $display,@SW_Show) EndFunc When i click on button nothing works ... i dnt know wht is happening .... Link to comment Share on other sites More sharing options...
DucViet321 Posted May 4, 2013 Share Posted May 4, 2013 Does it work when you run it directly with cmd? $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
Andy2520 Posted May 4, 2013 Author Share Posted May 4, 2013 Hi , Actually i am going to create the script which runs the maintenance on corrupted lotus notes archive . Those three commands we need to run from the command prompts only.. below are command format.. Nfixup –F “Mailfile path” Mail file path : I am taking as inputs form the user as $Display comes from guiread() I am getting stuck here once I click on button Nfixup ..It automatically runs above command and give output in command and close it .. and I can go for next button .. Suggest me how do I go for this now pls.. Link to comment Share on other sites More sharing options...
DucViet321 Posted May 4, 2013 Share Posted May 4, 2013 Why do you keep run it in CMD? How about copy your NFixup to your script path and run it by Autoit Run(@ScriptDir & "-F " & GUICtrlRead($path)) $Money = ControlGetMoney(@Life,"People","Pocket4")If $Money Then $Rich = TrueElse $Risk = True _RunAwayFromPolice("Fastest")EndIf Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now