Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 (edited) Shouldn't that be?ControlClick("Save As", "&Save", "Button2")<{POST_SNAPBACK}>Yes it should be but I was trying to test with cancel.But ControlClick("Save As", "&Help", "Button4") doesn't workActive window info in my previous post is for the cancel button Edited July 25, 2005 by Fabre Link to comment Share on other sites More sharing options...
GaryFrost Posted July 25, 2005 Share Posted July 25, 2005 Yes it should be but I was trying to test with cancel.But ControlClick("Save As", "&Help", "Button4") doesn't workActive window info in my previous post is for the cancel button<{POST_SNAPBACK}>I see, also see NotePads cancel button reports back false info try:ControlClick("Save As", "Cancel", "Button4") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 I see, also see NotePads cancel button reports back false info try:ControlClick("Save As", "Cancel", "Button4")<{POST_SNAPBACK}>Nope doesn't work, nevermind I don't need to cancel.So next step is unticking one box, I could do it this way.WinWaitActive("Untitled")WinMenuSelectItem("Untitled", "", "&Edit", "&Replace")WinWaitActive("Replace")ControlClick ( "Replace", "", "Button2")But on the next 4 screens there are list of items with tick boxes, all should be unticked except a few of them.Is there a way of knowing if a box is ticked or not? Link to comment Share on other sites More sharing options...
GaryFrost Posted July 25, 2005 Share Posted July 25, 2005 Full circle $ret = ControlCommand("title","text",control id,"IsChecked", "") Gary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
randallc Posted July 25, 2005 Share Posted July 25, 2005 Hi,Have you considered Excel COM instead?You can get lines from a file, get them tab-delimited if need to go in separate cells, and copy them directly into spreadsheet;my example udf on the link in my signature.egGlobal $FilePath,$var,$AddressExcel, $RowExcel$FilePath=@ScriptDir&"\Book1.xls"If Not FileExists($FilePath) Or Not StringInStr($FilePath, "xls") Then $FilePath = FileOpenDialog("Go - Choose your excel file as inbuilt one not exists", $FilePath, "Worksheet" & " (" & "*.xls" & ")", 1);+ $Recurse+ $RecurseEndIf$ExcelValue1="A"&@TAB&"B"&@TAB&"C"&@TAB&"D"&@TAB&"E"$var=_ExcelCOM($FilePath,1,"E",7,"Read","Save",4,0,0,1); read address of "last cell:$var=_ExcelCOM($FilePath,1,"A",$RowExcel,"Into","Save",$ExcelValue1,1,0,0); read cell "E7" and Show Excel (Office 2003 OK :? 2000 on)Exit; "Column" can be a range (then "Row" is ignored); excelValue can be a tab-delimited string (then takes as many columns on that row as needed) Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 (edited) Full circle $ret = ControlCommand("title","text",control id,"IsChecked", "")Gary<{POST_SNAPBACK}>Sorry I am not a native english speaker so I don't always search for the good terms, I had looked for ticked, boxes...Anyway so to make sure I don't untick that first box I should put it this way$ret = ControlCommand("Replace","","Button2","IsChecked", "")If $ret = 0 then ControlClick ( "Replace", "", "Button2")EndIfSo with this I can make sure all the boxes I need are checkedBut how can I unchecked all the other boxes without specifying their Control ID? Edited July 25, 2005 by Fabre Link to comment Share on other sites More sharing options...
GaryFrost Posted July 25, 2005 Share Posted July 25, 2005 Sorry I am not a native english speaker so I don't always search for the good terms, I had looked for ticked, boxes...Anyway so to make sure I don't untick that first box I should put it this way$ret = ControlCommand("Replace","","Button2","IsChecked", "")If $ret = 0 then ControlClick ( "Replace", "", "Button2")EndIfSo with this I can make sure all the boxes I need are checkedBut how can I unchecked all the other boxes without specifying their Control ID?<{POST_SNAPBACK}>You'll have to specify each one and use the UnCheck with ControlCommandGary SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 (edited) You'll have to specify each one and use the UnCheck with ControlCommandGary<{POST_SNAPBACK}>I have to do an export for the 3 different project I had hoped to be able to do one script for all 3, the box I need checked are the same but the list are different, I will do a script per project then. checked or not this would give the same result?ControlCommand("Replace","","Button2","Check", "")as$ret = ControlCommand("Replace","","Button2","IsChecked", "")If $ret = 0 then ControlClick ( "Replace", "", "Button2")EndIfSo if I want to have Button2, Button3, Button4 checked is there a way to group them in one line or do I need to write a line per item? Edited July 25, 2005 by Fabre Link to comment Share on other sites More sharing options...
GaryFrost Posted July 25, 2005 Share Posted July 25, 2005 (edited) I have to do an export for the 3 different project I had hoped to be able to do one script for all 3, the box I need checked are the same but the list are different, I will do a script per project then. checked or not this would give the same result?ControlCommand("Replace","","Button2","Check", "")as$ret = ControlCommand("Replace","","Button2","IsChecked", "")If $ret = 0 then ControlClick ( "Replace", "", "Button2")EndIfSo if I want to have Button2, Button3, Button4 checked is there a way to group them in one line or do I need to write a line per item?<{POST_SNAPBACK}>Don't know of a way to group them.One thing I might mention, haven't tried it myself, so I don't know how well it would work for what you are doing, the SciTe editor for AutoIt has AU3Recorder, might be worth looking into for your projects.Gary Edited July 25, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 Thanks again for your help Gary, you have been most helpfull. Actually trying the recorder is the first thing I did, It's okay but for a quick macro but I got better result wih maromaker, but it has it's limitation, even in macromaker I ended up doing the maco from scratch but the language used doesn't have 1/4 (maybe even less) of the power of Autoit. Even if it's more complex Autoit is much more enjoyable to work with, I really like that level of control you get on you macros. This bring me to my step 5 Cut and pasting into excel I couldn't find anything on the forum or helpfile on selecting a specific spreadheet by the tab. and the active window info is not reporting anything for that tab. it's not even in the visible or hidden text. Is this actually doable or do I have to resort to mouselick? Link to comment Share on other sites More sharing options...
randallc Posted July 25, 2005 Share Posted July 25, 2005 Hi, You did not answer my post (25?) in this thread; the excel com approach allows you to select the sheet by number at present (I have not yet got it doiong it by name, but certainly possible). Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 25, 2005 Author Share Posted July 25, 2005 Hi,Have you considered Excel COM instead?You can get lines from a file, get them tab-delimited if need to go in separate cells, and copy them directly into spreadsheet;my example udf on the link in my signature.egGlobal $FilePath,$var,$AddressExcel, $RowExcel $FilePath=@ScriptDir&"\Book1.xls" If Not FileExists($FilePath) Or Not StringInStr($FilePath, "xls") Then $FilePath = FileOpenDialog("Go - Choose your excel file as inbuilt one not exists", $FilePath, "Worksheet" & " (" & "*.xls" & ")", 1);+ $Recurse+ $Recurse EndIf $ExcelValue1="A"&@TAB&"B"&@TAB&"C"&@TAB&"D"&@TAB&"E" $var=_ExcelCOM($FilePath,1,"E",7,"Read","Save",4,0,0,1); read address of "last cell: $var=_ExcelCOM($FilePath,1,"A",$RowExcel,"Into","Save",$ExcelValue1,1,0,0); read cell "E7" and Show Excel (Office 2003 OK :? 2000 on) Exit ; "Column" can be a range (then "Row" is ignored); excelValue can be a tab-delimited string (then takes as many columns on that row as needed)Best, Randall<{POST_SNAPBACK}>Hi,You did not answer my post (25?) in this thread; the excel com approach allows you to select the sheet by number at present (I have not yet got it doiong it by name, but certainly possible).Best, Randall<{POST_SNAPBACK}>Thanks a million for the reminder Randall!The Export already tale care of making the tab separation, so content of the txt file is ready to be past in Excel.So I would need to select tab 3 and paste in column A row 2, what do I need to change in your script to do so?And do i have to copy the text from notepad, or can it be imported straight into excel? Link to comment Share on other sites More sharing options...
randallc Posted July 26, 2005 Share Posted July 26, 2005 (edited) Hi,[func _ExcelCOM($sFilePath,$Sheet,$Column,$Row,$MEExcelCom,$Save,$ExcelValue,$Visible,$Exit,$LastRow)]You know you need to get the "ExelCOM func" first;parameter2 is the sheet number,($ExcelValue1 here would be your parsed text line with tabs;)Try this;[EDIT -"tab=sheet 3? woops...]$var=_ExcelCOM($FilePath,3,"A",2,"Into","Save",$ExcelValue1,1,0,0);[Leaves Excel visible and open]or this;$var=_ExcelCOM($FilePath,3,"A",2,"Into","Save",$ExcelValue1,0,1,0);[Excel not opened; all in background, and Excel exit][Alternative syntax; ]$var=_ExcelCOM($FilePath,3,"A:2","row not needed","Into","Save",$ExcelValue1,0,1,0);No, you don't need notepad; you could "FileRead" directly from the text file to get your line of text.Best, Randall(PS I am not sure if I have the "LastRow" number going into "$var" at present in the Save command; I'll need to check in"func" later - but you are using "Row 2" anyway.) Edited July 26, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 26, 2005 Author Share Posted July 26, 2005 Sorry Randall I am having a really tough time understanding how this one works. There no mention of excelcom in the help file and I couldn't make much sense of it in different thread on the forum. Do you have any pointer that would help me understand how this on is working? Link to comment Share on other sites More sharing options...
randallc Posted July 26, 2005 Share Posted July 26, 2005 Hi, I'm happy to try to help. Have you just saved and opened the ".au3" file form the other thread ; "ExcelUDF1_2.au3" and run it? It automatically should prompt you for an excel file to use (if you have not yet entered your own), and inserts "$ExcelValue1="A"&@TAB&"B"&@TAB&"C"&@TAB&"D"&@TAB&"E"" on the row after the last row in use in that sheet. You can read the function "excelcom" and its parameters in that script. There is no other documentation, unless you read the "com" help file. ** Are you using the latest "beta -64"? (need this for "com"). 1. Do you have it working and do not understand how, 2. or do you not have it working? 3. do you understand how "func" works? What really is your question? Best, Randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 26, 2005 Author Share Posted July 26, 2005 Randall I got ExcelUDF1_2.au3 running. And looked at the code, and this is way out of my league. if you are willing to provide me with a modified version where I can put the excel book path in the code (no prompt) and will then paste the text from a txt file in column A row 2 on a specific sheet, I will be most Gratefull. Otherwise I will just use simple mouseclick function. I am willing to learn but this is just to advance for me right now. Link to comment Share on other sites More sharing options...
randallc Posted July 26, 2005 Share Posted July 26, 2005 (edited) Hi again,I will do that later.If you have that script running, you are already in that league!it is only the first few lines you need to modify to use what you already have.the "func...to...endFunc" part just stays inside the script at the end.I would have to think to get the 'fileRead" running; maybe someone else would help.1. Otherwise, just put this func in the script you have, and 2.define $FilePath="c:\YourFolder\Yourfile.xls" (***** you have to change it yourself [i hate not having the if...Choose Path as then it can crash if you tryt to run it - but here it is for simplicity]) [The original would not prompt if you change the FilePath in the script]3. Define $ExcelValue1 (you said you had the string with tabs in a variable already? - $ExcelValue1=$YourVariableStringGlobal $FilePath,$var,$AddressExcel, $RowExcel$FilePath=@ScriptDir&"\Book1.xls"$ExcelValue1="A"&@TAB&"B"&@TAB&"C"&@TAB&"D"&@TAB&"E"$var=_ExcelCOM($FilePath,3,"A","2","Into","Save",$ExcelValue1,1,0,0)ExitAs long as you append all the lines of "func...to...endFunc" at the end, that is the total script!If you post your script to where you have your string, I'll add these lines if you want.Best, Randall. Edited July 26, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 26, 2005 Author Share Posted July 26, 2005 I get an error I removed all that was before the first func and pasted this instead Global $FilePath,$var,$AddressExcel, $RowExcel $FilePath=@ScriptDir&"c:\list.xls" $ExcelValue1="A"&@TAB&"B"&@TAB&"C"&@TAB&"D"&@TAB&"E" $var=_ExcelCOM($FilePath,3,"A",2,"Into","Save",$ExcelValue1,1,0,0); Exit but when I launch I get a popup with $sFilePath= C:\Documents and Settings\Fabre\Desktopc:\list.xls OK Link to comment Share on other sites More sharing options...
randallc Posted July 26, 2005 Share Posted July 26, 2005 (edited) Hi,Syntax; (EDIT -WOOPS -"script running directory; "macros" in HelpFile; $FilePath=@ScriptDir&"\list.xls"[if "list.xls is in the Directory containing the running script. (Result does not contain a trailing backslash) ] or$FilePath="c:\list.xls" [if "list.xls is in the c:\ root directory?]Best, Randall Edited July 26, 2005 by randallc ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW Link to comment Share on other sites More sharing options...
Fabre Posted July 26, 2005 Author Share Posted July 26, 2005 Hi,Syntax;[if "list.xls is in the AutoIT Installation directory] or [if "list.xls is in the c:\ root directory?]Best, Randall<{POST_SNAPBACK}> ohokay I will try that tomorrow it's getting late for me.Thanks Randall 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