Sign in to follow this  
Followers 0
DarkFalz

Need help with gui please

4 posts in this topic

Hey im editing sandin's great gdi toolbar script. i edited it to match some sites i use at my vocational school, and for some sites like blackboard, and brainbench i made an auto login. the login group below the edit box, i want it to be universal. Say if i click the blackboard icon when u enter ur login information and hit the connect button it will log you into the blackboard site, but say if u hit the brainbench icon and enter your login information and hit the connect button it will log you into the brainbench site, all using one button. I cant quite seem to get this to work, and have been struggling with it all weekend. i know its prob something simple but any help would be greatly appriciated.

Posted Image

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <IE.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <STATICCONSTANTS.AU3>
#include <EDITCONSTANTS.AU3>
#include <MISC.AU3>
#include <WinAPI.au3>

_GDIPlus_Startup()

Opt("OnExitFunc", "endscript") ;func @ exiting script
TrayTip("Site Navigator", "Edited By: Kevin Christensen", 1, 1)

Dim $icons[10] ;number of icons used
Dim $icon_info[10][6] ;number of icons used and their information
Global $shell32 = @SystemDir & "\shell32.dll" ;shell32.dll location, the file for icon extraction
Global $cur_first = 0, $cur_last = 9, $moving = False, $timer_10, $hGraphic, $timer_end_txt, $inside = False ;some global variables
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 10) ;Used as a 10p black boarder around each icon when sizing or moving.
Global $blackboard = 0, $brainben = 1, $outlook = 2, $w3schools = 3, $quackit = 4, $echoecho = 5, $tulsatech = 6, $google = 7, $yahoo = 8, $gmail = 9

$timer_10 = TimerInit() ;this timer is limiting sliding to max speed of 10ms/px
$timer_end_txt = TimerInit() ;this timer is used for toolbar label to vanish (check While 1 section)
_set_icon_info() ;setting icons info, check the function for detail info

$Form1 = GUICreate("Site Navigator", 253, 310) ;gui creation
GUISetBkColor(0) ;gui black background color
GUICtrlCreateGroup("Login Panel", 12, 205, 230, 98, $WS_SYSMENU)
$usernamelabel = GUICtrlCreateLabel("Username:", 20, 221, 52, 17)
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
$passwordlabel = GUICtrlCreateLabel("Password:", 20, 251, 50, 17)
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
$user = GUICtrlCreateInput("", 76, 220, 160, 21)
$pass = GUICtrlCreateInput("", 76, 250, 160, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$connect = GUICtrlCreateButton("Connect", 90, 277, 70, 20, $BS_DEFPUSHBUTTON)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
$reset = GUICtrlCreateButton("Reset", 165, 277, 60, 20)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
$hLabel = GUICtrlGetHandle(GUICtrlCreateLabel("", 0, 0, 253, 56)) ;used this to draw the icons on, saves resizing the pen width when drawing the boarder, otherwise the boarder goes over the $toolbar_display_txt
GUICtrlCreateGroup("", 12, 71, 229, 130) ;group around edit
$Edit1 = GUICtrlCreateEdit("              -!- Site Navigator v1.0 -!-                 ", 15, 79, 223, 120, $WS_VSCROLL + 0x0040 + 0x0004 + 0x1000) ;edit control to display icons clicking
GUICtrlSetBkColor(-1, 0x333333) ;gray background of edit ctrl
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
$toolbar_display_txt = GUICtrlCreateLabel("", 10, 49 + 7, 233, 17, 0x01) ;label to display curent selected toolbar icon with "CENTER" style = 0x01
GUICtrlSetColor(-1, 0xFFFFFF) ;above label color is white
GUICtrlSetFont(-1, 12, 800, 2, "Arial") ;above label's font = arial, 800=bold
WinSetTrans($Form1, "", 255) ;setting transp to 255 (max) will make GDI always visible (without disappearing when moved on the edge of the desktop, or when overlaped by another window
;note - must be before declaring graphic GDI in order for this to work
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hLabel) ;creating graphic for drawing toolbar icons
_extract_icons() ;extracting icons from shell32.dll, check func for detail info
GUISetState(@SW_SHOW, $Form1) ;display main GUI

$stemp = GUICreate("", 30, 14, 185, 209, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x333333) ;background color is the same as EDIT in main window
$clear_label = GUICtrlCreateLabel("Clear", 0, 0, 30, 14, 0x01) ;clear label with "CENTER" style = 0x01
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp) ;display clear label inside of edit control

$stemp2 = GUICreate("                  -/- Site Navigator v1.0 -\-                 Click on an icon shortcut to execute.         *If icon is a link with a sign in, please sign in below then hit connect*                                                                                     --Thanks, Kevin Christensen -----------------------------------------------------------------", 30, 14, 155, 209, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp2, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x333333) ;background color is the same as EDIT in main window
$clear_label2 = GUICtrlCreateLabel("Help", 0, 0, 30, 14, 0x01) ;clear label with "CENTER" style = 0x01
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp2) ;display clear label inside of edit control

$stemp3 = GUICreate("                       -/- Credits -\-                                  *Special Thanks to Sandin*               *Scripter: Kevin Christensen (DarkFalz)", 45, 14, 13, 310, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp3, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x000000) ;background color is the same as EDIT in main window
$connect_label2 = GUICtrlCreateLabel("Credits", 0, 0, 45, 14, 0x01)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp3) ;display clear label inside of edit control

For $i = 0 To 4
_GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32) ;drawing first 4 icons into GDI (window)
Next
Global $number
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $clear_label ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "              -!- Site Navigator v1.0 -!-                 ")
  Case $connect_label2 ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "------------------------!- Credits -!-----------------------               -!-Site Navigator v1.0 -!-                          *Special Thanks to Sandin*               *Editer: Kevin Christensen (DarkFalz)*        *Scripting Language - AutoItScript*          *Release Date: September 2nd 2009*    ----------------------------------------------------------------")
  Case $clear_label2 ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "              -!- Site Navigator v1.0 -!-              Click on an icon shortcut to execute.         *If icon is a link with a sign in, please sign in below then hit connect*                                                                                     --Thanks, Kevin Christensen -----------------------------------------------------------------")
  Case $connect ;*This onyl works for one site, i need it for multiple!!!*
   $o = _IECreate("<a href='http://tulsatech.blackboard.com/webapps/login/' class='bbc_url' title='External link' rel='external'>http://tulsatech.blackboard.com/webapps/login/</a>")
   _IELoadWait($o)

   Sleep(200)
   Send(GUICtrlRead($user));Username
   Sleep(100)
   Send("{TAB}")
   Sleep(100)
   Send(GUICtrlRead($pass));Password
   Sleep(100)
   Send("{ENTER}")


  Case $reset
   GUICtrlSetData($user, "")
   GUICtrlSetData($pass, "")
