Sign in to follow this  
Followers 0
Skins

Converting

5 posts in this topic

I have an annoying schedule system at work that is displayed via a web applet.

I want to be able to import the details of this into my Google calendar, however there is no export functionality in this system.

I am trying to make a script to convert this data into a .csv file to import into Google.

There didn't appear to be much useful past stuff when searching the forums for csv.

Is there any good example material out there for generating csv files in autoit?

The output would need to be in the following format

Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private
Final Exam,05/12/08,07:10:00 PM,05/12/08,10:00:00 PM,False,Two essay questions that will cover topics covered throughout the semester,"Columbia, Schermerhorn 614",True

The pages looks like this post-46503-12665279742293_thumb.jpg

I am thinking that I can take my source data as either a manual copy paste of the page

Date    Paid hours     Schedule details    Scheduled attendance   
  Start time     End time   
 15/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:25 10:40 
      Meal 12:00 12:30 
      Break 2 14:08 14:23 
      coaching 15:00 16:00 
  16/02/2010 8:52 i_business 08:30 17:52 
      Break 1 10:30 10:45 
      Meal 12:45 13:15 
      training 13:29 14:26 
      Break 2 15:00 15:15 
      Make up time 17:00 17:52 
  17/02/2010 8:14 i_business 08:30 17:14 
      Break 1 10:00 10:15 
      project work 11:01 12:00 
      Meal 12:30 13:00 
      computer issue 13:15 14:23 
      Break 2 14:30 14:45 
 18/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:15 10:30 
      Meal 12:00 12:30 
      Break 2 14:15 14:30 
 19/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:00 10:15 
      Meal 12:00 12:30 
      Break 2 14:00 14:15 
 20/02/2010 0:00 Day Off 
 21/02/2010 0:00 Day Off

or the HTML of the frame

<!-- actual scheduling data -->
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100215'></td>

          <td align="center"><span class='BoldText'>15/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:25</td>
           <td align="center">10:40</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:08</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;coaching</td>
           <td align="center">15:00</td>
           <td align="center">16:00</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>16/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:52</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:52</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:30</td>
           <td align="center">10:45</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:45</td>
           <td align="center">13:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;training</td>
           <td align="center">13:29</td>
           <td align="center">14:26</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">15:00</td>
           <td align="center">15:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Make up time</td>
           <td align="center">17:00</td>
           <td align="center">17:52</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>17/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:14</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:14</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;project work</td>
           <td align="center">11:01</td>
           <td align="center">12:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:30</td>
           <td align="center">13:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;computer issue</td>
           <td align="center">13:15</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:30</td>
           <td align="center">14:45</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100218'></td>

          <td align="center"><span class='BoldText'>18/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:15</td>
           <td align="center">10:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:15</td>
           <td align="center">14:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100219'></td>

          <td align="center"><span class='BoldText'>19/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:00</td>
           <td align="center">14:15</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100220'></td>

          <td align="center"><span class='BoldText'>20/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100221'></td>

          <td align="center"><span class='BoldText'>21/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
  
        </tbody>
      </table>
    </td>
  </tr>
</table></form>
</body></html>

My script so far looks like this

Dim $sText1 = ' 15/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:25 10:40 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:08 14:23 ' & @CRLF & _
'      coaching 15:00 16:00 ' & @CRLF & _
'  16/02/2010 8:52 i_business 08:30 17:52 ' & @CRLF & _
'      Break 1 10:30 10:45 ' & @CRLF & _
'      Meal 12:45 13:15 ' & @CRLF & _
'      training 13:29 14:26 ' & @CRLF & _
'      Break 2 15:00 15:15 ' & @CRLF & _
'      Make up time 17:00 17:52 ' & @CRLF & _
'  17/02/2010 8:14 i_business 08:30 17:14 ' & @CRLF & _
'      Break 1 10:00 10:15 ' & @CRLF & _
'      project work 11:01 12:00 ' & @CRLF & _
'      Meal 12:30 13:00 ' & @CRLF & _
'      computer issue 13:15 14:23 ' & @CRLF & _
'      Break 2 14:30 14:45 ' & @CRLF & _
' 18/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:15 10:30 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:15 14:30 ' & @CRLF & _
' 19/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:00 10:15 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:00 14:15 ' & @CRLF & _
' 20/02/2010 0:00 Day Off ' & @CRLF & _
' 21/02/2010 0:00 Day Off '


