Jump to content

vinyking

Active Members
  • Posts

    24
  • Joined

  • Last visited

vinyking's Achievements

  1. Melba23 You have been very kind to me I discovered that right clicking my script and selecting compile only allows compiling in the Autoit3 version and not the AutoitBeta version (wonderful) Also because AutoitConstants.au3 is not available in the Autoit3 version (you are correct this is included in the latest Beta) the error is reported. You did it for me by maintaining your stand. Now my script compiles successfully. Thanks for your time. Oh one other question What do you mean by "committed this morning" Regards Vinyking
  2. Hello Melba, Much thanks Pardon me if I sound so noobie. I am running the Beta 3.3.11.3 version of AutoIt and the latest version of Autoit. I read somewhere that the Beta version can spring up issues. However i have included the Udf using the Scite Config I would be glad if you can direct me on how to compile my script - if this is possible Regards, vinyking
  3. Hello I have downloaded and included the new Array.udf. My script runs fine in the Scite. However I have errors the following error highlighted in the Array_New.au3 window "error: can't open include file "AutoitConstants.au3". when compiling to Exe. '?do=embed' frameborder='0' data-embedContent>> I tried compiling the examples and stil had the same error. Any help to resolve this issue is appreciated Vinyking
  4. Thanks your time, help and concern is well appreciated Vinyking
  5. Thanks Zedna, nice to know about the bug/limitation and my other option. Now moving on to the second question "can i format my directory like " @myspecifiedDir" which is C:UsersMy profileDocumentsStatement folder the same way we have @MyDocumentsDir and @ScriptDir. Thanks Vinyking
  6. Hi Zedna and Water, You help are appreciated. I have tried out your suggestions, but I am yet to grab the solution (I kept away due to the shame of not making this work). I resulted to the following Func Printwebpage_to_PDF() Local $filename = @MyDocumentsDir & "\Statement folder\" & $aArray1[$i] & ".pdf" If WinExists("Print") Then WinActivate("Print") WinWaitActive("Print", "", 10) Send("PrimoPDF {Enter 2}") WinWaitActive("PrimoPDF by Nitro PDF Software", "", 10) ControlClick("PrimoPDF by Nitro PDF Software", "", "[TEXT:Create PDF]") WinWaitActive("Save As", "&Save", 10) Sleep(1500) ControlSend("Save As", "", 1001, $filename) Sleep(2000) ; wait 2 seconds ControlClick("Save As", "&Save", 1, "left", 1) WinWaitActive("Adobe Acrobat Professional", ".pdf", 10) Sleep(1000) ;WinActivate("Adobe Acrobat Professional", ".pdf") WinClose("Adobe Acrobat Professional", ".pdf") EndIf EndFunc ;==>Printwebpage_to_PDF I declared the folder and "controlsend" to the save as dialogue. Now although this works often time the system makes an error of sending "|" instead of "". in the string so sometimes I get C:|Users|My profileDocumentsStatement folderJohn.pdf C:UsersMy profileDocuments|Statement folderJohn.pdf instead of C:UsersMy profileDocumentsStatement folderJohn.pdf I have tried to increase the sleep period but the error do occur often causing me headache. my question is what can cause system to control send "|" instead of "" also can i format my directory like " @myspecifiedDir" which is C:UsersMy profileDocumentsStatement folder the same way we have @MyDocumentsDir and @ScriptDir Thank you for your time
  7. Hi water I have narrowed in on the code and the returned value I discovered my default folder is selected in the save as window, but not clicked it appears selected folder needs to be clicked . How do I stimulate the clicking of the folder in the save as window? my code and comment is below If ControlTreeView("Save As", "", 100, "Exists", "Desktop|CSCS Statements") Then ControlTreeView("Save As", "", 100, "Select", "#1|#11") ; expand a node ControlClick("Save As", "", 100, "left", 1); this is not clicking my selected folder Sleep(2000) Else MsgBox(0, "Folder Message", "Default Folder not found ") EndIf thanks in advance.
  8. Thanks Water for the quick response. i corrected the typo. However, my file still save else where (not in specified folder) there must be a way to do this
  9. Hello All, I need help with selecting items in the save as dialogue box I surf the net and Autoit forum but none of the solutions seem to work for me below is the code I have worked with which is basically not doing what i wanted the file still get saved in the previous selected folder. I want the file to be saved in what ever folder i indicated in my code. WinWaitActive("Save As", "&Save", 10) Sleep(1000) If ControlTreeView("Save As", "", 100, "Exist", "Desktop") Then ControlTreeView($windowname, "", 100, "Select", "Desktop|My Folder") ; to save file in My Folder (specific folder of choice) Else MsgBox(0, "not existing", "this is not working"); i am trying to check if the first example works if not try other option WinWaitActive("Save As", "") ControlClick("Save As", "", "[CLASS:Button; INSTANCE:100]") $hTree = ControlGetHandle("Save As", "", "[CLASS:SysTreeView32; INSTANCE:100]") ; get handle to the treeview window ControlTreeView("Save As", "", $hTree, "Expand", "#0|#13") ; expand a node ControlTreeView("Save As", "", $hTree, "Expand", "#0|#13|#10") ; expand a child node of the above node EndIf ControlSend($windowname, "", $control, "file name" & ".pdf") ControlClick($windowname, "&Save", 1, "left", 1) My file still saves still does not save in the specified folder. Thanks for the help in advance
  10. Thanks to bogQ and PincoPanco. I have conquered this. Now moving on to the other challenges. Regards, Vinyking
  11. hi PincoPanco i have tried my hands on the code. here is what worked eventually . I am not sure if the progress bar code is placed correctly within the script (though it is working) ;withe $aArray1 already declared and its elements captured ;----------------------------------------------------------------------------- ;now Lopping through Array and executing Web form while progress is shown ;----------------------------------------------------------------------------- ProgressOn("Progress Meter", "done ", $i & "/" & UBound($aArray1) & " ( 0 %)", -1, -1, 16) ; Progress bar On For $i = 0 To UBound($aArray1) - 1 $_Percent = Int($i / UBound($aArray1) * 100) ; percentage of completion ProgressSet($_Percent, $i & "/" & UBound($aArray1) & " ( " & $_Percent & " %)", "step " & $i) ; show progree If $_Percent = 100 Then ; when complete turn progress off ProgressSet(100, "Done", "Complete") Sleep(500) ProgressOff() EndIf Sleep(10) ; wait a bit _IENavigate($oIE, "my web form") $oForm1 = _IEFormGetObjByName($oIE, "form name") $oSelect = _IEFormElementGetObjByName($oForm1, "form id") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, $aArray1[$i], 1, "byValue") $oSubmit = _IEGetObjByName($oIE, "enter") _IEAction($oSubmit, "click") _IELoadWait($oIE) Local $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended If $iNumTables > 5 Then ;MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") Local $oTable = _IETableGetCollection($oIE, 5) ;create the table array from web page Local $aTableData = _IETableWriteToArray($oTable, True) Sleep(100) _ExcelSheetActivate($oExcel, $aArray1[$i]) _ExcelWriteSheetFromArray($oExcel, $aTableData, 1, 1, 0, 0) ;0-Base Array parameters EndIf $_Percent = Int($i / UBound($aArray1) * 100) ; percentage of completion ProgressSet($_Percent, $i & "/" & UBound($aArray1) & " ( " & $_Percent & " %)", "step " & $i) ; show progree If $_Percent = 100 Then ; when complete turn progress off ProgressSet(100, "Done", "Complete") Sleep(500) ProgressOff() EndIf Sleep(10) ; wait a bit Next thanks to you all
  12. thanks bogQ ;----------------------------------------------------------------------------- ;Lopping through Array and executing Web form ;----------------------------------------------------------------------------- Local $unbound_array = _ExcelReadArray($oExcel, 2, 1, 10, 1) ;Direction is Vertical For $i = 0 To $unbound_array - 1 ;---------- ;my code ;-------------- _IENavigate($oIE, "web page") $oForm1 = _IEFormGetObjByName($oIE, "form name") $oSelect = _IEFormElementGetObjByName($oForm1, "form id") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, $unbound_array[$i], 1, "byValue") $oSubmit = _IEGetObjByName($oIE, "Go") _IEAction($oSubmit, "click") _IELoadWait($oIE) Local $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended If $iNumTables > 5 Then ;MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") Local $oTable = _IETableGetCollection($oIE, 5) ;create the table array from web page Local $aTableData = _IETableWriteToArray($oTable, True) Sleep(100) _ExcelSheetActivate($oExcel, $unbound_array[$i]) _ExcelWriteSheetFromArray($oExcel, $aTableData, 1, 1, 0, 0) ;0-Base Array parameters EndIf ;tooltip code ToolTip(Round((100 / $aArray1) * $i)) ; i get the tool tip value -9223372036854775807 Sleep(100) Next ;----------------------------------------------------------------------------- ;end of Loop through Array and executing Web form ;----------------------------------------------------------------------------- ;other codes comes here after writing all data from web page to excel Please find my extract of my script above. All the code works with or without the tool tip. However, the tool tip value is always -9223372036854775807 as the loop run throug. Actually what i want to achieve is a progress bar that shows the stages of the array already looped through the web form. yor help is highly appreciated
  13. Thanks bogQ tried the codes and the tooltip return this value "-9223372036854775807" which do not comprehend. details in my array are strings (not numbers) What I am hoping to get is for example giving the folowing array which would be run through a web form luke mark john williams sullivan nate jude rose paul james 10 items in array I want the progress bar to show 10% completed after proceesing luke; 20% after processing mark etc...... 100% completed atfer james (last item in array) I know this is quite simple for some pro. I beg your mercy if i sound so newbie. Regards,
  14. Hi all, I need help at this stage. I have been able to read my array into aweb form then perfom some other activity like print web page to pdf, save file and even read/write array to excel. I willlike to have progress bar that display in the center of the screen on top of every other window which shows the percentage of of the array completed. I figured if i am able to have the index number (not index value) of array returned perharps this could be a lead. below is my script and it works so fine except not been able to see the stage of work done. I am ready to learn. Cheers #include <IE.au3> #include <Excel.au3> #include <Array.au3> ;----------------------------------------------------------------------------- ;Open Excel file and capture/read Array ;----------------------------------------------------------------------------- Local $sFilePath1 = "file path\excel.xlsx" ;This file should already exist Local $oExcel = _ExcelBookOpen($sFilePath1, 0) If @error = 1 Then MsgBox(0, "Error!", "Unable to Create the Excel Object") Exit ElseIf @error = 2 Then MsgBox(0, "Error!", "File does not exist - Shame on you!") Exit EndIf Dim $cell[1001] Local $aArray1 = _ExcelReadArray($oExcel, 2, 1, 230, 1) ;Direction is Vertical ; you could opt to show the array before proceeding (un-comment the next line) ;_ArrayDisplay($aArray1, "Vertical") $oExcel.Application.Run("Delete_Created_Sheet.Delete_Created_Sheet") Sleep(200) $oExcel.Application.Run("Lapta") ;----------------------------------------------------------------------------- ;Excel file opened Array reading completed and Excel file still opened ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;trying to open web page login form ;----------------------------------------------------------------------------- $oIE = _IECreate("my website for form/portal/login", "", 0) $oForm = _IEFormGetObjByName($oIE, "form name") Local $oQuery = _IEFormElementGetObjByName($oForm, "login") _IEFormElementSetValue($oQuery, "eco") Local $oQuery = _IEFormElementGetObjByName($oForm, "the Password") _IEFormElementSetValue($oQuery, "login password") _IEFormSubmit($oForm) Sleep(2000) ; wait 2 seconds ;----------------------------------------------------------------------------- ;form/ webpage login complteted ;----------------------------------------------------------------------------- ;----------------------------------------------------------------------------- ;Lopping through Array and executing Web form ;----------------------------------------------------------------------------- For $i = 0 To UBound($aArray1) - 1 _IENavigate($oIE, "new page with another form") $oForm1 = _IEFormGetObjByName($oIE, "form name") $oSelect = _IEFormElementGetObjByName($oForm1, "numbers") _IEAction($oSelect, "focus") _IEFormElementOptionSelect($oSelect, $aArray1[$i], 1, "byValue") $oSubmit = _IEGetObjByName($oIE, "$enter") _IEAction($oSubmit, "click") _IELoadWait($oIE) Local $oTable = _IETableGetCollection($oIE) Local $iNumTables = @extended If $iNumTables > 5 Then ;MsgBox(0, "Table Info", "There are " & $iNumTables & " tables on the page") Local $oTable = _IETableGetCollection($oIE, 5) ;create the table array from web page Local $aTableData = _IETableWriteToArray($oTable, True) Sleep(100) _ExcelSheetActivate($oExcel, $aArray1[$i]) _ExcelWriteSheetFromArray($oExcel, $aTableData, 1, 1, 0, 0) ;0-Base Array parameters EndIf Sleep(1000) Next ;----------------------------------------------------------------------------- ;end of Loop through Array and executing Web form ;----------------------------------------------------------------------------- $oExcel.Application.Run("Change_WKSTNameLapta") _ExcelBookClose($oExcel, 1) _IENavigate($oIE, "different page") _IEAction($oIE, "quit")
  15. @ Martin. Thank you for the direction. I have been away from scripting for a couple of days. I tried the codes and they it works. (here is my codes) ;james3mg function Local $PrinterName = "PDFCreator" Local $p_file = "file path\Portfolio.htm" PrinterSetAsDefault($PrinterName) _PrintHTML($p_file) Func _PrintHTML($p_file);james3mg print function If FileExists($p_file) Then RunWait(@COMSPEC&' /c rundll32.exe ' & @SystemDir & '\mshtml.dll,PrintHTML "' & $p_file & '"',@TempDir,@SW_HIDE) EndFunc ;don't know where these functions came from or who wrote them ; setting the default printer Func PrinterSetAsDefault($PrinterName) Local $result, $strComputer, $colEvents,$objWMIService $CurrentPrinter = GetDefaultPrinter() If $currentPrinter = $PrinterName Then Return $result = 0 $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colEvents = $objWMIService.ExecQuery _ (StringFormat('Select * From Win32_Printer')); Where DeviceID = "%s"', $PrinterName));TRUE For $objPrinter in $colEvents If $objPrinter.DeviceID = $PrinterName Then $objPrinter.SetDefaultPrinter() $result = 1 EndIf Next Return $result EndFunc Func GetDefaultPrinter() Local $result, $strComputer, $colEvents $result = '' $strComputer = "." $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\cimv2") $colEvents = $objWMIService.ExecQuery _ ("Select * From Win32_Printer Where Default = TRUE");TRUE For $objPrinter in $colEvents $result = $objPrinter.DeviceID Next Return $result EndFunc Once again thanks.
×
×
  • Create New...