EndSwitch

Local $c = GUIGetCursorInfo($Form1) ;get mouse location inside of GUI
Local $x_coord = $c[0] ;mouse x coordinate inside of GUI
Local $y_coord = $c[1] ;mouse y coordinate isnide of GUI
If $y_coord < 52 And $y_coord > 0 And WinActive($Form1) Then ;top and bottom coordinate of toolbar
  If TimerDiff($timer_10) >= 10 Then ;sliding is chaotic if there is no speed limitation, 10ms in this case is just enough
   $timer_10 = TimerInit()
   Switch $x_coord
    Case - 100 To 41 ;left corner - moving icons to the right
     $inside = True ;is mouse inside of sliding area? yes!
     _shrink_all() ;if there is any icon that is enlarged, it'll be decreased
     $moving = True ;is slider mooving? yes!
     Local $speed
     Local $x_coord1 = $x_coord
     If $x_coord1 < 0 Then
      $x_coord1 = 0 ;if this isn't limited to 0 then the speed would continue to increase if the mouse is outside (but near) window
     EndIf
     $speed = Int(((41 - $x_coord1) / 15) ^ 2) ;acceleration and speed of sliding icons is increased parabolical, and not linear, that's why ^2
     If $speed < 1 Then $speed = 1 ;min speed should be 1px
     For $i = 0 To 9
      $icon_info[$i][3] += $speed ;changing x starting coordinate for each icon
      $icon_info[$i][4] += $speed ;changing x starting coordinate for each icon

      If Int($icon_info[$cur_first][3]) >= 25 Then ;this is where last icon become first
       Local $previous = $cur_first
       $cur_first -= 1
       If $cur_first < 0 Then $cur_first = 9
       $icon_info[$cur_first][3] = Int($icon_info[$previous][3]) - 57
       $icon_info[$cur_first][4] = Int($icon_info[$previous][4]) - 57
      EndIf

      If $icon_info[$i][3] < 253 + 25 Then ;icons that aren't visible shouldn't move at all (and thus save pc resources)
       Local $width_x = 10
       _GDIPlus_GraphicsDrawRect($hGraphic, $icon_info[$i][3] - 5, 15 - 5, 32 + 10, 32 + 10, $hPen) ;boarder bigger then icon
       _GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32);icon image
      EndIf
     Next
    Case 212 To 253 + 100 ;right corner - moving to the left
     $inside = True
     _shrink_all()
     $moving = True
     Local $speed
     Local $x_coord1 = $x_coord
     If $x_coord1 > 253 Then
      $x_coord1 = 253
     EndIf
     $speed = Int((($x_coord1 - 212) / 15) ^ 2)
     If $speed < 1 Then $speed = 1
     For $i = 0 To 9
      $icon_info[$i][3] -= $speed
      $icon_info[$i][4] -= $speed

      If Int($icon_info[$cur_last][3]) <= 228 Then ;this is where first icon become last
       Local $previous = $cur_last
       $cur_last += 1
       If $cur_last > 9 Then $cur_last = 0
       $icon_info[$cur_last][3] = Int($icon_info[$previous][3]) + 57
       $icon_info[$cur_last][4] = Int($icon_info[$previous][4]) + 57

      EndIf

      If $icon_info[$i][4] + 25 > 0 Then
       Local $width_x = 10
       _GDIPlus_GraphicsDrawRect($hGraphic, $icon_info[$i][3] - 5, 15 - 5, 32 + 10, 32 + 10, $hPen) ;boarder bigger then icon
       _GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32) ;icon image
      EndIf
     Next
    Case Else
     $moving = False
     If $inside = True Then
      $inside = False
      Local $founded = 10
      For $i = 0 To 9
       If $icon_info[$i][2] = True Then
        $founded = $i
        ExitLoop
       EndIf
      Next
      If $founded <> 10 Then
       If $icon_info[$founded][5] = False Then
        _easy_rise($icons[$founded], $icon_info[$founded][3] - 2, 12, 37, 37)
        $icon_info[$founded][5] = True
       EndIf
      EndIf
     EndIf
   EndSwitch
  EndIf
  Switch $x_coord
   Case $icon_info[0][3] - 5 To $icon_info[0][4] + 5 ;1st icon, mouse is hovering above 1st icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(0)
   Case $icon_info[1][3] - 5 To $icon_info[1][4] + 5 ;2nd icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(1)
   Case $icon_info[2][3] - 5 To $icon_info[2][4] + 5 ;3rd icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(2)
   Case $icon_info[3][3] - 5 To $icon_info[3][4] + 5 ;4th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(3)
   Case $icon_info[4][3] - 5 To $icon_info[4][4] + 5 ;5th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(4)
   Case $icon_info[5][3] - 5 To $icon_info[5][4] + 5 ;6th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(5)
   Case $icon_info[6][3] - 5 To $icon_info[6][4] + 5 ;7th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(6)
   Case $icon_info[7][3] - 5 To $icon_info[7][4] + 5 ;8th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(7)
   Case $icon_info[8][3] - 5 To $icon_info[8][4] + 5 ;9th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(8)
   Case $icon_info[9][3] - 5 To $icon_info[9][4] + 5 ;10th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(9)
   Case Else
    _shrink_all()
  EndSwitch
Else
  _shrink_all()
EndIf
If Round(TimerDiff($timer_end_txt)) >= 500 Then GUICtrlSetData($toolbar_display_txt, "") ;if mouse wasn't hovering above any icon for 0.5sec, display txt should vanish
If WinActive($stemp) Then WinActivate($Form1) ;if the child window with label "clear" inside of EDIT ctrl is active, then main window should activate and set as current
WEnd

Func _for_icon($number)
$timer_end_txt = TimerInit() ;timer for vanishing txt label that display txt of curent icon
If $icon_info[$number][2] = False Then ;prevent constant shrinking and enlarging
  GUICtrlSetData($toolbar_display_txt, $icon_info[$number][1]) ;set label txt to curent icon info
  GUICtrlSetColor(-1, 0x3399CC) ;blue
  If $moving = False Then ;if the slider isn't moving then it's OK to resize icons
   _shrink_all()
   _easy_rise($icons[$number], $icon_info[$number][3] - 2, 12, 37, 37) ;should enlarge selected icon
   $icon_info[$number][5] = True ;setting the curent icon as enlarged
  EndIf
  $icon_info[$number][2] = True ;setting the curent icon as selected