$sMsg = _Csvconv($sText1)
InputBox("Result", "CSV output", $sMsg, "", "500","150")


Func _Csvconv($sStr)
   


EndFunc

so basically I need help with the function bit :mellow:

Can anyone please help me to figure out what the best approach for this might be.

Share this post


Link to post
Share on other sites



You need to capture the html source code.

InetGet or _InetGetSource or InetRead will do that for you. Then grab your tabular data using regexps or whatever you want and populate a 2D array with that. Producing a "standard" :cough: .CSV is a piece of cake from this point.

Another possibility is to use the _IE* functions to parse the web page, but I don't know enough about them to be of any help there.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

I have an annoying schedule system at work that is displayed via a web applet.

I want to be able to import the details of this into my Google calendar, however there is no export functionality in this system.

I am trying to make a script to convert this data into a .csv file to import into Google.

There didn't appear to be much useful past stuff when searching the forums for csv.

Is there any good example material out there for generating csv files in autoit?

The output would need to be in the following format

Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private
Final Exam,05/12/08,07:10:00 PM,05/12/08,10:00:00 PM,False,Two essay questions that will cover topics covered throughout the semester,"Columbia, Schermerhorn 614",True

The pages looks like this post-46503-12665279742293_thumb.jpg

I am thinking that I can take my source data as either a manual copy paste of the page

Date    Paid hours     Schedule details    Scheduled attendance   
  Start time     End time   
 15/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:25 10:40 
      Meal 12:00 12:30 
      Break 2 14:08 14:23 
      coaching 15:00 16:00 
  16/02/2010 8:52 i_business 08:30 17:52 
      Break 1 10:30 10:45 
      Meal 12:45 13:15 
      training 13:29 14:26 
      Break 2 15:00 15:15 
      Make up time 17:00 17:52 
  17/02/2010 8:14 i_business 08:30 17:14 
      Break 1 10:00 10:15 
      project work 11:01 12:00 
      Meal 12:30 13:00 
      computer issue 13:15 14:23 
      Break 2 14:30 14:45 
 18/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:15 10:30 
      Meal 12:00 12:30 
      Break 2 14:15 14:30 
 19/02/2010 8:00 i_business 08:30 17:00 
      Break 1 10:00 10:15 
      Meal 12:00 12:30 
      Break 2 14:00 14:15 
 20/02/2010 0:00 Day Off 
 21/02/2010 0:00 Day Off
or the HTML of the frame

<!-- actual scheduling data -->
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100215'></td>

          <td align="center"><span class='BoldText'>15/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:25</td>
           <td align="center">10:40</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:08</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;coaching</td>
           <td align="center">15:00</td>
           <td align="center">16:00</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>16/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:52</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:52</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:30</td>
           <td align="center">10:45</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:45</td>
           <td align="center">13:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;training</td>
           <td align="center">13:29</td>
           <td align="center">14:26</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">15:00</td>
           <td align="center">15:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Make up time</td>
           <td align="center">17:00</td>
           <td align="center">17:52</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>17/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:14</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:14</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;project work</td>
           <td align="center">11:01</td>
           <td align="center">12:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:30</td>
           <td align="center">13:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;computer issue</td>
           <td align="center">13:15</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:30</td>
           <td align="center">14:45</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100218'></td>

          <td align="center"><span class='BoldText'>18/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:15</td>
           <td align="center">10:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:15</td>
           <td align="center">14:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100219'></td>

          <td align="center"><span class='BoldText'>19/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:00</td>
           <td align="center">14:15</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100220'></td>

          <td align="center"><span class='BoldText'>20/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100221'></td>

          <td align="center"><span class='BoldText'>21/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
  
        </tbody>
      </table>
    </td>
  </tr>
</table></form>
</body></html>
My script so far looks like this

