PantZ4 0 Posted November 21, 2006 How to get the extion(spelling?) of a file? Like If $msg = $GUI_EVENT_CLOSE Or $msg = $exit Then ExitLoop If $msg = $selectfilebutton Then GUICtrlSetData($statusgroup,"Status: Select File to Optimize") GUISetState(@SW_DISABLE,$GuiWindow) $file = FileOpenDialog("Select File to Optimize",@WorkingDir,"All Compatible File Types (*.w3m;*.w3x;*.wts;*.j)|Warcraft 3 Maps (*.w3m;*.w3x)|JASS Scripts (*.j)|String Files (*.wts)|Text Files (*.txt)|All Files (*.*)",1) $CheckHasEnableBoolean = 0 If $file = "" Then GUICtrlSetData($filenamelabel,"File: No file selected") GUICtrlSetTip($selectfilebutton,"Press this button to select the file to optimize") GUICtrlSetData($helplabel1,"Select the file to optimize: "&@LF&"Works with maps (.w3m and .w3x), JASS scripts and string files.") Else GUICtrlSetData($filenamelabel,"File: "&$file) GUICtrlSetTip($selectfilebutton,$file) GUICtrlSetData($helplabel1,"Go now to Script Optimization"&@LF&"Or press Select File button again to choose another file") EndIf GUICtrlSetData($statusgroup,"Status: Waiting...") GUISetState(@SW_ENABLE,$GuiWindow) GUISetState(@SW_HIDE,$GuiWindow) GUISetState(@SW_SHOW,$GuiWindow) EndIf But it didn't work. Thank you Share this post Link to post Share on other sites
/dev/null 1 Posted November 21, 2006 How to get the extion(spelling?) of a file? After this I want it to check what file it is. I have tryed: If $file = "*.w3x" Then But it didn't work. at least two options.... 1.) Preferred: _PathSplit() - see help file 2.) StringInStr($file,".w3x") - see help file Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Share this post Link to post Share on other sites
BigDod 518 Posted November 21, 2006 How about If StringRight($file,3) = "w3x" Then Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Share this post Link to post Share on other sites
PantZ4 0 Posted November 21, 2006 How about If StringRight($file,3) = "w3x" ThenAhh a easy way Thank you Share this post Link to post Share on other sites
PantZ4 0 Posted November 21, 2006 at least two options.... 1.) Preferred: _PathSplit() - see help file 2.) StringInStr($file,".w3x") - see help file Cheers KurtHow does the _PathSplit() works? My code: $TestPath = _PathSplit($file, $szDrive, $szDir, $szFName, $szExt) $TestPath[3] = $filename And $filename retruns to "" Helpfile: Return Value Returns an array with 5 elements where 0 = original path, 1 = drive, 2 = directory, 3 = filename, 4 = extension But maybe I shall not say $TestPath[3] = $filename? Share this post Link to post Share on other sites
/dev/null 1 Posted November 21, 2006 How does the _PathSplit() works? as shown in the help file sample... #include <file.au3> $filename = "C:\temp\test.w3x" Dim $szDrive, $szDir, $szFName, $szExt $SplittedPath = _PathSplit($filename, $szDrive, $szDir, $szFName, $szExt) if ($szExt = ".w3x") then msgbox(0,"INFO", "HuHu ... found a magic W3X file...") endif oÝ÷ Ù«©mz¹Ú¶+Þjëh×6#include <file.au3> $filename = "C:\temp\test.w3x" Dim $szDrive, $szDir, $szFName, $szExt $SplittedPath = _PathSplit($filename, $szDrive, $szDir, $szFName, $szExt) if ($SplittedPath[4] = ".w3x") then msgbox(0,"INFO", "HuHu ... found a magic W3X file...") endif Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Share this post Link to post Share on other sites
PantZ4 0 Posted November 21, 2006 Now it works Thanks Share this post Link to post Share on other sites