EndIf
If _IsPressed(01) Then ;if mouse click is down on the selected icon
  If $icon_info[$number][5] = False Then
   _easy_rise($icons[$number], $icon_info[$number][3] - 2, 12, 37, 37)
   $icon_info[$number][5] = True
  EndIf
  Do
  Until Not _IsPressed(01) ;waiting for mouse key to release (like on regular buttons)
  Local $c = GUIGetCursorInfo($Form1)
  Local $x_coord = $c[0]
  Local $y_coord = $c[1]
  If $x_coord > $icon_info[$number][3] - 5 And $x_coord < $icon_info[$number][4] + 5 And $y_coord < 42 And $y_coord > 0 And WinActive($Form1) Then ;if the mouse click is released while cursor was still on that icon and while GUI is active...
   Switch $number
    Case 0
     ;func for icon 1
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $blackboard & " - " & $icon_info[0][1] & " Selected!   (<a href='https://www.tulsatech.blackboard.com' class='bbc_url' title='External link' rel='external'>https://www.tulsatech.blackboard.com</a>) ") ;edit this, and set any function you want to be called when you hit 1st icon
    Case 1
     ;func for icon 2
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $brainben & " - " & $icon_info[1][1] & " Selected!   (<a href='https://dpt.okcareertech.org/pfccsecu/bb.student.login.dptw' class='bbc_url' title='External link' rel='external'>https://dpt.okcareertech.org/pfccsecu/bb.student.login.dptw</a>) ")
    Case 2
     ;func for icon 3
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $outlook & " - " & $icon_info[2][1] & " Selected!   (<a href='https://webaccess.tulsatech.org' class='bbc_url' title='External link' rel='external'>https://webaccess.tulsatech.org</a>)")
    Case 3
     ;func for icon 4
     $o = _IECreate("<a href='http://www.w3schools.com/' class='bbc_url' title='External link' rel='external'>http://www.w3schools.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $w3schools & " - " & $icon_info[3][1] & " Selected!   (<a href='http://www.w3schools.com' class='bbc_url' title='External link' rel='external'>http://www.w3schools.com</a>) ")
    Case 4
     ;func for icon 5
     $o = _IECreate("<a href='http://quackit.com/' class='bbc_url' title='External link' rel='external'>http://quackit.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $quackit & " - " & $icon_info[4][1] & " Selected!   (<a href='http://www.quackit.com' class='bbc_url' title='External link' rel='external'>http://www.quackit.com</a>) ")
    Case 5
     ;func for icon 6
     $o = _IECreate("<a href='http://www.echoecho.com/' class='bbc_url' title='External link' rel='external'>http://www.echoecho.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $echoecho & " - " & $icon_info[5][1] & " Selected!   (<a href='http://www.echoecho.com' class='bbc_url' title='External link' rel='external'>http://www.echoecho.com</a>) ")
    Case 6
     ;func for icon 7
     $o = _IECreate("<a href='http://www.tulsatech.com/' class='bbc_url' title='External link' rel='external'>http://www.tulsatech.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $tulsatech & " - " & $icon_info[6][1] & " Selected!   (<a href='http://www.tulsatech.com/default.aspx' class='bbc_url' title='External link' rel='external'>http://www.tulsatech.com/default.aspx</a>) ")
    Case 7
     ;func for icon 8
     $o = _IECreate("<a href='http://www.google.com/' class='bbc_url' title='External link' rel='external'>http://www.google.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $google & " - " & $icon_info[7][1] & " Selected!   (<a href='http://www.google.com' class='bbc_url' title='External link' rel='external'>http://www.google.com</a>) ")
    Case 8
     ;func for icon 9
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $yahoo & " - " & $icon_info[8][1] & " Selected!   (<a href='http://mail.yahoo.com/' class='bbc_url' title='External link' rel='external'>http://mail.yahoo.com/</a>) ")
    Case 9
     ;func for icon 10
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $gmail & " - " & $icon_info[9][1] & " Selected!   (<a href='https://www.google.com/accounts/ManageAccount' class='bbc_url' title='External link' rel='external'>https://www.google.com/accounts/ManageAccount</a>) ")
   EndSwitch
  EndIf
EndIf
EndFunc   ;==>_for_icon

Func _shrink_all()
For $i = 0 To 9
  If $icon_info[$i][2] = True Then ;if icon is selected
   If $icon_info[$i][5] = True Then ;if icon is enlarged
    _easy_shrink($icons[$i], $icon_info[$i][3], 15, 32, 32)
    $icon_info[$i][5] = False
   EndIf
   $icon_info[$i][2] = False
  EndIf
Next
EndFunc   ;==>_shrink_all

Func _easy_rise($immmmage, $iX, $iY, $iW, $iH, $maxxx = 6, $step = 1) ;image to be resized, x-coord of the image, y-coord of the image, width of the image, height of the image, max enlargement, speed of enlargement
For $i = 1 To $maxxx Step $step
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX - $i, $iY - $i, $iW + 2 * $i, $iH + 2 * $i) ;enlarging icon
  Sleep(1) ;making it smooth
Next
EndFunc   ;==>_easy_rise

Func _easy_shrink($immmmage, $iX, $iY, $iW, $iH, $maxxx = 6, $step = 1)
Local $cntr = 0
For $i = $maxxx To 1 Step -$step
  _GDIPlus_GraphicsDrawRect($hGraphic, $iX - $i - 5, $iY - $i - 5, $iW + 2 * $i + 10, $iH + 2 * $i + 10, $hPen)
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX - $i, $iY - $i, $iW + 2 * $i, $iH + 2 * $i) ;shrinking icon

  $cntr = $i
  Sleep(1)
Next
If $iW + 2 * $cntr <> $iW Or $iH + 2 * $cntr <> $iH Then ;if shrinking didn't went to the exact size it was supposed to, this will make it regular size again
  _GDIPlus_GraphicsDrawRect($hGraphic, $iX - 5, $iY - 5, $iW + 10, $iH + 10, $hPen)
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX, $iY, $iW, $iH) ;drawing icon @ it's original size

EndIf
EndFunc   ;==>_easy_shrink

Func _extract_icons()
Local $hIcon, $hBitmap1, $hBitmap2, $hGraphic, $hBmp1
$hBmp1 = _WinAPI_CreateBitmap(48, 48, 1, 32) ;create a blank bitmap
For $i = 0 To 9
  $hIcon = _WinAPI_PrivateExtractIcon($shell32, (-1 * $icon_info[$i][0]) - 1, 48, 48) ;extract the icon I used 48x48, this way the icon looks a touch clearer when moused over
  $hBitmap1 = _GDIPlus_BitmapCreateFromHICON($hIcon) ;create bitmap from icon's handle
  _WinAPI_DestroyIcon($hIcon) ;destroy the icon
  $hBitmap2 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp1) ;create a compatible GDI+ bitmap from the blank bitmap
  $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap2) ;Get context of compatible GDI+ bitmap
  _GDIPlus_GraphicsClear($hGraphic, 0xFF000000);set the back color to black
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap1, 0, 0, 48, 48);draw the bitmap icon on the compatible black GDI+ bitmap
  _GDIPlus_GraphicsDispose($hGraphic) ;dispose of the context.
  _GDIPlus_BitmapDispose($hBitmap1) ;dispose of the icon bitmap
  $icons[$i] = $hBitmap2 ;use the new black background icon bitmap
Next
_WinAPI_DeleteObject($hBmp1) ;delete the blank bitmap
EndFunc   ;==>_extract_icons

Func _set_icon_info()
;icon value:
$icon_info[0][0] = "-175"; = blackboard
$icon_info[1][0] = "-171"; = brainbench
$icon_info[2][0] = "-157"; = outlook
$icon_info[3][0] = "-14"; = w3schools
$icon_info[4][0] = "-221"; = quackit
$icon_info[5][0] = "-15"; = echoecho
$icon_info[6][0] = "-44"; = tulsatech
$icon_info[7][0] = "-222";= google
$icon_info[8][0] = "-168"; = yahoo
$icon_info[9][0] = "-149"; = gmail

;icon name:
$icon_info[0][1] = "Blackboard"; = blackboard
$icon_info[1][1] = "BrainBench"; = brainbench
$icon_info[2][1] = "Outlook"; = outlook
$icon_info[3][1] = "w3schools"; = w3schools
$icon_info[4][1] = "QuackIt"; = quackit
$icon_info[5][1] = "EchoEcho"; = echoecho
$icon_info[6][1] = "TulsaTech"; = tulsatech
$icon_info[7][1] = "Google";= google
$icon_info[8][1] = "Yahoo Mail"; = yahoo
$icon_info[9][1] = "Gmail"; = gmail

;icon hover:
$icon_info[0][2] = False; = blackboard
$icon_info[1][2] = False; = brainbench
$icon_info[2][2] = False; = outlook
$icon_info[3][2] = False; = w3schools
$icon_info[4][2] = False; = quackit
$icon_info[5][2] = False; = echoecho
$icon_info[6][2] = False; = tulsatech
$icon_info[7][2] = False;= google
$icon_info[8][2] = False; = yahoo
$icon_info[9][2] = False; = gmail

;icon enlarged:
$icon_info[0][5] = False; = blackboard
$icon_info[1][5] = False; = brainbench
$icon_info[2][5] = False; = outlook
$icon_info[3][5] = False; = w3schools
$icon_info[4][5] = False; = quackit
$icon_info[5][2] = False; = echoecho
$icon_info[5][5] = False; = echoecho
$icon_info[6][5] = False; = tulsatech
$icon_info[7][5] = False;= google
$icon_info[8][5] = False; = yahoo
$icon_info[9][5] = False; = gmail

;icon start/end coordinate x:
Local $x_x = 0
For $i = 0 To 9
  $x_x += 25
  $icon_info[$i][3] = $x_x ; = start X coordinate
  $x_x += 32
  $icon_info[$i][4] = $x_x ; = end X coordinate
Next
EndFunc   ;==>_set_icon_info

Func endscript() ;clearing resources @ the and of the script
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
For $i = 0 To 9
  _GDIPlus_ImageDispose($icons[$i])
Next
_GDIPlus_Shutdown()
EndFunc   ;==>endscript

Func _GDIPlus_BitmapCreateFromHICON($hIcon)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromHICON", "ptr", $hIcon, "int*", 0)
If @error Then Return SetError(@error, 0, -1)
Return SetError($aResult[0], 0, $aResult[2])
EndFunc   ;==>_GDIPlus_BitmapCreateFromHICON

Func _WinAPI_PrivateExtractIcon($sFile, $iIndex = 0, $iW = 0, $iH = 0, $iFlags = 0)
Local $aResult, $tHICON, $pHICON
$tHICON = DllStructCreate("hwnd[1]")
$pHICON = DllStructGetPtr($tHICON)
$aResult = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sFile, 'int', $iIndex, 'int', $iW, 'int', $iH, 'ptr', $pHICON, 'ptr', 0, 'int', 1, 'int', $iFlags)
If @error Then Return SetError(@error, 0, -1)
If $aResult[0] = 0xFFFFFFFF Then Return SetError(4, 0, -1)
Return DllStructGetData($tHICON, 1, 1)
EndFunc   ;==>_WinAPI_PrivateExtractIcon

; Functions
Func ShowInfo()
MsgBox(0, "Site Navigator v1.0", "This navagator was desinged to make it easier for a student to get to many of the main resource sites he uses throught is school year.")
EndFunc   ;==>ShowInfo

Share this post


Link to post
Share on other sites



this is a rough hack, but it seem to do the trick for me.. if you'd like i can attempt to create the auto login process for you.

to start, here is the source for the tulsa website:

<FORM onsubmit="return validate_form(this)" METHOD="POST" ACTION="http://tulsatech.blackboard.com/webapps/login/" NAME="login" >

<TD>

<FONT SIZE="1" FACE="Arial, Helvetica, sans-serif">

<label for="user_id">Username:</label>

</FONT>

<BR>

<INPUT TYPE="text" NAME="user_id" ID="user_id" SIZE=25 MAXLENGTH=50 tabindex="1">

</TD>

</TR>

<TR>

<TD>

<FONT SIZE="1" FACE="Arial, Helvetica, sans-serif">

<label for="password">Password:</label>

</FONT>

<BR>

<INPUT SIZE="25" NAME="password" id="password" TYPE="password" tabindex="2">

</TD>

if you look at the username field, the name is user_id and the password fields name is password and above that the name of the form is login with that being said we can now create the follow code for the autologin

$oForm = _IEFormGetObjByName($oIE, 'login')

$oElement = _IEFormElementGetObjByName($oForm, 'user_id')

$oElement1 = _IEFormElementGetObjByName($oForm, 'password')

_IEFormElementSetValue($oElement, $UN)

_IEFormElementSetValue($oElement1, $PW)

_IEFormSubmit($oForm, 0)

_IELoadWait($oIE)

just make sure you create your $oIE object using _iecreate or however you wish to do it

and here is the edited code I hope this is what you want i have looked over these boards for months now and i thought this would be a nice way to give back to the community so enjoy :-)

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GDIPlus.au3>
#include <Misc.au3>
#include <GuiEdit.au3>
#include <ButtonConstants.au3>
#include <IE.au3>
#include <EditConstants.au3>
#include <WindowsConstants.au3>
#include <STATICCONSTANTS.AU3>
#include <EDITCONSTANTS.AU3>
#include <MISC.AU3>
#include <WinAPI.au3>