Dim $sText1 = ' 15/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:25 10:40 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:08 14:23 ' & @CRLF & _
'      coaching 15:00 16:00 ' & @CRLF & _
'  16/02/2010 8:52 i_business 08:30 17:52 ' & @CRLF & _
'      Break 1 10:30 10:45 ' & @CRLF & _
'      Meal 12:45 13:15 ' & @CRLF & _
'      training 13:29 14:26 ' & @CRLF & _
'      Break 2 15:00 15:15 ' & @CRLF & _
'      Make up time 17:00 17:52 ' & @CRLF & _
'  17/02/2010 8:14 i_business 08:30 17:14 ' & @CRLF & _
'      Break 1 10:00 10:15 ' & @CRLF & _
'      project work 11:01 12:00 ' & @CRLF & _
'      Meal 12:30 13:00 ' & @CRLF & _
'      computer issue 13:15 14:23 ' & @CRLF & _
'      Break 2 14:30 14:45 ' & @CRLF & _
' 18/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:15 10:30 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:15 14:30 ' & @CRLF & _
' 19/02/2010 8:00 i_business 08:30 17:00 ' & @CRLF & _
'      Break 1 10:00 10:15 ' & @CRLF & _
'      Meal 12:00 12:30 ' & @CRLF & _
'      Break 2 14:00 14:15 ' & @CRLF & _
' 20/02/2010 0:00 Day Off ' & @CRLF & _
' 21/02/2010 0:00 Day Off '


$sMsg = _Csvconv($sText1)
InputBox("Result", "CSV output", $sMsg, "", "500","150")


Func _Csvconv($sStr)
   


EndFunc
so basically I need help with the function bit :mellow:

Can anyone please help me to figure out what the best approach for this might be.

htm.htm

<!-- actual scheduling data -->
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100215'></td>

          <td align="center"><span class='BoldText'>15/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:25</td>
           <td align="center">10:40</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:08</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;coaching</td>
           <td align="center">15:00</td>
           <td align="center">16:00</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>16/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:52</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:52</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:30</td>
           <td align="center">10:45</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:45</td>
           <td align="center">13:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;training</td>
           <td align="center">13:29</td>
           <td align="center">14:26</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">15:00</td>
           <td align="center">15:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Make up time</td>
           <td align="center">17:00</td>
           <td align="center">17:52</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>17/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:14</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:14</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;project work</td>
           <td align="center">11:01</td>
           <td align="center">12:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:30</td>
           <td align="center">13:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;computer issue</td>
           <td align="center">13:15</td>
           <td align="center">14:23</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:30</td>
           <td align="center">14:45</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100218'></td>

          <td align="center"><span class='BoldText'>18/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:15</td>
           <td align="center">10:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:15</td>
           <td align="center">14:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100219'></td>

          <td align="center"><span class='BoldText'>19/02/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>08:30</span></td>
          <td align="center"><span class='BoldText'>17:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">10:00</td>
           <td align="center">10:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">12:00</td>
           <td align="center">12:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">14:00</td>
           <td align="center">14:15</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100220'></td>

          <td align="center"><span class='BoldText'>20/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100221'></td>

          <td align="center"><span class='BoldText'>21/02/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
  
        </tbody>
      </table>
    </td>
  </tr>
</table></form>
</body></html>

