Albatroz Posted February 14, 2011 Share Posted February 14, 2011 hi guys,,, i need some help to my problem: my script is creating a list.ini to store some data like: [disc] id = sdas00 (gameid) filename = /c/temp/iso/supermario.iso Now my problem: i can get the correct filename at my script but, i dont wanna the full path like /c/tem/iso/supermario.iso id like only supermario.iso but i dont know how to get this filename(just iso) to my variable. btw, i cant change /c/temp/iso/supermario.iso or any another name cause its generated from a program. thx Link to comment Share on other sites More sharing options...
saywell Posted February 14, 2011 Share Posted February 14, 2011 You could use StringSplit with "\" as the delimiter, and take the last one or use _PathSplit and concatenate elements [3] and [4] of the resulting array. William Link to comment Share on other sites More sharing options...
guinness Posted February 14, 2011 Share Posted February 14, 2011 Search WinAPIEx.au3 and look for _WinAPI_PathStripPath() or use this >> Func _GetFilename($gf_Path) ; MrCreator Return StringRegExpReplace($gf_Path, "^.*\\", "") EndFunc ;==>_GetFilename UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
willichan Posted February 14, 2011 Share Posted February 14, 2011 $FullPath = IniRead("MyIniFile.ini", "disc", "filename") $filename = StringRight($FullPath, StringLen($FullPath)-StringInStr($FullPath, "/", 0, -1)) My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
saywell Posted February 14, 2011 Share Posted February 14, 2011 Anyone got method number 6... ? William Link to comment Share on other sites More sharing options...
guinness Posted February 14, 2011 Share Posted February 14, 2011 (edited) I do! Forgot it was in my Signature. And in fairness saywell and I were posting at the same time as you were in the previous post, hence why I didn't see your reply Func _GetFilename($gf_Path) Local $gf_WMIService = ObjGet("winmgmts:{impersonationLevel = impersonate}!.rootcimv2") Local $gf_ColFiles = $gf_WMIService.ExecQuery("Select * From CIM_Datafile Where Name = '" & StringReplace($gf_Path, "", "") & "'") If IsObj($gf_ColFiles) Then For $gf_ObjectFile In $gf_ColFiles Return $gf_ObjectFile.FileName Next EndIf Return SetError(1, 1, 0) EndFunc ;==>_GetFilename Edited December 15, 2011 by guinness UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 14, 2011 Moderators Share Posted February 14, 2011 (edited) saywell,If you insist: ConsoleWrite(StringRegExpReplace("/c/temp/iso/supermario.iso", "^.*\/", "") & @CRLF)Edit: Ok, #7 then! Albatroz,I take you have read this? Take care you do not cross the line. M23 Edited February 14, 2011 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Albatroz Posted February 14, 2011 Author Share Posted February 14, 2011 $FullPath = IniRead("MyIniFile.ini", "disc", "filename") $filename = StringRight($FullPath, StringLen($FullPath)-StringInStr($FullPath, "/", 0, -1)) thx alot willi,, it worked great Link to comment Share on other sites More sharing options...
Albatroz Posted February 14, 2011 Author Share Posted February 14, 2011 saywell, If you insist: ConsoleWrite(StringRegExpReplace("/c/temp/iso/supermario.iso", "^.*\/", "") & @CRLF) Edit: Ok, #7 then! Albatroz, I take you have read this? Take care you do not cross the line. M23 dont worry about bot or any cheat... im just compiling a converter to my wii thx for advice Link to comment Share on other sites More sharing options...
Albatroz Posted February 17, 2011 Author Share Posted February 17, 2011 dont worry about bot or any cheat...im just compiling a converter to my wiithx for adviceAnother questionI created a Listview using _guictrllistview_additem, _guictrllistview_addsubitem and _GUICtrlListView_AddColumn.all is working great, i can use convertion tool, rename... but, when i use Delete Function: Filedete($file),,, the file is deleted fine but,,, my listview isnt updated/refreshed.I need help to refresh listview after file deletion,thx a lot Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2011 Moderators Share Posted February 17, 2011 Albatroz,You might want to look at the GUIListViewEx UDF in my sig - it lets you manage ListViews very easily. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Albatroz Posted February 17, 2011 Author Share Posted February 17, 2011 thx,,, i will take a look Link to comment Share on other sites More sharing options...
Albatroz Posted February 17, 2011 Author Share Posted February 17, 2011 Albatroz, You might want to look at the GUIListViewEx UDF in my sig - it lets you manage ListViews very easily. M23 Melba,, sry,,, but im stupid enough look at this plz expandcollapse popupGlobal $listview = GUICtrlCreateListView("", 10, 35, 600, 500) _GUICtrlListView_AddColumn($ListView, "Game ID", 70, 2) _GUICtrlListView_AddColumn($ListView, "Game Title", 300, 0) _GUICtrlListView_AddColumn($ListView, "Game Region", 100, 2) _GUICtrlListView_AddColumn($ListView, "Game Size", 100, 1) GUISetState() Global $disc = "disc-" For $i = 0 To $nI if $nI > "9" Then if $i < "10" then $i = "0" & $i EndIf EndIf Global $xdisc = $disc & $i Global $id = IniRead($IniIM,$xdisc,"id", "Not Found") Global $title = IniRead($IniIM,$xdisc,"title", "Not Found") Global $region = IniRead($IniIM,$xdisc,"region", "Not Found") Global $filename = IniRead($IniIM,$xdisc,"filename", "Not Found") Global $size = IniRead($IniIM,$xdisc,"size", "Not Found") Global $sizeMB = Round(($size / 1048576),2) if $sizeMB > "1000" Then $sizemb = Round(($sizemb / 1000),2) & " GB" Else $sizemb = $sizemb & " MB" EndIf ;Global $gameview = GUICtrlCreateListViewItem($id & "|" & $title & "|" & $region & "|" & $sizemb, $listview) ;Global $game = _GUICtrlListView_AddItem($listview, $id & " | " & $title & " | " & $region & " | " & $sizemb, 1) Global $game = _GUICtrlListView_AddItem($listview, $id, 1) _GUICtrlListView_AddSubItem($listview, $game, $title, 1, 1) _GUICtrlListView_AddSubItem($listview, $game, $region, 2, 2) _GUICtrlListView_AddSubItem($listview, $game, $sizemb, 3, 3) ;Global $index = _GUICtrlListView_GetItem($listview, $game) ;;;Global $crtgameid = IniWrite($IniIM,"gameid",$game, $id) Global $crtgameid = IniWrite($IniIM,$game,"id", $id) Global $crtgamefn = IniWrite($IniIM,$game,"filename", $filename) Next GUICtrlSetData($game, $id) $msg = 0 while 1 $msg = GUIGetMsg() Global $gameid = _GUICtrlListView_GetSelectedIndices($listview) Global $jogoID = IniRead($IniIM,$gameid,"id", "Not Found") $witPath = IniRead($IniIM, $gameid, "filename", "Not Found") Global $jogoFN = $witpath If $msg = $destfolder Then Folder() ElseIf $msg = $DeleteGame Then Global $ext = ".wbfs" Deleter() EndIf If $msg = $GUI_EVENT_CLOSE Then GUIDelete() ExitLoop EndIf WEnd Func Deleter() If $usbdrv = "" Then $message = "xxxxxxxxxx" Global $usbdrv = FileSelectFolder($message, "") if @error <> 1 then $DelFile = $usbdrv & $jogoID $box = MsgBox(68, " Confirmation", "Are you sure?" & @CRLF & $delfile) if $box = 6 Then MsgBox("", "YES", "Deletando") Global $byegame = _GUICtrlListView_DeleteItem($listview, $gameid) IniDelete($iniIM, $game) Else EndIf ;~ FileDelete($delfile) Else EndIf Else $DelFile = $usbdrv & $jogoID $box = MsgBox(68, " Confirmation", "Are you sure?" & @CRLF & $delfile) if $box = 6 Then MsgBox("", "YES", "Deletando") Global $byegame = _GUICtrlListView_DeleteItem($listview, $gameid) IniDelete($iniIM, $game) Else EndIf ;FileDelete($delfile) EndIf EndFunc Its deleting the game from HDD but it doesnt remove from Listview. All others functions are great Can you help me, plz thx a lot Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 17, 2011 Moderators Share Posted February 17, 2011 Albatroz, You are creating the ListView using the native command and then fillling it using the UDF commands. Mixing native and UDF like that is a recipe for disaster. Just create your ListView with the UDF command and all will be well: Global $listview = _GUICtrlListView_Create($hGUI, "", 10, 35, 600, 500, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_FULLROWSELECT) All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Albatroz Posted February 17, 2011 Author Share Posted February 17, 2011 Albatroz, You are creating the ListView using the native command and then fillling it using the UDF commands. Mixing native and UDF like that is a recipe for disaster. Just create your ListView with the UDF command and all will be well: Global $listview = _GUICtrlListView_Create($hGUI, "", 10, 35, 600, 500, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_FULLROWSELECT) All clear? M23 great,, it worked like a charm thx a lot Link to comment Share on other sites More sharing options...
Albatroz Posted February 18, 2011 Author Share Posted February 18, 2011 Last doubt,,, i promisse (i will try ) how do i create a multiple selection in my list and, then how can i use this selection to execute them as a single selection. thx Link to comment Share on other sites More sharing options...
Albatroz Posted February 18, 2011 Author Share Posted February 18, 2011 (edited) Last doubt,,, i promisse (i will try ) how do i create a multiple selection in my list and, then how can i use this selection to execute them as a single selection. thx Updated: Multiple selection is fine,,, now i just need to know how to execute them in my exection converter function. Global $listview = _GUICtrlListView_Create($list, "", 10, 35, 600, 500, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_FULLROWSELECT Edited February 18, 2011 by Albatroz Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 18, 2011 Moderators Share Posted February 18, 2011 Albatroz,You are already using _GUICtrlListView_GetSelectedIndices to get the selected items - if you look in the Help file you will see that the return is either an array or a "|" delimited string. In your case you would probably be better served by an array, so make sure you set the $fArray parameter to True.On calling the function, you will get an array of the selected items with a count in the [0] element. All you need to do then is loop through the array and action each item in turn. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Albatroz Posted February 18, 2011 Author Share Posted February 18, 2011 sry melba,, i understood what you told,, but im so confused what should i do in $fArray = true?? i mean, in my code... cause if i use $fArray = true, i got an error. can you add/replace in my code above? thx a lot sry for noob questions Link to comment Share on other sites More sharing options...
willichan Posted February 18, 2011 Share Posted February 18, 2011 He is referring to the optional second ($fArray) parameter of the _GUICtrlListView_GetSelectedIndices() function. Global $gameid = _GUICtrlListView_GetSelectedIndices($listview, TRUE) Take a look at the help file for _GUICtrlListView_GetSelectedIndices. It has an explanation for it My UDFs: Barcode Libraries, Automate creation of any type of project folder, File Locking with Cooperative Semaphores, Inline binary files, Continue script after reboot, WinWaitMulti, Name Aggregator, Enigma, CornedBeef Hash Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now