_GDIPlus_Startup()


;Opt("OnExitFunc", "endscript") ;func @ exiting script
TrayTip("Site Navigator", "Edited By: Kevin Christensen", 1, 1)

Dim $icons[10] ;number of icons used
Dim $icon_info[10][6] ;number of icons used and their information
Global $shell32 = @SystemDir & "\shell32.dll" ;shell32.dll location, the file for icon extraction
Global $cur_first = 0, $cur_last = 9, $moving = False, $timer_10, $hGraphic, $timer_end_txt, $inside = False ;some global variables
Global $hPen = _GDIPlus_PenCreate(0xFF000000, 10) ;Used as a 10p black boarder around each icon when sizing or moving.
Global $blackboard = 0, $brainben = 1, $outlook = 2, $w3schools = 3, $quackit = 4, $echoecho = 5, $tulsatech = 6, $google = 7, $yahoo = 8, $gmail = 9
Global $selected = 0

$timer_10 = TimerInit() ;this timer is limiting sliding to max speed of 10ms/px
$timer_end_txt = TimerInit() ;this timer is used for toolbar label to vanish (check While 1 section)
_set_icon_info() ;setting icons info, check the function for detail info

$Form1 = GUICreate("Site Navigator", 253, 310) ;gui creation
GUISetBkColor(0) ;gui black background color
GUICtrlCreateGroup("Login Panel", 12, 205, 230, 98, $WS_SYSMENU)
$usernamelabel = GUICtrlCreateLabel("Username:", 20, 221, 52, 17)
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
$passwordlabel = GUICtrlCreateLabel("Password:", 20, 251, 50, 17)
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
$user = GUICtrlCreateInput("", 76, 220, 160, 21)
$pass = GUICtrlCreateInput("", 76, 250, 160, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL))
$connect = GUICtrlCreateButton("Connect", 90, 277, 70, 20, $BS_DEFPUSHBUTTON)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
$reset = GUICtrlCreateButton("Reset", 165, 277, 60, 20)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
$hLabel = GUICtrlGetHandle(GUICtrlCreateLabel("", 0, 0, 253, 56)) ;used this to draw the icons on, saves resizing the pen width when drawing the boarder, otherwise the boarder goes over the $toolbar_display_txt
GUICtrlCreateGroup("", 12, 71, 229, 130) ;group around edit
$Edit1 = GUICtrlCreateEdit("              -!- Site Navigator v1.0 -!-                 ", 15, 79, 223, 120, $WS_VSCROLL + 0x0040 + 0x0004 + 0x1000) ;edit control to display icons clicking
GUICtrlSetBkColor(-1, 0x333333) ;gray background of edit ctrl
GUICtrlSetColor(-1, 0xFFFFFF) ;white letters inside of edit ctrl
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group
$toolbar_display_txt = GUICtrlCreateLabel("", 10, 49 + 7, 233, 17, 0x01) ;label to display curent selected toolbar icon with "CENTER" style = 0x01
GUICtrlSetColor(-1, 0xFFFFFF) ;above label color is white
GUICtrlSetFont(-1, 12, 800, 2, "Arial") ;above label's font = arial, 800=bold
WinSetTrans($Form1, "", 255) ;setting transp to 255 (max) will make GDI always visible (without disappearing when moved on the edge of the desktop, or when overlaped by another window
;note - must be before declaring graphic GDI in order for this to work
$hGraphic = _GDIPlus_GraphicsCreateFromHWND($hLabel) ;creating graphic for drawing toolbar icons
_extract_icons() ;extracting icons from shell32.dll, check func for detail info
GUISetState(@SW_SHOW, $Form1) ;display main GUI

$stemp = GUICreate("", 30, 14, 185, 209, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x333333) ;background color is the same as EDIT in main window
$clear_label = GUICtrlCreateLabel("Clear", 0, 0, 30, 14, 0x01) ;clear label with "CENTER" style = 0x01
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp) ;display clear label inside of edit control