#Include <Array.au3>
#include <IE.au3>
$oIE = _IECreate ("C:\htm.htm",0,0)
$sText = _IEBodyReadText ($oIE)
$Array = StringSplit($sText, " ")
Dim $RArray[2]
For $R = 1 To $Array[0]
If StringStripWS($Array[$R] ,8) <> ""  Then
$Text = $Array[$R]
$pos1 = StringInStr($Array[$R], "/")
$pos2 = StringInStr($Array[$R], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$R], "/",0,1,$pos2)
$pos4 = StringInStr($Array[$R], ":")
$BOOL = ($pos1) And ($pos2) And ($pos3)
if Not ($BOOL) And Not ($pos4) Then
$Text = ""
For $M = $R To $Array[0]
If StringStripWS($Array[$M] ,8) <> ""  Then
$pos1 = StringInStr($Array[$M], "/")
$pos2 = StringInStr($Array[$M], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$M], "/",0,1,$pos2)
$pos4 = StringInStr($Array[$M], ":")
$BOOL = ($pos1) And ($pos2) And ($pos3)
if ($BOOL) Or ($pos4) Then
$R = $M - 1
ExitLoop
EndIf
$Text &= " "
$Text &= $Array[$M]
EndIf
Next
EndIf
$RArray[UBound($RArray) - 1] = $Text
ReDim $RArray[UBound($RArray) + 1]
EndIf
Next
ReDim $RArray[UBound($RArray) - 1]
$RArray[0] = UBound($RArray) -1
$Array = $RArray
Dim $OutArray[1][5]
$OutArray[0][0] = "Date"
$OutArray[0][1] = "Paid hours"
$OutArray[0][2] = "Schedule details"
$OutArray[0][3] = "Start time"
$OutArray[0][4] = "End time"
$TestNewDay = False
for $i = 1 To $Array[0]
$pos1 = StringInStr($Array[$i], "/")
$pos2 = StringInStr($Array[$i], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$i], "/",0,1,$pos2)
if ($pos1) And ($pos2) And ($pos3) Then
ReDim $OutArray[UBound($OutArray) + 1][5]
$OutArray[UBound($OutArray) - 1][0] = $Array[$i]
$OutArray[UBound($OutArray) - 1][1] = $Array[$i + 1]
$OutArray[UBound($OutArray) - 1][2] = $Array[$i + 2]
if $Array[$i + 2] == " Day Off" Then ContinueLoop
if $Array[0]  < $i + 4 Then ExitLoop
$OutArray[UBound($OutArray) - 1][3] = $Array[$i + 3]
$OutArray[UBound($OutArray) - 1][4] = $Array[$i + 4]
$i += 3
for $j = $i To $Array[0]
$pos1 = StringInStr($Array[$j], "/")
$pos2 = StringInStr($Array[$j], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$j], "/",0,1,$pos2)
if ($pos1) And ($pos2) And ($pos3) Then
$i = $j - 1
ExitLoop
EndIf
$pos1 = StringInStr($Array[$j + 1], "/")
$pos2 = StringInStr($Array[$j + 1], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$j + 1], "/",0,1,$pos2)
if ($pos1) And ($pos2) And ($pos3) Then
$i = $j - 1
ExitLoop
EndIf
$pos1 = StringInStr($Array[$j + 2], "/")
$pos2 = StringInStr($Array[$j + 2], "/",0,1,$pos1)
$pos3 = StringInStr($Array[$j + 2], "/",0,1,$pos2)
if ($pos1) And ($pos2) And ($pos3) Then
$i = $j - 1
ExitLoop
EndIf
ReDim $OutArray[UBound($OutArray) + 1][5]
$OutArray[UBound($OutArray) - 1][2] = $Array[$j + 2]
$OutArray[UBound($OutArray) - 1][3] = $Array[$j + 3]
$OutArray[UBound($OutArray) - 1][4] = $Array[$j + 4]
$j += 2
Next
EndIf
Next

_ArrayDisplay($OutArray,"")

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

OK, so here's my take:

<html>
  <body>
    <form>
      <table>
        <tr>
          <td>
            <table> 
              <tbody>
                <tr>
                  <td align="center"><input type="checkbox" name="item" value='20100215'></td>
                  <td align="center"><span class='BoldText'>15/02/2010</span></td>
                  <td align="center"><span class='BoldText'>8:00</span></td>
                  <td><span class='BoldText'>i_business</span></td>
                  <td align="center"><span class='BoldText'>08:30</span></td>
                  <td align="center"><span class='BoldText'>17:00</span></td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
                  <td align="center">10:25</td>
                  <td align="center">10:40</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
                  <td align="center">12:00</td>
                  <td align="center">12:30</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
                  <td align="center">14:08</td>
                  <td align="center">14:23</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;coaching</td>
                  <td align="center">15:00</td>
                  <td align="center">16:00</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="center"><span class='BoldText'>16/02/2010</span></td>
                  <td align="center"><span class='BoldText'>8:52</span></td>
                  <td><span class='BoldText'>i_business</span></td>
                  <td align="center"><span class='BoldText'>08:30</span></td>
                  <td align="center"><span class='BoldText'>17:52</span></td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
                  <td align="center">10:30</td>
                  <td align="center">10:45</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
                  <td align="center">12:45</td>
                  <td align="center">13:15</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;training</td>
                  <td align="center">13:29</td>
                  <td align="center">14:26</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
                  <td align="center">15:00</td>
                  <td align="center">15:15</td>
                </tr>
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Make up time</td>
                  <td align="center">17:00</td>
                  <td align="center">17:52</td>
                </tr>
                <tr>
                  <td align="center">&nbsp;</td>
                  <td align="center"><span class='BoldText'>17/02/2010</span></td>
                  <td align="center"><span class='BoldText'>8:14</span></td>
                  <td><span class='BoldText'>i_business</span></td>
                  <td align="center"><span class='BoldText'>08:30</span></td>
                  <td align="center"><span class='BoldText'>17:14</span></td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
                  <td align="center">10:00</td>
                  <td align="center">10:15</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;project work</td>
                  <td align="center">11:01</td>
                  <td align="center">12:00</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
                  <td align="center">12:30</td>
                  <td align="center">13:00</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;computer issue</td>
                  <td align="center">13:15</td>
                  <td align="center">14:23</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
                  <td align="center">14:30</td>
                  <td align="center">14:45</td>
                </tr>   
                <tr>
                  <td align="center"><input type="checkbox" name="item" value='20100218'></td>
                  <td align="center"><span class='BoldText'>18/02/2010</span></td>
                  <td align="center"><span class='BoldText'>8:00</span></td> 
                  <td><span class='BoldText'>i_business</span></td>
                  <td align="center"><span class='BoldText'>08:30</span></td>
                  <td align="center"><span class='BoldText'>17:00</span></td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
                  <td align="center">10:15</td>
                  <td align="center">10:30</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
                  <td align="center">12:00</td>
                  <td align="center">12:30</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
                  <td align="center">14:15</td>
                  <td align="center">14:30</td>
                </tr>   
                <tr>
                  <td align="center"><input type="checkbox" name="item" value='20100219'></td>
                  <td align="center"><span class='BoldText'>19/02/2010</span></td>
                  <td align="center"><span class='BoldText'>8:00</span></td> 
                  <td><span class='BoldText'>i_business</span></td>
                  <td align="center"><span class='BoldText'>08:30</span></td>
                  <td align="center"><span class='BoldText'>17:00</span></td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
                  <td align="center">10:00</td>
                  <td align="center">10:15</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
                  <td align="center">12:00</td>
                  <td align="center">12:30</td>
                </tr> 
                <tr>
                  <td COLSPAN="3">&nbsp;</td>
                  <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
                  <td align="center">14:00</td>
                  <td align="center">14:15</td>
                </tr>   
                <tr>
                  <td align="center"><input type="checkbox" name="item" value='20100220'></td>
                  <td align="center"><span class='BoldText'>20/02/2010</span></td>
                  <td align="center"><span class='BoldText'>0:00</span></td> 
                  <td colspan="3"><span class='BoldText'>Day Off</span></td>  
                <tr>
                  <td align="center"><input type="checkbox" name="item" value='20100221'></td>
                  <td align="center"><span class='BoldText'>21/02/2010</span></td>
                  <td align="center"><span class='BoldText'>0:00</span></td> 
                  <td colspan="3"><span class='BoldText'>Day Off</span></td>   
              </tbody>
            </table>
          </td>
        </tr>
      </table>
    </form>
  </body>
</html>
#include <IE.au3>
#include <Array.au3>
$oIE = _IECreate(@ScriptDir & "\test.html") ;Open HTML file
$oTable = _IETableGetCollection($oIE, 1) ;Get second (nested) table
$aTable = _IETableWriteToArray($oTable) ;Write table to array
For $i = 1 To UBound($aTable, 1) - 1 ;Loop through rows
    For $j = 0 To UBound($aTable, 2) - 1 ;Loop through columns
        If StringInStr($aTable[$i][$j],"/") Then ;Check for date
            $aSplit = StringSplit($aTable[$i][$j], "/") ;Split d/m/yyyy
            $aTable[$i][$j] = $aSplit[2] & "/" & $aSplit[1] & "/" & StringRight($aSplit[3], 2) ;Set date as mm/dd/yy
        ElseIf StringInStr($aTable[$i][$j],":") Then ;Check for time
            $aSplit = StringSplit($aTable[$i][$j], ":") ;Split hh:mm
            If $aSplit[1] > 12 Then ;Check if hour is greater than 12
                $hh = StringFormat("%02d", $aSplit[1] - 12) ;Set PM hour
                $ampm = "PM"
            Else
                $hh = StringFormat("%02d", $aSplit[1]) ;Set AM hour
                $ampm = "AM"
            EndIf
            $aTable[$i][$j] = $hh & ":" & $aSplit[2] & ":00 " & $ampm ;Set time in hh:mm:ss AM/PM format
        ElseIf $aTable[$i][$j] = "" Then
            $aTable[$i][$j] = $aTable[$i][$j - 1] ;Auto-fill blank values
        EndIf
        $aTable[$i][$j] = StringStripWS($aTable[$i][$j], 3) ;Trim whitespace
    Next
