Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/29/2014 in all areas

  1. This script generates a calendar of 12 pages in pdf format (ready to be printed if you want) it include for each month also the previous and the next month on the same page. It makes use of the "MPDF_UDF.au3" udf by taietel from >this topic you must download that udf and save it in the same folder with this script. (it seems that the version modified by bdr529 from post #231 is more updated. I used that one with my script.) Happy new year ; Create a Calendar in pdf ; ; download the "MPDF_UDF.au3" udf from here: http://www.autoitscript.com/forum/topic/118827-create-pdf-from-your-application/?p=1158973 ; it is at the bottom of post #231. Download and save it in the same path of this script. #include "MPDF_UDF.au3" ; #include <date.au3> $sYear = "2015" ; <--- change the year if you need another $sMonths = "January,February,March,April,May,June,July,August,September,October,November,December" $sDaysOfWeek = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" ; --- just change above names to localize (following names are italian for example) --- ; $sMonths = "Gennaio,Febbraio,Marzo,Aprile,Maggio,Giugno,Luglio,Agosto,Settembre,Ottobre,Novembre,Dicembre" ; $sDaysOfWeek = "Lunedì,Martedì,Mercoledì,Giovedì,Venerdì,Sabato,Domenica" ; ------------------------------------------------------------------------------------- Local $aMonths = StringSplit($sMonths, ","), $aDaysOfWeek = StringSplit($sDaysOfWeek, ",") Local $aPreviousMonth, $aNextMonth, $iDayOfWeek, $aColors[2] = ["0x000000", "0xFF0000"], $aDummy ; ;set the properties for the pdf _SetTitle("Calendar " & $sYear) _SetSubject("Calendar made with AutoIt (www.autoitscript.com)") _SetKeywords("calendar, pdf") _OpenAfter(True);open after generation _SetUnit($PDF_UNIT_CM) _SetPaperSize("A4") _SetZoomMode($PDF_ZOOM_FULLPAGE) _SetOrientation($PDF_ORIENTATION_PORTRAIT) _SetLayoutMode($PDF_LAYOUT_CONTINOUS) ;initialize the pdf _InitPDF(@ScriptDir & "\Calendar_" & $sYear & ".pdf") ;=== load used font(s) === _LoadFontTT("_TimesNR", $PDF_FONT_TIMES) _LoadFontTT("_TimesNRB", $PDF_FONT_TIMES, $PDF_FONT_BOLD) ; For $Month = 1 To 12 ; Generate 12 months _BeginPage() ; begin page ; --- create areas that will contains days ----------------------------------------------- _InsertTable(00.50, 00.50, 20.00, 28.50, 1, 1, 0xB0B0B0, 0xB0B0B0) ; background _InsertTable(00.80, 26.10, 19.40, 02.60, 1, 1, 0xFF0000, 0x000000, 0.03) ; main month title _InsertTable(00.80, 00.80, 02.70, 25.00, 1, 1, 0xFFFFFF, 0x000000, 0.03) ; previous month (the little on the left) _InsertTable(00.80, 25.01875, 02.70, 00.78125, 1, 1, 0xFF0000, 0x000000, 0.03) ; title of previous month _InsertTable(03.80, 00.80, 13.40, 25.00, 2, 16, 0xFFFFFF, 0x000000) ; this month _DrawLine(03.80, 00.80, 17.20, 00.80, "0X2", 0, 0.03, 0x000000, 0, 0) ; border of this month _DrawLine(17.20, 00.80, 17.20, 25.80, "0X2", 0, 0.03, 0x000000, 0, 0) _DrawLine(17.20, 25.80, 03.80, 25.80, "0X2", 0, 0.03, 0x000000, 0, 0) _DrawLine(03.80, 25.80, 03.80, 00.80, "0X2", 0, 0.03, 0x000000, 0, 0) _InsertTable(17.50, 00.80, 02.70, 25.00, 1, 1, 0xFFFFFF, 0x000000, 0.03) ; next month (the little on the right) _InsertTable(17.50, 25.01875, 02.70, 00.78125, 1, 1, 0xFF0000, 0x000000, 0.03) ; title of next month ; --- now fill the areas with the dates -------------------------------------------------- _InsertRenderedText(10.5, 27, StringUpper($aMonths[$Month]) & " " & $sYear, "_TimesNR", 50, 100, $PDF_ALIGN_CENTER, 0xffffff, 0xffffff) ; Main Month _DateTimeSplit(_DateAdd("M", -1, $sYear & "/" & $Month & "/1"), $aPreviousMonth, $aDummy) ; Previous Month _InsertRenderedText(2.15, 25.28, StringUpper($aMonths[$aPreviousMonth[2]]) & " " & $aPreviousMonth[1], "_TimesNRB", 8.5, 100, $PDF_ALIGN_CENTER, 0xffffff, 0xffffff) ; Previous Month _DateTimeSplit(_DateAdd("M", 1, $sYear & "/" & $Month & "/1"), $aNextMonth, $aDummy) ; Next Month _InsertRenderedText(18.85, 25.28, StringUpper($aMonths[$aNextMonth[2]]) & " " & $aNextMonth[1], "_TimesNRB", 8.5, 100, $PDF_ALIGN_CENTER, 0xffffff, 0xffffff) ; Next Month For $i = 1 To 31 If _DateIsValid($aPreviousMonth[1] & "/" & $aPreviousMonth[2] & "/" & $i) Then ; previous month $iDayOfWeek = _DateToDayOfWeekISO($aPreviousMonth[1], $aPreviousMonth[2], $i) _InsertRenderedText(01.80, 24.4 - 0.78125 * ($i - 1), $i, "_TimesNR", 12, 100, $PDF_ALIGN_RIGHT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) ; Previous Month's days _InsertRenderedText(02.00, 24.4 - 0.78125 * ($i - 1), StringLeft($aDaysOfWeek[$iDayOfWeek], 3), "_TimesNR", 10, 100, $PDF_ALIGN_LEFT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) EndIf If _DateIsValid($aNextMonth[1] & "/" & $aNextMonth[2] & "/" & $i) Then ; next month $iDayOfWeek = _DateToDayOfWeekISO($aNextMonth[1], $aNextMonth[2], $i) _InsertRenderedText(18.50, 24.4 - 0.78125 * ($i - 1), $i, "_TimesNR", 12, 100, $PDF_ALIGN_RIGHT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) ; Next Month's days _InsertRenderedText(18.70, 24.4 - 0.78125 * ($i - 1), StringLeft($aDaysOfWeek[$iDayOfWeek], 3), "_TimesNR", 10, 100, $PDF_ALIGN_LEFT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) EndIf If _DateIsValid($sYear & "/" & $Month & "/" & $i) Then ; main month $iDayOfWeek = _DateToDayOfWeekISO($sYear, $Month, $i) _InsertRenderedText(05.30 + (06.70 * Int($i / 17)), 26.30 - 1.5625 * ($i - (16 * Int($i / 17))), $i, "_TimesNRB", 24, 100, $PDF_ALIGN_RIGHT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) _InsertRenderedText(05.60 + (06.70 * Int($i / 17)), 26.30 - 1.5625 * ($i - (16 * Int($i / 17))), $aDaysOfWeek[$iDayOfWeek], "_TimesNR", 22, 100, $PDF_ALIGN_LEFT, $aColors[$iDayOfWeek = 7], $aColors[$iDayOfWeek = 7]) EndIf If $i < 31 Then ; separator line between days in previous and next month _DrawLine(01.00, 25 - 0.78125 * $i, 03.30, 25 - 0.78125 * $i, 2, 10, 0.02, 0x000000, 0, 0) _DrawLine(17.70, 25 - 0.78125 * $i, 20.00, 25 - 0.78125 * $i, 2, 10, 0.02, 0x000000, 0, 0) EndIf Next _EndPage() ; next month will be in a new page Next ; next month ;write the buffer to disk _ClosePDFFile() ; --- Functions --- Func _InsertTable($iX, $iY, $iW = 0, $iH = 0, $iCols = 0, $iRows = 0, $lFillColor = 0xFFFFFF, $lBorderColor = 0x000000, $fThickness = 0.01) Local $iPgW = Round(_GetPageWidth() / _GetUnit(), 1) Local $iPgH = Round(_GetPageHeight() / _GetUnit(), 1) If $iW = 0 Then $iW = $iPgW - $iX - 2 If $iH = 0 Then $iH = $iPgH - $iY - 2 Local $iColW = $iW / $iCols Local $iRowH = $iH / $iRows _SetColourStroke($lBorderColor) For $i = 0 To $iRows - 1 For $j = 0 To $iCols - 1 _Draw_Rectangle($iX + $j * $iColW, $iY + $iH - ($i + 1) * $iRowH, $iColW, $iRowH, $PDF_STYLE_STROKED, 0, $lFillColor, $fThickness) Next Next _SetColourStroke(0) EndFunc ;==>_InsertTable Func _Iif($fTest, $vTrueVal, $vFalseVal) If $fTest Then Return $vTrueVal Else Return $vFalseVal EndIf EndFunc ;==>_Iif edit: p.s. if you get this error: ERROR: _Iif() already defined. then just remove the _Iif() function from the bottom of this script this occurs with older AutoIt versions
    1 point
  2. The problem in overlapping controls. #include <StaticConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> Opt('MustDeclareVars', 1) f_toolbar() Func f_toolbar() Local $id_button_1_a, $id_button_2_a, $id_button_3_a Local $id_button_1_b, $id_button_2_b, $id_button_3_b Local $id_button_close Local $h_toolbar_gui, $msg_pop, $id_output_lbl ; -- Declare and set mouse over variables Local $last_tool_b_id = 0 ; ID of last button/icon visited Local $a_cursor_b_info ; GUIGetCursorInfo() array Local $win_w = 400 ; GUI width Local $win_h = 400 ; GUI height Local $icon_file = @SystemDir & "\shell32.dll" ; -- Create the GUI ------------------------------------------------------------------------------------------------------- $h_toolbar_gui = GUICreate("Toolbar hover - Test ...", $win_w, $win_h) ; -- A frame for the toolbar GUICtrlCreateLabel("", 3, 3, $win_w-3, 44, $SS_ETCHEDFRAME ) GUICtrlSetState(-1, $GUI_DISABLE) ; -- The Toolbar ; -- 1. Toolbar button ----------------------------------------------------------------------------------------------------- $id_button_1_a = GUICtrlCreateButton("1", 4, 4, 40, 40, $BS_ICON) ; Create BUTTON GUICtrlSetImage(-1, $icon_file, -71, 1) ; Add ICON to button GUICtrlSetState(-1, $GUI_HIDE) ; Hide ICON BUTTON again $id_button_1_b = GUICtrlCreateIcon($icon_file, -71, 4, 4, 40, 40, $BS_CENTER) ; Create ICON to display ; -- 2. Toolbar button ----------------------------------------------------------------------------------------------------- $id_button_2_a = GUICtrlCreateButton("2", 44, 4, 40, 40, $BS_ICON) ; Create BUTTON GUICtrlSetImage(-1, $icon_file, -5, 1) ; Add ICON to button GUICtrlSetState(-1, $GUI_HIDE) ; Hide ICON BUTTON again $id_button_2_b = GUICtrlCreateIcon($icon_file, -5, 44, 4, 40, 40, $BS_CENTER) ; Create ICON to display ; -- 3. Toolbar button ----------------------------------------------------------------------------------------------------- $id_button_3_a = GUICtrlCreateButton("3", 84, 4, 40, 40, $BS_ICON) GUICtrlSetImage(-1, $icon_file, -28, 1) ; Add ICON to button GUICtrlSetState(-1, $GUI_HIDE) ; Hide ICON BUTTON again $id_button_3_b = GUICtrlCreateIcon($icon_file, -28, 84, 4, 40, 40, $BS_CENTER) ; Create ICON to display ; -- Lable CTRL for feedback $id_output_lbl = GUICtrlCreateLabel("Move mouse over toolbar ...", 4, 100, $win_w-8, 16) ; Lable for feedback GUICtrlSetBkColor($id_output_lbl, 0xFFFFFF) ; -- The Close button $id_button_close = GUICtrlCreateButton("Close", $win_w/2-40, $win_h-40, 80, 24, $BS_DEFPUSHBUTTON) GUISetState(@SW_SHOW) While 1 $msg_pop = GUIGetMsg() Select Case $msg_pop = $GUI_EVENT_CLOSE ExitLoop Case $msg_pop = $id_button_close ExitLoop Case $msg_pop = $id_button_1_a Or $msg_pop = $id_button_1_b GUICtrlSetState($id_button_1_a, $GUI_SHOW) MsgBox(32, "DEBUG", "Button 1 pressed ...", 0, $h_toolbar_gui) Case $msg_pop = $id_button_2_a Or $msg_pop = $id_button_2_b GUICtrlSetState($id_button_2_a, $GUI_SHOW) MsgBox(32, "DEBUG", "Button 2 pressed ...", 0, $h_toolbar_gui) Case $msg_pop = $id_button_3_a Or $msg_pop = $id_button_3_b GUICtrlSetState($id_button_3_a, $GUI_SHOW) MsgBox(32, "DEBUG", "Button 3 pressed ...", 0, $h_toolbar_gui) Case Else $a_cursor_b_info = GUIGetCursorInfo($h_toolbar_gui) ; - $aArray[4] = ID of the control that the mouse cursor is hovering over (or 0 if none) Select ; -- Button 1 - Cursor ------------------------------------------------------------------------------------- Case $a_cursor_b_info[4] = $id_button_1_b And $last_tool_b_id = 0 ; MOUSE OVER GUICtrlSetState($id_button_1_a, $GUI_SHOW) GUICtrlSetState($id_button_1_b, $GUI_HIDE) GUICtrlSetData($id_output_lbl, "Mouse OVER - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0xFFFF00) _Swap($id_button_1_a, $id_button_1_b) $last_tool_b_id = $id_button_1_b ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- Case $a_cursor_b_info[4] <> $id_button_1_b And $last_tool_b_id = $id_button_1_b ; NO MOUSE OVER GUICtrlSetState($id_button_1_a, $GUI_SHOW) GUICtrlSetState($id_button_1_b, $GUI_HIDE) $a_cursor_b_info[4] = 0 GUICtrlSetData($id_output_lbl, "Mouse AWAY - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0x99CCFF) _Swap($id_button_1_a, $id_button_1_b) $last_tool_b_id = 0 ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- ; -- Button 2 - Cursor ------------------------------------------------------------------------------------- Case $a_cursor_b_info[4] = $id_button_2_b And $last_tool_b_id = 0 ; MOUSE OVER GUICtrlSetState($id_button_2_a, $GUI_SHOW) GUICtrlSetState($id_button_2_b, $GUI_HIDE) GUICtrlSetData($id_output_lbl, "Mouse OVER - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0xFFFF00) _Swap($id_button_2_a, $id_button_2_b) $last_tool_b_id = $id_button_2_b ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- Case $a_cursor_b_info[4] <> $id_button_2_b And $last_tool_b_id = $id_button_2_b ; NO MOUSE OVER GUICtrlSetState($id_button_2_a, $GUI_SHOW) GUICtrlSetState($id_button_2_b, $GUI_HIDE) $a_cursor_b_info[4] = 0 GUICtrlSetData($id_output_lbl, "Mouse AWAY - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0x99CCFF) _Swap($id_button_2_a, $id_button_2_b) $last_tool_b_id = 0 ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- ; -- Button 3 - Cursor ------------------------------------------------------------------------------------- Case $a_cursor_b_info[4] = $id_button_3_b And $last_tool_b_id = 0 ; MOUSE OVER GUICtrlSetState($id_button_3_a, $GUI_SHOW) GUICtrlSetState($id_button_3_b, $GUI_HIDE) GUICtrlSetData($id_output_lbl, "Mouse OVER - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0xFFFF00) _Swap($id_button_3_a, $id_button_3_b) $last_tool_b_id = $id_button_3_b ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- Case $a_cursor_b_info[4] <> $id_button_3_b And $last_tool_b_id = $id_button_3_b ; NO MOUSE OVER GUICtrlSetState($id_button_3_a, $GUI_SHOW) GUICtrlSetState($id_button_3_b, $GUI_HIDE) $a_cursor_b_info[4] = 0 GUICtrlSetData($id_output_lbl, "Mouse AWAY - Ctrl ID:" & @TAB & $a_cursor_b_info[4]) GUICtrlSetBkColor($id_output_lbl, 0x99CCFF) _Swap($id_button_3_a, $id_button_3_b) $last_tool_b_id = 0 ; -- DEBUG ----------------------------------------------------------------- ConsoleWrite("> ... " & "$last_tool_b_id - Ctrl ID:" & @TAB & $last_tool_b_id & @CRLF) ; -- DEBUG ----------------------------------------------------------------- EndSelect EndSelect WEnd GUIDelete() EndFunc ;==> f_toolbar() Func _Swap(ByRef $iNum1, ByRef $iNum2) Local $Temp = $iNum1 $iNum1 = $iNum2 $iNum2 = $Temp EndFunc ;==>_Swap Here is a complete example of using Toolbar control. #Include <GUIConstantsEx.au3> #Include <GUIImageList.au3> #Include <GUIToolbar.au3> #Include <StaticConstants.au3> #Include <ToolbarConstants.au3> #Include <WindowsConstants.au3> #Include <WinAPIEx.au3> $hForm = GUICreate('MyGUI', 332, 332) $hTool = GUICreate('', 332, 64, 0, 0, $WS_CHILD, 0, $hForm) $Dummy = GUICtrlCreateDummy() $hToolbar = _GUICtrlToolbar_Create($hTool, BitOR($BTNS_BUTTON, $BTNS_SHOWTEXT, $TBSTYLE_FLAT, $TBSTYLE_TOOLTIPS), $TBSTYLE_EX_DOUBLEBUFFER) $hImageList = _GUIImageList_Create(32, 32, 5, 1, 5) Dim $Icon[5] = [19, 205, 298, 300, 304] For $i = 0 To 4 $hIcon = _WinAPI_ShellExtractIcon(@SystemDir & '\shell32.dll', $Icon[$i], 32, 32) _GUIImageList_ReplaceIcon($hImageList, -1, $hIcon) _WinAPI_DestroyIcon($hIcon) Next _GUICtrlToolbar_SetImageList($hToolbar, $hImageList) _GUICtrlToolbar_AddString($hToolbar, 'Button 1') _GUICtrlToolbar_AddString($hToolbar, 'Button 2') _GUICtrlToolbar_AddString($hToolbar, 'Button 3') _GUICtrlToolbar_AddString($hToolbar, 'Button 4') _GUICtrlToolbar_AddString($hToolbar, 'Button 5') _GUICtrlToolbar_AddButton($hToolbar, 10000, 0, 0) _GUICtrlToolbar_AddButton($hToolbar, 10001, 1, 1) _GUICtrlToolbar_AddButtonSep($hToolbar, 5) _GUICtrlToolbar_AddButton($hToolbar, 10002, 2, 2) _GUICtrlToolbar_AddButton($hToolbar, 10003, 3, 3) _GUICtrlToolbar_AddButton($hToolbar, 10004, 4, 4) _GUICtrlToolbar_SetButtonSize($hToolbar, 64, 64) _GUICtrlToolbar_SetMetrics($hToolbar, 0, 0, 1, 0) _GUICtrlToolbar_SetIndent($hToolbar, 1) _SendMessage($hToolbar, $TB_AUTOSIZE) GUISwitch($hForm) ; Main GUI controls... GUICtrlCreateLabel('', 0, 64, 335, 2, $SS_ETCHEDHORZ) GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') GUIRegisterMsg($WM_NOTIFY, 'WM_NOTIFY') GUISetState(@SW_SHOWNOACTIVATE, $hTool) GUISetState(@SW_SHOW, $hForm) While 1 Switch GUIGetMsg() Case 0 ContinueLoop Case $GUI_EVENT_CLOSE ExitLoop Case $Dummy $ID = GUICtrlRead($Dummy) Switch $ID Case 10000 ; Button 1 MsgBox(64, 'Toolbar', 'Button 1 has been pressed!', 0, $hForm) Case 10001 ; Button 2 MsgBox(64, 'Toolbar', 'Button 2 has been pressed!', 0, $hForm) Case 10002 ; Button 3 MsgBox(64, 'Toolbar', 'Button 3 has been pressed!', 0, $hForm) Case 10003 ; Button 4 MsgBox(64, 'Toolbar', 'Button 4 has been pressed!', 0, $hForm) Case 10004 ; Button 5 MsgBox(64, 'Toolbar', 'Button 5 has been pressed!', 0, $hForm) Case Else EndSwitch EndSwitch WEnd Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $ID = BitAND($wParam, 0xFFFF) Switch $hWnd Case $hTool Switch $ID Case 10000 To 10004 ; Button 1 - Button 5 GUICtrlSendToDummy($Dummy, $ID) Case Else EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tNMIA = DllStructCreate($tagNMITEMACTIVATE, $lParam) Local $hTarget = DllStructGetData($tNMIA, 'hWndFrom') Local $ID = DllStructGetData($tNMIA, 'Code') Switch $hWnd Case $hTool Switch $hTarget Case $hToolbar Switch $ID Case $TBN_GETINFOTIPW ;~ Local $tNMTBGIT = DllStructCreate($tagNMTBGETINFOTIP, $lParam) Local $tNMTBGIT = DllStructCreate($tagNMHDR & ';ptr Text;int TextMax;int Item;lparam lParam;', $lParam) Local $Item = DllStructGetData($tNMTBGIT, 'Item') Local $Text = '' Switch $Item Case 10000 ; Button 1 $Text = 'Tooltip 1' Case 10001 ; Button 2 $Text = 'Tooltip 2' Case 10002 ; Button 3 $Text = 'Tooltip 3' Case 10003 ; Button 4 $Text = 'Tooltip 4' Case 10004 ; Button 5 $Text = 'Tooltip 5' Case Else EndSwitch If $Text Then DllStructSetData(DllStructCreate('wchar[' & DllStructGetData($tNMTBGIT, 'TextMax') & ']', DllStructGetData($tNMTBGIT, 'Text')), 1, $Text) EndIf EndSwitch EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_NOTIFY In addition, you can use my Skin UDF. #Include <GDIPlus.au3> #Include <GUIConstantsEx.au3> #Include <Skin.au3> _GDIPlus_Startup() $hForm = GUICreate('MyGUI', 401, 160) GUISetBkColor(0xF0F0F0) $Button1 = _Skin_AddButton(12, 119, 29, 29, _LoadBitmap('down_normal.bmp'), _LoadBitmap('down_over.bmp'), _LoadBitmap('down_push.bmp')) $Button2 = _Skin_AddButton(46, 119, 29, 29, _LoadBitmap('up_normal.bmp'), _LoadBitmap('up_over.bmp'), _LoadBitmap('up_push.bmp')) $Button3 = _Skin_AddButton(87, 124, 29, 29, _LoadBitmap('down_normal_small.bmp'), _LoadBitmap('down_over_small.bmp'), _LoadBitmap('down_push_small.bmp')) $Button4 = _Skin_AddButton(111, 124, 29, 29, _LoadBitmap('up_normal_small.bmp'), _LoadBitmap('up_over_small.bmp'), _LoadBitmap('up_push_small.bmp')) $Button5 = _Skin_AddButton(323, 14, 64, 64, _LoadBitmap('cd_normal.bmp'), _LoadBitmap('cd_over_push.bmp'), _LoadBitmap('cd_over_push.bmp')) GUISetState() While 1 _Skin_Helper($hForm) $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE ExitLoop Case $Button1 ConsoleWrite('#1' & @CR) Case $Button2 ConsoleWrite('#2' & @CR) Case $Button3 ConsoleWrite('#3' & @CR) Case $Button4 ConsoleWrite('#4' & @CR) Case $Button5 ConsoleWrite('#5' & @CR) EndSwitch WEnd GUIDelete() _Skin_Destroy() Func _LoadBitmap($sPath) Local $hBitmap, $hImage _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sPath) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() Return $hBitmap EndFunc ;==>_LoadBitmap
    1 point
  3. http://www.chilkatsoft.com/ssh-sftp-activex.asp http://www.example-code.com/vbscript/ssh.asp http://www.example-code.com/vbscript/sftp.asp http://www.example-code.com/vbscript/ssh-tunnel.asp These examples are very simillar to AutoIt.
    1 point
  4. #include <Array.au3> ; Simulate reading files with mp3 extension only $sList = "ts-almojadilah5-3.mp3;ts-almojadilah6-1.mp3;ts-almojadilah6-2.mp3;ts-almojadilah4-4.mp3;" & _ "ts-almojadilah4-5.mp3;ts-almojadilah5-1.mp3;ts-almojadilah7-3.mp3;ts-almojadilah7-4.mp3;" & _ "ts-almojadilah7-5.mp3;ts-almojadilah6-3.mp3;ts-almojadilah7-1.mp3;ts-almojadilah7-2.mp3;" & _ "ts-almojadilah4-3.mp3;ts-almojadilah2-2.mp3;ts-almojadilah2-3.mp3;ts-almojadilah2-1.mp3;" & _ "ts-almojadilah1-1.mp3;ts-almojadilah1-2.mp3;ts-almojadilah2-4.mp3;ts-almojadilah4-1.mp3;" & _ "ts-almojadilah4-2.mp3;ts-almojadilah3-3.mp3;ts-almojadilah3-1.mp3;ts-almojadilah3-2.mp3" ; $sList = "1-1.mp3;1-2.mp3;10-1.mp3;10-3.mp3;2-1.mp3;2-2.mp3;2-3.mp3;2-4.mp3;3-1.mp3;3-2.mp3;3-3.mp3;4-1.mp3;4-2.mp3;4-3.mp3;4-4.mp3;6-1.mp3;6-2.mp3;6-3.mp3;7-1.mp3;7-2.mp3;7-3.mp3;7-4.mp3;7-5.mp3;8-5.mp3" $aList = StringSplit($sList, ";") _ArrayColInsert($aList, 1) For $i = 1 To $aList[0][0] $aList[$i][1] = StringReplace($aList[$i][0] , ".mp3", "") $aList[$i][1] = StringReplace($aList[$i][1], "-", ".") If NOT StringRegExp( $aList[$i][1], "\d+\.\d+$") Then $aList[$i][1] &= ".0" $aList[$i][1] = StringFormat( "%128s", $aList[$i][1]) Next ; _ArrayDisplay($aList) _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList, "Final", Default, 8)
    1 point
  5. This topic is a long run #include <Array.au3> $sList = "ts-almojadilah5-3.mp3;ts-almojadilah6-1.mp3;ts-almojadilah6-2.mp3;ts-almojadilah4-4.mp3;" & _ "ts-almojadilah4-5.mp3;ts-almojadilah5-1.mp3;ts-almojadilah7-3.mp3;ts-almojadilah7-4.mp3;" & _ "ts-almojadilah7.mp3;ts-almojadilah6-3.mp3;ts-almojadilah7-1.mp3;ts-almojadilah7-2.mp3;" & _ "ts-almojadilah4-3.mp3;ts-almojadilah2-2.mp3;ts-almojadilah2-3.mp3;ts-almojadilah2-1.mp3;" & _ "ts-almojadilah1-1.mp3;ts-almojadilah1-2.mp3;ts-almojadilah2-4.mp3;ts-almojadilah4-1.mp3;" & _ "ts-almojadilah4-2.mp3;ts-almojadilah3-3.mp3;ts-almojadilah3-1.mp3;ts-almojadilah3-2.mp3;" & _ "1-1.mp3;1-2.mp3;15.mp3;10-1.mp3;10-3.mp3;2-1.mp3;2-2.mp3;20-1.mp3;test3.txt" $aList = StringSplit($sList, ";", 2) _ArrayDisplay($aList) _ArrayColInsert($aList, 1) For $i = 0 To UBound($aList)-1 $aList[$i][1] = Execute(StringRegExpReplace($aList[$i][0], _ '(.*?)(\d+)-?(\d+)?(.mp3)', "'$1' & StringFormat('%04i', '$2') & '.$3' & ") & "''") Next _ArraySort($aList, 0, 0, 0, 1) _ArrayColDelete($aList, 1) _ArrayDisplay($aList)
    1 point
×
×
  • Create New...