Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/04/2013 in all areas

  1. Try this: #Include <WinAPI.au3> ConsoleWrite(_FileIsUses(@ScriptDir & '\My.pdf') & @CR) Func _FileIsUses($sFile) Local $hFile = _WinAPI_CreateFile($sFile, 2, 2, 0) If $hFile Then _WinAPI_CloseHandle($hFile) Return 0 EndIf Local $Error = _WinAPI_GetLastError() Switch $Error Case 32 ; ERROR_SHARING_VIOLATION Return 1 Case Else Return SetError($Error, 0, 0) EndSwitch EndFunc ;==>_FileIsUses
    1 point
  2. Look at LockFile in my signature.
    1 point
  3. As long as there is no unhidden data in rows beyond a hidden row, or columns beyond a hidden column, _ExcelReadSheetToArray will not return the hidden items in the resulting array.
    1 point
  4. KamilZajaczkowski, A lot of unnecessary coding in that script - using loops and arrays makes it much easier - as this revised version shows: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <ComboConstants.au3> ; Put data into an array Global $aPark_Info[8][4] = [[7], _ ["75 6334", "15", "Not known", "02xxxx334"], _ ["75 6335", "19T", "Not known", "02xxxx7335"], _ ["75 6336", "25", "Not known", "02xxxx336"], _ ["75 6337", "27T", "Not known", "020xxxx 7337"], _ ["75 6338", "31", "Not known", "02xxxx338"], _ ["75 6339", "?", "Not known", "020xx339"], _ ["75 6340", "?", "Not known", "0207xxx340"]] $hGUI = GUICreate("xxx *** Close/Open telephone lines", 801, 601, 269, 117) GUICtrlCreateGroup("Open Line", 10, 10, 385, 580) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("Park Suites", 15, 40, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cPark_Combo = GUICtrlCreateCombo("", 45, 90, 200, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Park Suite 1|Park Suite 2|Park Suite 3|Park Suite 4|Park Suite 5|Park Suite 6|Park Suite 7") GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $cPark_Open = GUICtrlCreateButton("OPEN", 265, 60, 50, 75) $cPark_Close = GUICtrlCreateButton("CLOSE", 325, 60, 50, 75) GUICtrlCreateGroup("Plaza Suites", 15, 150, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cPlaza_Combo = GUICtrlCreateCombo("", 45, 200, 200, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Plaza Suite 1|Plaza Suite 2|Plaza Suite 3|Plaza Suite 4|Plaza Suite 5|Plaza Suite 6|Plaza Suite 7|Plaza Suite 8|Plaza Suite 9|Plaza Suite 10|Plaza Suite 11|Plaza Suite 12|Plaza Suite 13") GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $cPlaza_Open = GUICtrlCreateButton("OPEN", 265, 170, 50, 75) $cPlaza_Close = GUICtrlCreateButton("CLOSE", 325, 170, 50, 75) GUICtrlCreateGroup("City Suites", 15, 260, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cCity_Combo = GUICtrlCreateCombo("", 45, 310, 200, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "City Suite 1|City Suite 2|City Suite 3|City Suite 4|City Suite 5|City Suite 6|City Suite 7|City Suite 8|City Suite 9|City Suite 10|City Suite 11|City Suite 12") GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $cCity_Open = GUICtrlCreateButton("OPEN", 265, 280, 50, 75) $cCity_Close = GUICtrlCreateButton("CLOSE", 325, 280, 50, 75) GUICtrlCreateGroup("Open_Ballroom_Group", 15, 370, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cBall_Combo = GUICtrlCreateCombo("", 45, 420, 200, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Ballroom 1|Ballroom 2|Ballroom 3|Ballroom 4") GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $cBall_Open = GUICtrlCreateButton("OPEN", 265, 390, 50, 75) $cBall_Close = GUICtrlCreateButton("CLOSE", 325, 390, 50, 75) GUICtrlCreateGroup("Events", 15, 480, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cEvents_Combo = GUICtrlCreateCombo("", 45, 530, 200, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Event Org Office 1|Event Org Office 2|Event Desk 1|Event Desk 2") GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif") $cEvents_Open = GUICtrlCreateButton("OPEN", 265, 500, 50, 75) $cEvents_Close = GUICtrlCreateButton("CLOSE", 325, 500, 50, 75) ; Only need to close groups at the end of a list of groups GUICtrlCreateGroup("", -99, -99, 1, 1) ; Use loops for multiple instances of the same label For $i = 0 To 4 GUICtrlCreateLabel("Please choose from drop-down menu below", 45, 70 + ($i * 110), 210, 20) Next GUICtrlCreateGroup("Information on selected extension", 405, 10, 385, 580) GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif") GUICtrlCreateGroup("Park Suites", 410, 40, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cPark_Int_Info = GUICtrlCreateLabel("Park_Int_t", 610, 60, 62, 20) $cPark_In_Info = GUICtrlCreateLabel("Park_In_t", 610, 80, 59, 20) $cPark_Ri_Info = GUICtrlCreateLabel("Park_Ri_t", 610, 100, 62, 20) $cPark_Ext_Info = GUICtrlCreateLabel("Park_Ext_t", 610, 120, 67, 20) GUICtrlCreateGroup("Plaza Suites", 410, 150, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cPlaza_Int_Inf = GUICtrlCreateLabel("Plaza_Int_t", 610, 170, 68, 20) $cPlaza_In_Info = GUICtrlCreateLabel("Plaza_In_t", 610, 190, 65, 20) $cPlaza_Ri_Info = GUICtrlCreateLabel("Plaza_Ri_t", 610, 210, 68, 20) $cPlaza_Ext_Info = GUICtrlCreateLabel("Plaza_Ext_t", 610, 230, 73, 20) GUICtrlCreateGroup("City Suites", 410, 260, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cCity_Int_Info = GUICtrlCreateLabel("City_Int_t", 610, 280, 56, 20) $cCity_In_Info = GUICtrlCreateLabel("City_In_t", 610, 300, 53, 20) $cCity_Ri_Info = GUICtrlCreateLabel("City_Ri_t", 610, 320, 56, 20) $cCity_Ext_Info = GUICtrlCreateLabel("City_Ext_t", 610, 340, 61, 20) GUICtrlCreateGroup("Ballroom", 410, 370, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cBall_Int_Info = GUICtrlCreateLabel("Ballroom_Int_t", 610, 390, 88, 20) $cBall_In_Info = GUICtrlCreateLabel("Ballroom_In_t", 610, 410, 85, 20) $cBall_Ri_Info = GUICtrlCreateLabel("Ballroom_Ri_t", 610, 430, 88, 20) $cBall_Ext_Info = GUICtrlCreateLabel("Ballroom_Ext_t", 610, 450, 93, 20) GUICtrlCreateGroup("Info_Events_Group", 410, 480, 375, 105) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") $cEvents_Int_Info = GUICtrlCreateLabel("Events_Int_t", 610, 500, 75, 20) $cEvents_In_Info = GUICtrlCreateLabel("Events_In_t", 610, 520, 72, 20) $cEvents_Ri_Info = GUICtrlCreateLabel("Events_Ri_t", 610, 540, 75, 20) $cEvents_Ext_Info = GUICtrlCreateLabel("Events_Ext_t", 610, 560, 80, 20) GUICtrlCreateGroup("", -99, -99, 1, 1) For $i = 0 To 4 GUICtrlCreateLabel("Selected extension", 440, 60 + (110 * $i), 118, 20) GUICtrlCreateLabel("In-Room port number", 440, 80 + ($i * 110), 129, 20) GUICtrlCreateLabel("Riser port number", 440, 100 + ($i * 110), 110, 20) GUICtrlCreateLabel("External phone number", 440, 120 + ($i * 110), 141, 20) Next GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cPark_Combo ; Just wait until a combo is actioned before doing anything ; As all the option have a numeric value we can use that to identify them in the data array $iPark_Index = StringRight(GUICtrlRead($cPark_Combo), 1) GUICtrlSetData($cPark_Int_Info, $aPark_Info[$iPark_Index][0]) GUICtrlSetData($cPark_In_Info, $aPark_Info[$iPark_Index][1]) GUICtrlSetData($cPark_Ri_Info, $aPark_Info[$iPark_Index][2]) GUICtrlSetData($cPark_Ext_Info, $aPark_Info[$iPark_Index][3]) Case $cPlaza_Combo Case $cCity_Combo Case $cBall_Combo Case $cEvents_Combo Case $cPark_Open MsgBox(0, "Park", "Open") Case $cPark_Close MsgBox(0, "Park", "Close") EndSwitch WEnd Please ask if you have any questions on what I have changed and why I have done it. M23
    1 point
  5. corgano, This thread was reported as "automation of a game server" - which is clearly forbidden by the rules. As a non-gamer myself I am leaving it to Valik to make a final decision on its legality - but until he does, I am locking the thread. Please accept my apologies if he subsequently gives you the OK. M23
    1 point
×
×
  • Create New...