Next
_IEQuit($oIE)
_ArrayDisplay($aTable)
$csv = "Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private"
$filename = @ScriptDir & "\test.csv"
$csvfile = FileOpen($filename, 2)
For $i = 0 to UBound($aTable, 2) - 1
    $csv &= $aTable[3][$i] & "," & $aTable[1][$i] & "," & $aTable[4][$i] & "," & $aTable[1][$i] & "," & $aTable[5][$i] & @CRLF
Next
FileWrite($csvfile, $csv)
FileClose($csvfile)
RunWait("notepad.exe " & $filename)
You may have to explore more _IE* functions to actually get your data, but hopefully that should get you on the right track. Edited by GMK

Share this post


Link to post
Share on other sites

post-46503-12677793457935_thumb.jpg

So I'm having some success Thanks to the kind contributions of the forum members.

I have tried GMK's method so far.

wolf9228 if you think they way you've done it would solve any of my headaches please point it out because I haven't had time to try it yet.

Got a bit puzzled at one point by the fact that google calendars respect Time Zone settings .. and everything was out by 12 hours.

so here's what I have adapted so far.

added the = 12 bit because it was necessary.

#include <IE.au3>
#include <Array.au3>
$oIE = _IECreate(@ScriptDir & "\output.html") ;Open HTML file
$oTable = _IETableGetCollection($oIE, 1) ;Get second (nested) table
$aTable = _IETableWriteToArray($oTable) ;Write table to array
For $i = 1 To UBound($aTable, 1) - 1 ;Loop through rows
    For $j = 0 To UBound($aTable, 2) - 1 ;Loop through columns
        If StringInStr($aTable[$i][$j],"/") Then ;Check for date
            $aSplit = StringSplit($aTable[$i][$j], "/") ;Split d/m/yyyy
            $aTable[$i][$j] = $aSplit[2] & "/" & $aSplit[1] & "/" & StringRight($aSplit[3], 2) ;Set date as mm/dd/yy
        ElseIf StringInStr($aTable[$i][$j],":") Then ;Check for time
            $aSplit = StringSplit($aTable[$i][$j], ":") ;Split hh:mm
            If $aSplit[1] > 12 Then ;Check if hour is greater than 12
                $hh = StringFormat("%02d", $aSplit[1] - 12) ;Set PM hour
                $ampm = "PM"
            ElseIf $aSplit[1] = 12 Then
                $hh = StringFormat("%02d", $aSplit[1]) ;Set PM hour
                $ampm = "PM"
            Else
                $hh = StringFormat("%02d", $aSplit[1]) ;Set AM hour
                $ampm = "AM"
            EndIf
            $aTable[$i][$j] = $hh & ":" & $aSplit[2] & ":00 " & $ampm ;Set time in hh:mm:ss AM/PM format
        ElseIf $aTable[$i][$j] = "" Then
            $aTable[$i][$j] = $aTable[$i][$j - 1] ;Auto-fill blank values
        EndIf
        $aTable[$i][$j] = StringStripWS($aTable[$i][$j], 3) ;Trim whitespace
    Next
Next
_IEQuit($oIE)
_ArrayDisplay($aTable)
$csv = "Subject,Start Date,Start Time,End Date,End Time,All Day Event,Description,Location,Private" & @CRLF
$filename = @ScriptDir & "\test.csv"
$csvfile = FileOpen($filename, 2)
For $i = 0 to UBound($aTable, 2) - 1
    $csv &= $aTable[3][$i] & "," & $aTable[1][$i] & "," & $aTable[4][$i] & "," & $aTable[1][$i] & "," & $aTable[5][$i] & @CRLF