$stemp2 = GUICreate("                  -/- Site Navigator v1.0 -\-                 Click on an icon shortcut to execute.         *If icon is a link with a sign in, please sign in below then hit connect*                                                                                     --Thanks, Kevin Christensen -----------------------------------------------------------------", 30, 14, 155, 209, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp2, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x333333) ;background color is the same as EDIT in main window
$clear_label2 = GUICtrlCreateLabel("Help", 0, 0, 30, 14, 0x01) ;clear label with "CENTER" style = 0x01
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp2) ;display clear label inside of edit control

$stemp3 = GUICreate("                       -/- Credits -\-                                  *Special Thanks to Sandin*               *Scripter: Kevin Christensen (DarkFalz)", 45, 14, 13, 310, BitOR($WS_POPUP, $WS_CHILD), $WS_EX_MDICHILD, $Form1) ;just another trick-window to make CLEAR label inside of main window's EDIT, pretty neat ;)
WinSetTrans($stemp3, "", 255) ;setting trans to 255 to clear bugs when moving main window
GUISetBkColor(0x000000) ;background color is the same as EDIT in main window
$connect_label2 = GUICtrlCreateLabel("Credits", 0, 0, 45, 14, 0x01)
GUICtrlSetColor(-1, 0x3399CC) ;blue
GUICtrlSetCursor(-1, 0) ;"finger" cursor on this label above
GUICtrlSetFont(-1, 8, 400, -1, "Arial") ;arial font for edit ctrl
GUISetState(@SW_SHOW, $stemp3) ;display clear label inside of edit control

For $i = 0 To 4
_GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32) ;drawing first 4 icons into GDI (window)
Next
Global $number
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
  Case $clear_label ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "              -!- Site Navigator v1.0 -!-                 ")
  Case $connect_label2 ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "------------------------!- Credits -!-----------------------               -!-Site Navigator v1.0 -!-                          *Special Thanks to Sandin*               *Editer: Kevin Christensen (DarkFalz)*        *Scripting Language - AutoItScript*          *Release Date: September 2nd 2009*    ----------------------------------------------------------------")
  Case $clear_label2 ;edit label in the "trick" child-window inside of EDIT control
   GUICtrlSetData($Edit1, "              -!- Site Navigator v1.0 -!-              Click on an icon shortcut to execute.         *If icon is a link with a sign in, please sign in below then hit connect*                                                                                     --Thanks, Kevin Christensen -----------------------------------------------------------------")
  Case $connect 
      
If $selected = 1 Then
msgbox(0,"Blackboard!","code here")
$selected = 0
    
;autologin code here!   
    
EndIf

If $selected = 2 Then
msgbox(0,"BrainBench!","code here")
$selected = 0

;autologin code here!

EndIf
    
        
;*This onyl works for one site, i need it for multiple!!!*
;  $o = _IECreate("<a href='http://tulsatech.blackboard.com/webapps/login/' class='bbc_url' title='External link' rel='external'>http://tulsatech.blackboard.com/webapps/login/</a>")
;  _IELoadWait($o)
; Sleep(200)
; Send(GUICtrlRead($user));Username
; Sleep(100)
; Send("{TAB}")
; Sleep(100)
; Send(GUICtrlRead($pass));Password
; Sleep(100)
; Send("{ENTER}")


  Case $reset
   GUICtrlSetData($user, "")
   GUICtrlSetData($pass, "")
EndSwitch

Local $c = GUIGetCursorInfo($Form1) ;get mouse location inside of GUI
Local $x_coord = $c[0] ;mouse x coordinate inside of GUI
Local $y_coord = $c[1] ;mouse y coordinate isnide of GUI
If $y_coord < 52 And $y_coord > 0 And WinActive($Form1) Then ;top and bottom coordinate of toolbar
  If TimerDiff($timer_10) >= 10 Then ;sliding is chaotic if there is no speed limitation, 10ms in this case is just enough
   $timer_10 = TimerInit()
   Switch $x_coord
    Case - 100 To 41 ;left corner - moving icons to the right
     $inside = True ;is mouse inside of sliding area? yes!
     _shrink_all() ;if there is any icon that is enlarged, it'll be decreased
     $moving = True ;is slider mooving? yes!
     Local $speed
     Local $x_coord1 = $x_coord
     If $x_coord1 < 0 Then
      $x_coord1 = 0 ;if this isn't limited to 0 then the speed would continue to increase if the mouse is outside (but near) window
     EndIf
     $speed = Int(((41 - $x_coord1) / 15) ^ 2) ;acceleration and speed of sliding icons is increased parabolical, and not linear, that's why ^2
     If $speed < 1 Then $speed = 1 ;min speed should be 1px
     For $i = 0 To 9
      $icon_info[$i][3] += $speed ;changing x starting coordinate for each icon
      $icon_info[$i][4] += $speed ;changing x starting coordinate for each icon

      If Int($icon_info[$cur_first][3]) >= 25 Then ;this is where last icon become first
       Local $previous = $cur_first
       $cur_first -= 1
       If $cur_first < 0 Then $cur_first = 9
       $icon_info[$cur_first][3] = Int($icon_info[$previous][3]) - 57
       $icon_info[$cur_first][4] = Int($icon_info[$previous][4]) - 57
      EndIf

      If $icon_info[$i][3] < 253 + 25 Then ;icons that aren't visible shouldn't move at all (and thus save pc resources)
       Local $width_x = 10
       _GDIPlus_GraphicsDrawRect($hGraphic, $icon_info[$i][3] - 5, 15 - 5, 32 + 10, 32 + 10, $hPen) ;boarder bigger then icon
       _GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32);icon image
      EndIf
     Next
    Case 212 To 253 + 100 ;right corner - moving to the left
     $inside = True
     _shrink_all()
     $moving = True
     Local $speed
     Local $x_coord1 = $x_coord
     If $x_coord1 > 253 Then
      $x_coord1 = 253
     EndIf
     $speed = Int((($x_coord1 - 212) / 15) ^ 2)
     If $speed < 1 Then $speed = 1
     For $i = 0 To 9
      $icon_info[$i][3] -= $speed
      $icon_info[$i][4] -= $speed

      If Int($icon_info[$cur_last][3]) <= 228 Then ;this is where first icon become last
       Local $previous = $cur_last
       $cur_last += 1
       If $cur_last > 9 Then $cur_last = 0
       $icon_info[$cur_last][3] = Int($icon_info[$previous][3]) + 57
       $icon_info[$cur_last][4] = Int($icon_info[$previous][4]) + 57

      EndIf

      If $icon_info[$i][4] + 25 > 0 Then
       Local $width_x = 10
       _GDIPlus_GraphicsDrawRect($hGraphic, $icon_info[$i][3] - 5, 15 - 5, 32 + 10, 32 + 10, $hPen) ;boarder bigger then icon
       _GDIPlus_GraphicsDrawImageRect($hGraphic, $icons[$i], $icon_info[$i][3], 15, 32, 32) ;icon image
      EndIf
     Next
    Case Else
     $moving = False
     If $inside = True Then
      $inside = False
      Local $founded = 10
      For $i = 0 To 9
       If $icon_info[$i][2] = True Then
        $founded = $i
        ExitLoop
       EndIf
      Next
      If $founded <> 10 Then
       If $icon_info[$founded][5] = False Then
        _easy_rise($icons[$founded], $icon_info[$founded][3] - 2, 12, 37, 37)
        $icon_info[$founded][5] = True
       EndIf
      EndIf
     EndIf
   EndSwitch
  EndIf
  Switch $x_coord
   Case $icon_info[0][3] - 5 To $icon_info[0][4] + 5 ;1st icon, mouse is hovering above 1st icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(0)
   Case $icon_info[1][3] - 5 To $icon_info[1][4] + 5 ;2nd icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(1)
   Case $icon_info[2][3] - 5 To $icon_info[2][4] + 5 ;3rd icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(2)
   Case $icon_info[3][3] - 5 To $icon_info[3][4] + 5 ;4th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(3)
   Case $icon_info[4][3] - 5 To $icon_info[4][4] + 5 ;5th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(4)
   Case $icon_info[5][3] - 5 To $icon_info[5][4] + 5 ;6th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(5)
   Case $icon_info[6][3] - 5 To $icon_info[6][4] + 5 ;7th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(6)
   Case $icon_info[7][3] - 5 To $icon_info[7][4] + 5 ;8th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(7)
   Case $icon_info[8][3] - 5 To $icon_info[8][4] + 5 ;9th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(8)
   Case $icon_info[9][3] - 5 To $icon_info[9][4] + 5 ;10th icon
    If $x_coord >= 0 And $x_coord <= 253 Then _for_icon(9)
   Case Else
    _shrink_all()
  EndSwitch
Else
  _shrink_all()
EndIf
If Round(TimerDiff($timer_end_txt)) >= 500 Then GUICtrlSetData($toolbar_display_txt, "") ;if mouse wasn't hovering above any icon for 0.5sec, display txt should vanish
If WinActive($stemp) Then WinActivate($Form1) ;if the child window with label "clear" inside of EDIT ctrl is active, then main window should activate and set as current
WEnd

