Advert
TuMiM
Active Members-
Posts
107 -
Joined
-
Last visited
TuMiM's Achievements
Adventurer (3/7)
0
Reputation
-
Yes dude! You rock!
-
ok thanks I got that to work but that broke the rest of my script because now when i push the button it doesn't do anything. I assume it's because i am now using oneventmode but not sure how to fix this #include <GUIConstants.au3> #include<file.au3> #include<array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> ;OPT("GuiOnEventMode",1) $Form1 = GUICreate("LST File Copy", 456, 290, 241, 160) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") $FileIn = GUICtrlCreateInput("", 128, 88, 177, 21, -1) $Button1 = GUICtrlCreateButton("Browse", 320, 88, 97, 25) GUICtrlCreateLabel("LST File Copy", 150, 16, 342, 28) GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x800080) GUICtrlCreateLabel("Choose LST File:", 24, 88, 94, 17) $Partial = GUICtrlCreateCheckbox("Partial OFF", 24, 140, 100, 20, $BS_PUSHLIKE) GUICtrlSetOnEvent(-1, "UpdateGUI") $Button2 = GUICtrlCreateButton("Copy LST File", 152, 256, 137, 25) $Find_Loc = "" GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $Button1 $find_loc = FileOpenDialog("Please Choose File.", "ServerShare","LST Files (*.lst)",1 + 2) If $find_loc = "" Then ContinueLoop GUICtrlSetData($FileIn, $find_loc) $split = StringSplit($Find_loc,"") $Dest = "172.28.206.7BservicesLST" $dir = $split[$split[0] -1] $file = $split[$split[0]] $chan1 = StringMid($file, 1, 4) $year = StringMid($file, 7, 2) $Month = StringMid($file, 9, 2) $Day = StringMid($file, 11, 2) If $chan1 = "APAR" Then $chan = "AA" If $chan1 = "APBR" Then $chan = "AB" If $chan1 = "APLA" Then $chan = "AP" If $chan1 = "DCAR" Then $chan = "AR" If $chan1 = "DHBR" Then $chan = "BH" If $chan1 = "DCBR" Then $chan = "BL" If $chan1 = "CVLA" Then $chan = "DC" If $chan1 = "DCES" Then $chan = "DE" If $chan1 = "DCEE" Then $chan = "DE" If $chan1 = "DCFA" Then $chan = "DF" If $chan1 = "DFUH" Then $chan = "DF" If $chan1 = "DKLA" Then $chan = "DK" If $chan1 = "DCME" Then $chan = "DM" If $chan1 = "DSLA" Then $chan = "DS" If $chan1 = "TULA" Then $chan = "DT" If $chan1 = "DCVE" Then $chan = "DV" If $chan1 = "DHAR" Then $chan = "HA" If $chan1 = "DLHD" Then $chan = "HD" If $chan1 = "HDLT" Then $chan = "HDLT" If $chan1 = "DHME" Then $chan = "HM" If $chan1 = "DHSP" Then $chan = "HS" If $chan1 = "DKAR" Then $chan = "KA" If $chan1 = "DKBR" Then $chan = "KB" If $chan1 = "DKMX" Then $chan = "KM" If $chan1 = "DCLA" Then $chan = "LA" If $chan1 = "DHLA" Then $chan = "LH" If $chan1 = "TLLA" Then $chan = "LT" If $chan1 = "PAAR" Then $chan = "PA" If $chan1 = "PABR" Then $chan = "PB" If $chan1 = "PAME" Then $chan = "PM" If $chan1 = "PALA" Then $chan = "PN" If $chan1 = "DCSP" Then $chan = "SP" If $chan1 = "TLAR" Then $chan = "TA" If $chan1 = "TLCA" Then $chan = "TA" If $chan1 = "TLCB" Then $chan = "TB" If $chan1 = "PAIB" Then $chan = "TI" If $chan1 = "TLCL" Then $chan = "TL" If $chan1 = "LVAR" Then $chan = "VA" If $chan1 = "LVBR" Then $chan = "VB" If $chan1 = "LVLA" Then $chan = "VL" If $chan1 = "LVME" Then $chan = "VM" If BitAND(GUICtrlRead($Partial), $GUI_CHECKED) == $GUI_CHECKED THEN $Note = '"The LST file above will be copied to '& $Dest &''& $dir &' as '& $chan & $Month & $Day & $year &'A.LST"' GUICtrlCreateLabel($note, 24, 136, 390, 108) GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) Else $Note = '"The LST file above will be copied to '& $Dest &''& $dir &' as '& $chan & $Month & $Day & $year &'.LST"' GUICtrlCreateLabel($note, 24, 136, 390, 108) GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) ENDIF Case $msg = $Button2 If $Find_loc = "" Then ContinueLoop $Lookup = '" '& $Dest &''& $chan &''& $chan & $Month & $Day & $year &'.LST"' ;MsgBox(1, "Test", $Lookup) ;MsgBox(1, "File Copied", ' /c copy "' & $Find_loc & '" "' & $Dest &''& $chan &''& $chan & $Month & $Day & $year &'.LST" /Y') ;Runwait(@ComSpec & ' /c copy "' & $Find_loc & '" "' & $Dest &''& $chan &''& $chan & $Month & $Day & $year &'.LST" /Y',"", @SW_Hide) Runwait(@ComSpec & ' /c copy "' & $Find_loc & '" "' & $Dest &''& $dir &''& $chan & $Month & $Day & $year &'.LST" /Y',"", @SW_Hide) ;If Fileexists($lookup) Then MsgBox(1, "File Copied", $Lookup & " has been copied") ;ENDIF Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit Func _Quit() Exit EndFunc ;==>_Quit Func UpdateGUI();make GUI Refresh If BitAND(GUICtrlRead($Partial), $GUI_CHECKED) == $GUI_CHECKED Then GUICtrlSetData($Partial,"Partial ON") ; if checked Else GUICtrlSetData($Partial,"Partial OFF") ; if unchecked EndIf EndFunc ;==>UpdateGUI
-
I have a script that runs with one button to find the file you want to process and one that processes the file. The script basically just renames the file. Anyhow, I need to create a switch type of button that depending on which switch is set will name the file one way and if the button is switched the other way it names the file differently. Is there a way to create such a switch type of GUI button? I know I could probably do it with a check box but I'd rather a switch
-
How can I extract characters from a file name? I know how to use the stringtrimright and left but i need to get specific parts of the file name into different variables. The filename is in the following format APBR20091130a.LST . I need the first two as a variable which i can do with stringtrimleft but how do i get the 2009 as a variable 09, the month as a variable and the day asa variable and drop the rest?
-
I know this is probably easy but I can't figure out the easiest way to do it. If i have a string that comes from a fileopendialog that looks like this \\172.28.206.7\Bservices\LST\AB\file.txt and I need to get only the last directory name so AB in this instance. how can i extract that out keeping in mind that that AB can be other directories named other things.
-
Is there a way to embed a window in a GUI that shows the contents of a folder and allows you to select a file?
-
Seems like it would work but overly complicated? I was hoping for something a little more simple but I guess if it works i could go with it
-
I have a script that currently looks for a file with an AVI extension and if not there sends a msgbox. I need it to look for t=files with an AVI or MOV extensions. How would i do that? $AviSearch = FileFindFirstFile($path1 & "\*.avi") If $AviSearch = -1 Then GUICtrlSetData( $status, "AVI does not exist") $return = MsgBox(1, "AVI File Does NOT Exist", "No AVI file is available in this directory.")
-
Cool, well that definitely solves it
-
I am trying to write a simple script to bloack the delete key from being pressed but when i run the script I am getting an error from the blockinput udf My Script #include <BlockInputEx.au3> _BlockInputEx(3, "", "{DELETE}") While 1 Sleep(100) WEnd Func _Quit() Exit EndFunc I have attached the error i receive.
-
Does anyone know if there is a way to disable the delete key through a script? This is not for malicious needs. I have a program running on tablets pc that if you hit the delete key will delete pages without notifications and confirmations and I need to remove that from the users. They've already mistakenly deleted from files. Thanks
-
So is there any way to get variable $test to equal the name of the checkbox it was looking at. So if LA was check $test should equal LA, next if DV was checked $test should equal DV etc. or do they equal numbers now because of the for statement?
-
Nah. That won't work. That will only solve the first 2 not the rest of the list.
-
Thanks guys, that fixed it but one more question. How do i get the checkbox it's reading into a variable? So basically i was trying to get variable $test to equal the name of the checkbox it was looking at. So if LA was check $test should equal LA, next if DV was checked $test should equal DV etc.
-
I have the following script which when runbrings up the GUI but won't respond to any button click or program close. Any idea what is wrong with it? #include <GUIConstantsEx.au3> #include <GUIConstants.au3> #Include <Date.au3> #include <File.au3> #include <TreeviewConstants.au3> #include <WindowsConstants.au3> $NowDate=(@MON & @MDAY & stringright(@YEAR, 2)) Opt("GUIOnEventMode",1) If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000 GuiCreate("Miranda SCH Copy", 392, 316,(@DesktopWidth-392)/2, (@DesktopHeight-316)/2,$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_1 = GuiCtrlCreateButton("Copy Files", 130, 75, 130, 30) ;GUICtrlSetOnEvent($Button_1,"Copy") $Label_2 = GuiCtrlCreateLabel("Please click on the button below to Copy files named with the date below", 50, 15, 300, 25, $SS_CENTER ) ;$Overwrite = GUICtrlCreateCheckbox ("Overwrite", 300, 80, 120, 20) ;GUICtrlSetState(-1, $overwrite) $list1= GUICtrlCreateListView (" Files copied ", 80, 125, 225, 150) $input = GUICtrlCreateinput ($NowDate, 175, 45, 50, 20) $Checktree = GuiCtrlCreateTreeView(320, 125, 75, 150, $TVS_CHECKBOXES) $LA = GuiCtrlCreateTreeViewItem("LA", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $DV = GuiCtrlCreateTreeViewItem("DV", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $PB = GuiCtrlCreateTreeViewItem("PB", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $DE = GuiCtrlCreateTreeViewItem("DE", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $KB = GuiCtrlCreateTreeViewItem("KB", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $AR = GuiCtrlCreateTreeViewItem("AR", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $DM = GuiCtrlCreateTreeViewItem("DM", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $PM = GuiCtrlCreateTreeViewItem("PM", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $KA = GuiCtrlCreateTreeViewItem("KA", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $DK = GuiCtrlCreateTreeViewItem("DK", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $BL = GuiCtrlCreateTreeViewItem("BL", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $PA = GuiCtrlCreateTreeViewItem("PA", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $PN = GuiCtrlCreateTreeViewItem("PN", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) $KM = GuiCtrlCreateTreeViewItem("KM", $Checktree) GuiCtrlSetState(-1, $GUI_CHECKED) GuiSetState(@SW_SHOW) Global $aAction[$KM + 1] $aAction[$LA] = "MirCopy" $aAction[$DV] = "MirCopy" $aAction[$PB] = "MirCopy" $aAction[$DE] = "MirCopy" $aAction[$KB] = "MirCopy" $aAction[$AR] = "MirCopy" $aAction[$DM] = "MirCopy" $aAction[$PM] = "MirCopy" $aAction[$KA] = "MirCopy" $aAction[$DK] = "MirCopy" $aAction[$BL] = "MirCopy" $aAction[$PA] = "MirCopy" $aAction[$PN] = "MirCopy" $aAction[$KM] = "MirCopy" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Button_1 ;SplashTextOn("File Copying", "Copying Files, Please wait", 250, 35) ;FileDelete("c:" & "\Log\MirandaCOPY.txt") ;DriveMapAdd("", "\\172.28.209.144\Playlists", 0, "bservices", "Broadcast01") For $i = $LA To $KM If BitAnd(GUICtrlRead($i), $GUI_CHECKED) = $GUI_CHECKED Then Call($aAction[$i]) Next ;SplashOff() EndSwitch WEnd ;--------------- Functions --------------- Func MirCopy() $UpInput = GUICtrlRead($Input) $source="\\172.28.206.7\Bservices\SCH" $destination="\\172.28.209.144\playlists\Probel Lists\LISTS FOR PARSING" $test=$aAction[$i] MsgBox(4096, "Test", @ComSpec & ' /c xcopy "' & $source & '\' & $test & & $Upinput & '*.SCH" "' & $destination & '" /Y>c:\Log\MirandaCopy.txt', 10) ;Runwait(@ComSpec & ' /c xcopy "' & $source & '\LA' & $Upinput & '*.SCH" "' & $destination & '" /Y>c:\Log\MirandaCopy.txt',"", @SW_Hide) EndFunc