Next
FileWrite($csvfile, $csv)
FileClose($csvfile)
RunWait("notepad.exe " & $filename)

but at the moment I am relying on this rather messy secondary script because I'm not sure on

A ) how to get the _IE commands to look at a frame not the whole page

B ) how to do a reg expression clip before the _IETable commands.

_INetGetSource just tells me 'Your session has been timed out' .. because this is a java generated thing with a login..

Dim $sHead = '<html>' & @CRLF & _
             '  <body>' & @CRLF & _
             '    <form>' & @CRLF & _
             '      <table>' & @CRLF & _
             '        <tr>' & @CRLF & _
             '          <td>' & @CRLF & _
             '            <table>' & @CRLF & _
             '              <tbody>' & @CRLF & _
             '                <tr>'




dim $sfile = FileOpen(@ScriptDir & "\ScheduleMain.txt", 0)

If $sfile = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf


Dim $sSource = FileRead($sfile)

dim $sAct = StringInStr($sSource, "<!-- actual scheduling data -->") + 41 ; Find the <!-- actual scheduling data --> and 41 char later
Dim $tBody = StringTrimLeft($sSource, $sAct)


dim $sBody = $sHead & @CRLF & $tBody


FileClose($sfile)

dim $ofile = FileOpen(@ScriptDir & "\output.html", 2)
If $ofile = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf

FileWrite($ofile,$sBody)

FileClose($ofile)

;ClipPut ($sbody)
;ClipPut ($sSource)

I'm thinking that if I want to fully automate this I might have to get into the even more messy move the mouse around commands to get past this java script hurdle.

where ScheduleMain.txt is the view page source of the middle frame of the web page and looks like:

<html><head>
  
  <link rel="Stylesheet" type="text/css" href="css/main.css">
  <link rel="Stylesheet" type="text/css" href="css/WFM.css">

  <script type="text/javascript" src="js/WFM.js"></script>
  <script type="text/javascript" src="js/button.js"></script>
  <script type="text/javascript" src="js/button_css.js"></script>
  <script type="text/javascript" src="js/iconButton.js"></script>
  <script type="text/javascript" src='js/agenthelp.js'></script>

  <script type="text/javascript" src="js/ialert.js"></script>
<script>
  btnCreate = new MilButton ('create trade proposals', 'pressCreate()');
  btnPersonal = new MilButton ('review proposals', 'pressPersonal()');
  btnMy = new MilButton ('review responses', 'pressMy()');
  btnHelp = new MilButton ('help', 'showHelp(agentHelpSchedule)');

  function checkForm(){
    var result = false;
    if(window.document.createprop.item!=null){
    if(typeof window.document.createprop.item.length == 'undefined'){
        if(window.document.createprop.item.checked) return true;
    }else{
      for(var i=0;i<window.document.createprop.item.length;i++){
            if(window.document.createprop.item[i]!=null
                && window.document.createprop.item[i].checked) return true;
      }
    }
  }
    return result;
  }
  function pressCreate(){
    if(checkForm()){
      postForm(window.document.createprop,'','CreateProposals.jsp');
    }else{
/*    alert('Entered data is incorrect or missing.');*/
            showAlert('Entered data is incorrect or missing.',
                                'WFM Web Agent');
    }
  }

  function pressPersonal(){
    window.document.createprop.view.value='S_AGNT_PERSONAL_PROPOSALS';
    window.document.createprop.YEAR.value=2010;
    window.document.createprop.MONTH.value=2;
    window.document.createprop.DAY.value=5;
    postForm(window.document.createprop,'SET_SESSION_DATE','TradingFrameset.jsp');
  }

  function pressMy(){
    window.document.createprop.view.value='S_AGNT_MY_PROPOSALS';
    window.document.createprop.YEAR.value=2010;
    window.document.createprop.MONTH.value=2;
    window.document.createprop.DAY.value=5;
    postForm(window.document.createprop,'SET_SESSION_DATE','TradingFrameset.jsp');
  }

</script>
</head>