Func _for_icon($number)
$timer_end_txt = TimerInit() ;timer for vanishing txt label that display txt of curent icon
If $icon_info[$number][2] = False Then ;prevent constant shrinking and enlarging
  GUICtrlSetData($toolbar_display_txt, $icon_info[$number][1]) ;set label txt to curent icon info
  GUICtrlSetColor(-1, 0x3399CC) ;blue
  If $moving = False Then ;if the slider isn't moving then it's OK to resize icons
   _shrink_all()
   _easy_rise($icons[$number], $icon_info[$number][3] - 2, 12, 37, 37) ;should enlarge selected icon
   $icon_info[$number][5] = True ;setting the curent icon as enlarged
  EndIf
  $icon_info[$number][2] = True ;setting the curent icon as selected
EndIf
If _IsPressed(01) Then ;if mouse click is down on the selected icon
  If $icon_info[$number][5] = False Then
   _easy_rise($icons[$number], $icon_info[$number][3] - 2, 12, 37, 37)
   $icon_info[$number][5] = True
  EndIf
  Do
  Until Not _IsPressed(01) ;waiting for mouse key to release (like on regular buttons)
  Local $c = GUIGetCursorInfo($Form1)
  Local $x_coord = $c[0]
  Local $y_coord = $c[1]
  If $x_coord > $icon_info[$number][3] - 5 And $x_coord < $icon_info[$number][4] + 5 And $y_coord < 42 And $y_coord > 0 And WinActive($Form1) Then ;if the mouse click is released while cursor was still on that icon and while GUI is active...
   Switch $number
    Case 0
     ;func for icon 1
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $blackboard & " - " & $icon_info[0][1] & " Selected!   (<a href='https://www.tulsatech.blackboard.com' class='bbc_url' title='External link' rel='external'>https://www.tulsatech.blackboard.com</a>) ") ;edit this, and set any function you want to be called when you hit 1st icon
    $selected = 1
    Case 1
     ;func for icon 2
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $brainben & " - " & $icon_info[1][1] & " Selected!   (<a href='https://dpt.okcareertech.org/pfccsecu/bb.student.login.dptw' class='bbc_url' title='External link' rel='external'>https://dpt.okcareertech.org/pfccsecu/bb.student.login.dptw</a>) ")
    $selected = 2 
    Case 2
     ;func for icon 3
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $outlook & " - " & $icon_info[2][1] & " Selected!   (<a href='https://webaccess.tulsatech.org' class='bbc_url' title='External link' rel='external'>https://webaccess.tulsatech.org</a>)")
    Case 3
     ;func for icon 4
     $o = _IECreate("<a href='http://www.w3schools.com/' class='bbc_url' title='External link' rel='external'>http://www.w3schools.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $w3schools & " - " & $icon_info[3][1] & " Selected!   (<a href='http://www.w3schools.com' class='bbc_url' title='External link' rel='external'>http://www.w3schools.com</a>) ")
    Case 4
     ;func for icon 5
     $o = _IECreate("<a href='http://quackit.com/' class='bbc_url' title='External link' rel='external'>http://quackit.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $quackit & " - " & $icon_info[4][1] & " Selected!   (<a href='http://www.quackit.com' class='bbc_url' title='External link' rel='external'>http://www.quackit.com</a>) ")
    Case 5
     ;func for icon 6
     $o = _IECreate("<a href='http://www.echoecho.com/' class='bbc_url' title='External link' rel='external'>http://www.echoecho.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $echoecho & " - " & $icon_info[5][1] & " Selected!   (<a href='http://www.echoecho.com' class='bbc_url' title='External link' rel='external'>http://www.echoecho.com</a>) ")
    Case 6
     ;func for icon 7
     $o = _IECreate("<a href='http://www.tulsatech.com/' class='bbc_url' title='External link' rel='external'>http://www.tulsatech.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $tulsatech & " - " & $icon_info[6][1] & " Selected!   (<a href='http://www.tulsatech.com/default.aspx' class='bbc_url' title='External link' rel='external'>http://www.tulsatech.com/default.aspx</a>) ")
    Case 7
     ;func for icon 8
     $o = _IECreate("<a href='http://www.google.com/' class='bbc_url' title='External link' rel='external'>http://www.google.com/</a>")
     _IELoadWait($o)
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $google & " - " & $icon_info[7][1] & " Selected!   (<a href='http://www.google.com' class='bbc_url' title='External link' rel='external'>http://www.google.com</a>) ")
    Case 8
     ;func for icon 9
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $yahoo & " - " & $icon_info[8][1] & " Selected!   (<a href='http://mail.yahoo.com/' class='bbc_url' title='External link' rel='external'>http://mail.yahoo.com/</a>) ")
    Case 9
     ;func for icon 10
     _GUICtrlEdit_AppendText($Edit1, @CRLF & $gmail & " - " & $icon_info[9][1] & " Selected!   (<a href='https://www.google.com/accounts/ManageAccount' class='bbc_url' title='External link' rel='external'>https://www.google.com/accounts/ManageAccount</a>) ")
   EndSwitch
  EndIf
EndIf
EndFunc   ;==>_for_icon

Func _shrink_all()
For $i = 0 To 9
  If $icon_info[$i][2] = True Then ;if icon is selected
   If $icon_info[$i][5] = True Then ;if icon is enlarged
    _easy_shrink($icons[$i], $icon_info[$i][3], 15, 32, 32)
    $icon_info[$i][5] = False
   EndIf
   $icon_info[$i][2] = False
  EndIf
Next
EndFunc   ;==>_shrink_all

Func _easy_rise($immmmage, $iX, $iY, $iW, $iH, $maxxx = 6, $step = 1) ;image to be resized, x-coord of the image, y-coord of the image, width of the image, height of the image, max enlargement, speed of enlargement
For $i = 1 To $maxxx Step $step
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX - $i, $iY - $i, $iW + 2 * $i, $iH + 2 * $i) ;enlarging icon
  Sleep(1) ;making it smooth
Next
EndFunc   ;==>_easy_rise

Func _easy_shrink($immmmage, $iX, $iY, $iW, $iH, $maxxx = 6, $step = 1)
Local $cntr = 0
For $i = $maxxx To 1 Step -$step
  _GDIPlus_GraphicsDrawRect($hGraphic, $iX - $i - 5, $iY - $i - 5, $iW + 2 * $i + 10, $iH + 2 * $i + 10, $hPen)
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX - $i, $iY - $i, $iW + 2 * $i, $iH + 2 * $i) ;shrinking icon

  $cntr = $i
  Sleep(1)
Next
If $iW + 2 * $cntr <> $iW Or $iH + 2 * $cntr <> $iH Then ;if shrinking didn't went to the exact size it was supposed to, this will make it regular size again
  _GDIPlus_GraphicsDrawRect($hGraphic, $iX - 5, $iY - 5, $iW + 10, $iH + 10, $hPen)
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $immmmage, $iX, $iY, $iW, $iH) ;drawing icon @ it's original size

EndIf
EndFunc   ;==>_easy_shrink

Func _extract_icons()
Local $hIcon, $hBitmap1, $hBitmap2, $hGraphic, $hBmp1
$hBmp1 = _WinAPI_CreateBitmap(48, 48, 1, 32) ;create a blank bitmap
For $i = 0 To 9
  $hIcon = _WinAPI_PrivateExtractIcon($shell32, (-1 * $icon_info[$i][0]) - 1, 48, 48) ;extract the icon I used 48x48, this way the icon looks a touch clearer when moused over
  $hBitmap1 = _GDIPlus_BitmapCreateFromHICON($hIcon) ;create bitmap from icon's handle
  _WinAPI_DestroyIcon($hIcon) ;destroy the icon
  $hBitmap2 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp1) ;create a compatible GDI+ bitmap from the blank bitmap
  $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap2) ;Get context of compatible GDI+ bitmap
  _GDIPlus_GraphicsClear($hGraphic, 0xFF000000);set the back color to black
  _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap1, 0, 0, 48, 48);draw the bitmap icon on the compatible black GDI+ bitmap
  _GDIPlus_GraphicsDispose($hGraphic) ;dispose of the context.
  _GDIPlus_BitmapDispose($hBitmap1) ;dispose of the icon bitmap
  $icons[$i] = $hBitmap2 ;use the new black background icon bitmap
Next
_WinAPI_DeleteObject($hBmp1) ;delete the blank bitmap
EndFunc   ;==>_extract_icons

Func _set_icon_info()
;icon value:
$icon_info[0][0] = "-175"; = blackboard
$icon_info[1][0] = "-171"; = brainbench
$icon_info[2][0] = "-157"; = outlook
$icon_info[3][0] = "-14"; = w3schools
$icon_info[4][0] = "-221"; = quackit
$icon_info[5][0] = "-15"; = echoecho
$icon_info[6][0] = "-44"; = tulsatech
$icon_info[7][0] = "-222";= google
$icon_info[8][0] = "-168"; = yahoo
$icon_info[9][0] = "-149"; = gmail

;icon name:
$icon_info[0][1] = "Blackboard"; = blackboard
$icon_info[1][1] = "BrainBench"; = brainbench
$icon_info[2][1] = "Outlook"; = outlook
$icon_info[3][1] = "w3schools"; = w3schools
$icon_info[4][1] = "QuackIt"; = quackit
$icon_info[5][1] = "EchoEcho"; = echoecho
$icon_info[6][1] = "TulsaTech"; = tulsatech
$icon_info[7][1] = "Google";= google
$icon_info[8][1] = "Yahoo Mail"; = yahoo
$icon_info[9][1] = "Gmail"; = gmail

;icon hover:
$icon_info[0][2] = False; = blackboard
$icon_info[1][2] = False; = brainbench
$icon_info[2][2] = False; = outlook
$icon_info[3][2] = False; = w3schools
$icon_info[4][2] = False; = quackit
$icon_info[5][2] = False; = echoecho
$icon_info[6][2] = False; = tulsatech
$icon_info[7][2] = False;= google
$icon_info[8][2] = False; = yahoo
$icon_info[9][2] = False; = gmail

;icon enlarged:
$icon_info[0][5] = False; = blackboard
$icon_info[1][5] = False; = brainbench
$icon_info[2][5] = False; = outlook
$icon_info[3][5] = False; = w3schools
$icon_info[4][5] = False; = quackit
$icon_info[5][2] = False; = echoecho
$icon_info[5][5] = False; = echoecho
$icon_info[6][5] = False; = tulsatech
$icon_info[7][5] = False;= google
$icon_info[8][5] = False; = yahoo
$icon_info[9][5] = False; = gmail

;icon start/end coordinate x:
Local $x_x = 0
For $i = 0 To 9
  $x_x += 25
  $icon_info[$i][3] = $x_x ; = start X coordinate
  $x_x += 32
  $icon_info[$i][4] = $x_x ; = end X coordinate
Next
EndFunc   ;==>_set_icon_info

Func endscript() ;clearing resources @ the and of the script
_GDIPlus_PenDispose($hPen)
_GDIPlus_GraphicsDispose($hGraphic)
For $i = 0 To 9
  _GDIPlus_ImageDispose($icons[$i])
Next
_GDIPlus_Shutdown()
EndFunc   ;==>endscript

Func _GDIPlus_BitmapCreateFromHICON($hIcon)
Local $aResult
$aResult = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromHICON", "ptr", $hIcon, "int*", 0)
If @error Then Return SetError(@error, 0, -1)
Return SetError($aResult[0], 0, $aResult[2])
EndFunc   ;==>_GDIPlus_BitmapCreateFromHICON

Func _WinAPI_PrivateExtractIcon($sFile, $iIndex = 0, $iW = 0, $iH = 0, $iFlags = 0)
Local $aResult, $tHICON, $pHICON
$tHICON = DllStructCreate("hwnd[1]")
$pHICON = DllStructGetPtr($tHICON)
$aResult = DllCall('user32.dll', 'int', 'PrivateExtractIcons', 'str', $sFile, 'int', $iIndex, 'int', $iW, 'int', $iH, 'ptr', $pHICON, 'ptr', 0, 'int', 1, 'int', $iFlags)
If @error Then Return SetError(@error, 0, -1)
If $aResult[0] = 0xFFFFFFFF Then Return SetError(4, 0, -1)
Return DllStructGetData($tHICON, 1, 1)
EndFunc   ;==>_WinAPI_PrivateExtractIcon

; Functions
Func ShowInfo()
MsgBox(0, "Site Navigator v1.0", "This navagator was desinged to make it easier for a student to get to many of the main resource sites he uses throught is school year.")
EndFunc   ;==>ShowInfo

Share this post


Link to post
Share on other sites

I have no idea how to edit a post, so.. i must also add that i added a variable that detects what you clicked at the top so when you hit your connect button it can tell between the two

Share this post


Link to post
Share on other sites

haha i was pretty close, i used diffrent variables like u did with selected=1 and so in, using diffrent if statments all in the $connect case, BUT :D i didnt set them back to 0. Thanks alot though for your reply, and your autologin using forms, ill be sure to check into that on an updated version of this =]

--DarkFalz

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