March 06, 2021, 01:12:40 AM

Author Topic: Locating File in a Folder  (Read 211 times)

Offline Hardcoal

Locating File in a Folder
« on: January 15, 2021, 05:02:37 PM »
Hi.. how can i make in blitzmax that when i press a button it will locate the Fire I Desire..

Same like OpenURL but with selecting the desired file on windows

Also after i open the window using openURL how can i change the window size ?

thanks.. hardcoal
hmmmm

Offline Dabz

Re: Locating File in a Folder
« Reply #1 on: January 15, 2021, 06:12:38 PM »
Do you mean this:-

filename$=RequestFile( "Select file to open",filter$ )
OpenURL(filename$)

For the changing of the size, there is a few ways, one, you can peek and manipulate the window via Win32 through Max itself, theres loads of examples if you Google (Maybe not Max specific, but they'll all use the same API calls), both for GUI and console window types, or, if the file is an executable which your opening (And its something you wrote yourself), you could plonk a .dat file down in it's folder (Or a known persistent path on the system) with the sizes needed, and, read them in when you open it and just adjust the properties within that. Obviously Win32 from Max will be cleaner, but, the other way will be easier.

Generally though, your question is pretty vague in what you are opening etc etc so, its a bit of a stab in the dark what your really after, but I thought I'd chuck them ideas out! :)

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Offline Hardcoal

Re: Locating File in a Folder
« Reply #2 on: January 15, 2021, 11:09:51 PM »
i think when youre doing openurl on a file it runs it..
i wanted to open the folder.. and than that it will be marked.. as selected by the system..
like when you press "Open Containing folder" after you download something..

anyway its no big deal ..
I got so many things to face more important ..than that
hmmmm

Offline degac

Re: Locating File in a Folder
« Reply #3 on: January 16, 2021, 08:02:10 AM »
Well, using RequestFile is the simplest way: just put the 'correct name' in the path_parameter

Code: [Select]
SuperStrict

Local file:String=RequestFile("File to launch","exe:exe",,AppDir+"/name_of_the_application.exe")

Print file

of course the 'name_of_the_application.exe' must exist
If there's a problem, there's at least one solution.
www.blitzmax.org

Offline Hardcoal

Re: Locating File in a Folder
« Reply #4 on: January 16, 2021, 10:48:02 AM »
thanks degas..
I wanted to locate it when folder is open not when requesting file.. but this might somewhat help..

Great post thanks :)
hmmmm

Offline Dabz

Re: Locating File in a Folder
« Reply #5 on: January 16, 2021, 11:10:45 AM »
Quote
like when you press "Open Containing folder" after you download something..

Why didnt you say that in the first place!  ???

Code: [Select]
Local status:Int

Local Process1:TProcess = CreateProcess("explorer.exe /select , c:\Windows\System32\notepad.exe")

status = ProcessStatus(Process1)
If status = 1 Then
    Print("Doing the doings")
Else
    Print("Something is wrong")
EndIf

'Wait a sec for the process to complete
Delay(1000)

TerminateProcess(Process1)

End

EDIT: Oh, I forgot to mention, in regards to your other bit in your original post, when explorer opens, it will become the foreground window, so you should be able to nab its handle with Win32's GetForegroundWindow(), and, do whatever it is you want to do from there.

Quote
I got so many things to face more important ..than that

Was only trying to help going off the info provided, and as such... I didnt know it wasnt that important, so I do apologise for wasting your time there... Anyway, hope my last solution is what you are after!

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Offline Hardcoal

Re: Locating File in a Folder
« Reply #6 on: January 16, 2021, 12:08:37 PM »
LoL Dabz I was just trying to say, Its no big Deal.. If I cant solve this one now, its no big deal.

I do value your time and effort of course :)

English is not my basic language.. So sometimes I straggle to express myself correctly
hmmmm

Offline Dabz

Re: Locating File in a Folder
« Reply #7 on: January 16, 2021, 02:20:32 PM »
Fair enough, but it did come across a bit "meh", and if it isn't important, why spend the time creating a thread over it if there's better things to do! :P nerrr ner ner nerrrr nerrrrrrrrrrr hehehe

Seriously, what I would do, is if being clear is an issue, is try and keep separate problems in separate threads, so not to confuse, its much better, so you could say have had one thread titled:-

"Open containing folder of a file and highlight said file from BM code?" <--- Then pretty much say something like "How Chrome does it with a downloaded file."

and then, in another thread have:-

"Change external windows folder size from within BM?"

Both titles outline what your after, there wont be a mish mash of a vague outline of what multiple things you want only for people take a stab in the dark, and be wrong, and the beauty is, anyone looking for something similar will be able to find it on the boards easier, you've needed it, so, someone else might as well!

Anyway, my little code does exactly what it says on the tin, fires up explorer, and highlights a file of a given path... Jobbie done! ;)

Dabz
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 16Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit

Offline Hardcoal

Re: Locating File in a Folder
« Reply #8 on: January 16, 2021, 03:52:12 PM »
like i said i struggle with english.. a bit..

dont take the "not so important" declaration so heavily.
maybe i should not say that..

off course its important.. but does it matter if i say if its important or not?
it changes nothing..

well.. this is not a chat.. if it was a chat.. i would not be needing to create threads , i would post a message..

I try to solve problem before i post questions...

but i do have many questions.. that are slowly being answered.
im sure this topic will be useful for someone in the future too.

Thanks for now.
hmmmm

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal