anandnz 1 Posted January 29, 2011 (edited) Hi i am learning the notepad example further and thanks to the help here i could able to move one step. When i creating the notepad with name from command, I want to know how to handle scenarios 1. File already exists, 2. File does not exist. The window info returns "Notepad" which does not help me ..visible text is ( &Yes, &No, Canel, Cannot find Arnold.txt file, Do you want to create a new one) 1. How to compare dialog boxes and take action based on the visible text of the windo info .?? 2. I want to save the notepad by taking directory string stored with the file name variable. i,e dir+filename Any help is appreciated. #include <File.au3> ; enable to save the notepad with name from command ; Handle save as, Already exists dialog boxes ; save the file in the directory given from the command ; concatenate above directory with file command to save the notepad. Local $Cnt =0, $Li[2] = ["Arnold", "Carol"] Global $Str = "C:\data\work\autolt\Logfile.txt" Global $dir = "C:\data\work\programming\autolt" For $Cnt = 0 To 1 Step 1 ConsoleWrite("notepad = " & $Li[$Cnt] & @CRLF) ; Check if it prints the variable Run("Notepad.exe " & $Li[$Cnt]) ; use space between & and variable sleep(2000) ; I want to see if i can pass a variable to the command .. _WinWaitActivate("" & $Li[$Cnt],"") if WinActive("Notepad") then send("!s") ; NEED HELP HERE TO HANDLE THE FILE DOES NOT EXSITS, FILE ALREADY EXISTS ; DIALOG BOXES send ("!f") ; to go to notepad "File" menu send("+a") ; to go to "Save As" menu ;send("" & $dir + & $Li[$Cnt]) ; NEED HELP HERE TO CONCATENATE TWO STRINGS FROM USER COMMANDS ; DIRECTORY + FILE NAME .. _FileWriteLog( "" & $Str, "File is =" & $Li[$Cnt]) ;add your log message...date & time will automatically prepend your text Next ;WinWaitActive(&$li[$cnt] - "Notepad") FUNC _winwaitActivate($title, $text, $timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Edited January 29, 2011 by anandnz Share this post Link to post Share on other sites
Zedna 279 Posted January 30, 2011 Look at AdlibEnable() Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
guinness 1,518 Posted January 30, 2011 Or AdlibRegister() in the new Version of AutoIt. UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Share this post Link to post Share on other sites
Zedna 279 Posted January 30, 2011 Or AdlibRegister() in the new Version of AutoIt.Yes :-)I still use old 3.2.12.1 because I have got too many scripts in syntax for this version. Resources UDF ResourcesEx UDF AutoIt Forum Search Share this post Link to post Share on other sites
anandnz 1 Posted February 1, 2011 Yes :-)I still use old 3.2.12.1 because I have got too many scripts in syntax for this version.Hi Zedna, Thank you very much. I see that you have rightly suggested to use, please do you have any opinion on the my issue here ..It is requires me to pass two variables in the functions i am calling in AdlibRegister()Thanks --Anand Share this post Link to post Share on other sites