Sign in to follow this  
Followers 0
Albatroz

little help plz

30 posts in this topic

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

Search WinAPIEx.au3 and look for _WinAPI_PathStripPath() or use this >>

Func _GetFilename($gf_Path) ; MrCreator
    Return StringRegExpReplace($gf_Path, "^.*\\", "")
EndFunc   ;==>_GetFilename

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

$FullPath = IniRead("MyIniFile.ini", "disc", "filename")
$filename = StringRight($FullPath, StringLen($FullPath)-StringInStr($FullPath, "/", 0, -1))

Share this post


Link to post
Share on other sites

Anyone got method number 6... ?

William

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

saywell,

If you insist: ;)

ConsoleWrite(StringRegExpReplace("/c/temp/iso/supermario.iso", "^.*\/", "") & @CRLF)

Edit: Ok, #7 then! :idiot:

Albatroz,

I take you have read this? Take care you do not cross the line. :)

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

saywell,

If you insist: ;)

ConsoleWrite(StringRegExpReplace("/c/temp/iso/supermario.iso", "^.*\/", "") & @CRLF)

Edit: Ok, #7 then! :idiot:

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

Share this post


Link to post
Share on other sites

dont worry about bot or any cheat...

im just compiling a converter to my wii

thx for advice

Another question

I 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

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

thx,,, i will take a look

Share this post


Link to post
Share on other sites

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

Global $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

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 :idiot:

thx a lot

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#17 ·  Posted (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 by Albatroz

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0