<body class="FrameBody" onfocus="alertonfocusHandler()" onunload="hideAlert()"><form method="post" name="createprop" action="" target="resource_frame"><input type='hidden' id='event' name='event' value=''><input type='hidden' id='uid' name='uid' value='1725167f358f2c00'><input type="hidden" name="view" value=""><input type="hidden" name="YEAR" value=""><input type="hidden" name="MONTH" value=""><input type="hidden" name="DAY" value="">
<table width="100%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td valign="top">
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
          <thead class="ListHeaderContainer">

  
        <tr>
          <td colspan="7">
            <table border="0" cellspacing="2" cellpadding="0">
              <tr>
            
            
                <td align="center" valign="middle"><script>btnCreate.printHTML(document);</script></td>
                <td align="center" valign="middle"><script>btnHelp.printHTML(document);</script></td>
              </tr>
            </table>
          </td>
        </tr>

        <tr>

          <td class="ListHeaderCell" rowspan="2">&nbsp;</td>

          <td class="ListHeaderCell" rowspan="2" width="20%">&nbsp;
            Date
          </td>
          <td class="ListHeaderCell" rowspan="2" width="10%" nowrap>&nbsp;
            Paid hours&nbsp;
          </td>
          <td class="ListHeaderCell" rowspan="2" width="50%">&nbsp;
            Schedule details
          </td>
          <td class="ListHeaderCell" colspan="2" width="10%" nowrap>&nbsp;
            Scheduled attendance&nbsp;
          </td>
        </tr>
        <tr>
          <td class="ListHeaderCell" width="10%" nowrap>&nbsp;
            Start time&nbsp;
          </td>
          <td class="ListHeaderCell" width="10%" nowrap>&nbsp;
            End time&nbsp;
          </td>
        </tr>
          </thead>
          <tbody  class="List">
  
  <!-- actual scheduling data -->
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100301'></td>

          <td align="center"><span class='BoldText'>1/03/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>11:30</span></td>
          <td align="center"><span class='BoldText'>20:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">13:30</td>
           <td align="center">13:45</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">15:30</td>
           <td align="center">16:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">17:45</td>
           <td align="center">18:00</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100302'></td>

          <td align="center"><span class='BoldText'>2/03/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>11:30</span></td>
          <td align="center"><span class='BoldText'>20:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">12:45</td>
           <td align="center">13:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;team meeting</td>
           <td align="center">13:00</td>
           <td align="center">14:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">15:00</td>
           <td align="center">15:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">17:15</td>
           <td align="center">17:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100303'></td>

          <td align="center"><span class='BoldText'>3/03/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>11:30</span></td>
          <td align="center"><span class='BoldText'>20:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">13:15</td>
           <td align="center">13:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">15:30</td>
           <td align="center">16:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">18:15</td>
           <td align="center">18:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center">&nbsp;</td>

          <td align="center"><span class='BoldText'>4/03/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>11:30</span></td>
          <td align="center"><span class='BoldText'>20:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;project work</td>
           <td align="center">11:30</td>
           <td align="center">11:41</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">13:15</td>
           <td align="center">13:30</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">15:45</td>
           <td align="center">16:15</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">18:15</td>
           <td align="center">18:30</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100305'></td>

          <td align="center"><span class='BoldText'>5/03/2010</span></td>
          <td align="center"><span class='BoldText'>8:00</span></td>
          
          <td><span class='BoldText'>i_business</span></td>
          <td align="center"><span class='BoldText'>11:30</span></td>
          <td align="center"><span class='BoldText'>20:00</span></td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 1</td>
           <td align="center">13:30</td>
           <td align="center">13:45</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Meal</td>
           <td align="center">15:30</td>
           <td align="center">16:00</td>
        </tr>
      
        <tr>

           <td COLSPAN="3">&nbsp;</td>

           <td>&nbsp;&nbsp;&nbsp;&nbsp;Break 2</td>
           <td align="center">17:30</td>
           <td align="center">17:45</td>
        </tr>
      
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100306'></td>

          <td align="center"><span class='BoldText'>6/03/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
        <tr>

          <td align="center"><input type="checkbox" name="item" value='20100307'></td>

          <td align="center"><span class='BoldText'>7/03/2010</span></td>
          <td align="center"><span class='BoldText'>0:00</span></td>
          
          <td colspan="3"><span class='BoldText'>Day Off</span></td>
          
    
  
        </tbody>
      </table>
    </td>
  </tr>
</table></form>
</body></html>

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0