View previous topic :: View next topic |
Author |
Message |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Tue Dec 04, 2018 4:00 pm Post subject: GetWindowThreadProcessId / GetWindowModuleFileNameA |
|
|
I am trying to get the EXE name from a Class/ID, but I am having issues. Anyone around that can help? I am on Windows 10 64bit. I need something that works on both 32 and 64.
I have tried this but it's not working properly:
Code: |
loadlib user32.dll
%H = @strdel(@winexists(#Progman),1,1)
%T = @fill(256)
%Z = @lib(USER32,GetWindowModuleFileNameA,INT:,%h,@addr("%T"),255)
info %T
freelib user32.dll
|
Thanks!! _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Wed Dec 05, 2018 7:23 am Post subject: |
|
|
Very interested too!
I have tried with an other method (Batch file)
notepad windows name is .txt file
Code: | CHCP 1252
tasklist /FO CSV /NH /FI "WINDOWTITLE eq temp*" > "a.txt"
type "a.txt" > temp.txt
del "a.txt"
ren temp.txt a.txt
del batch.bat |
give this in a a.txt
Code: | "notepad.exe","17320","Console","1","19 012 Ko" |
hope it can help |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
Posted: Wed Dec 05, 2018 3:30 pm Post subject: |
|
|
I have tried that also, but it doesn't work very well and doesn't like window titles that have spaces. I would like to be able to use the class of the window. _________________ Chris
Http://theblindhouse.com |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Wed Dec 05, 2018 4:23 pm Post subject: |
|
|
Yes, I know.... |
|
Back to top |
|
|
cnodnarb Professional Member
Joined: 11 Sep 2002 Posts: 762 Location: Rockeledge, GA
|
Posted: Sun Dec 16, 2018 6:59 pm Post subject: |
|
|
powershell
Code: |
# where %1706732 is Untitled - Notepad
$mainwin = Get-Process |where {$_.MainWindowHandle -like '1706732'} | Format-List name
$mainstring = $mainwin | Out-String
$mysplit = $mainstring.Split("{:}")
$exename = $mysplit[1].Trim()
Write-Host $exename |
Returns
without .exe
[edit]
I guess I think this is usable, because you can use the class to get the hwnd, and then use the hwnd in the call.
If you go with this, make sure to use -ExecutionPolicy bypass when calling: Code: | powershell.exe {file} -ExecutionPolicy bypass |
This doesn't modify the end users powershell policy and still allows your code to run, which creates the question as to why such a flimsy thing exists but you know, I don't work for Microsoft....
[/edit] |
|
Back to top |
|
|
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1751 Location: Space and Time
|
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Sat Sep 19, 2020 1:32 am Post subject: |
|
|
Sorry about waiting so long to reply to this POST.
Just wanted to share this all-VDS6 PowerShell example.
Substitute the EXE with an externally running EXE.
I realize the below example could be done with the below code, but
this is a PowerShell example of both ways.
%%EXEnameOnly = @NAME(%0)".exe" <self test example>
*To get your program EXE name for purpose of this EXAMPLE.
<I'm starting to confuse myself>
cnodnarb provided this code on this POST, the below
example is using his PowerShell code.
*I changed the security part a bit and I don't know much
about how MS/PowerShell security works, so use at your
own risk.
Code: |
%%TITLE = "EXAMPLE EXEgetName"
%%CLASS = "exampleEXEgetName-2020"
Title %%TITLE
# - - - - - - - - - - - - - - - - - - - - -
# To get your program EXE name for purpose of this EXAMPLE
# You must have a MAIN TITLE DIALOG WINDOW
# If not ==> this example fails !
# - - - - - - - - - - - - - - - - - - - - -
%%ROOT = "C:\GET exe NAME from running program"
%%myLIST = @NEW(LIST)
DIRECTORY CREATE,%%ROOT
WAIT 0.1
# vtol 2020
#==========================================
DIALOG CREATE,"EXAMPLE of running it ALL from VDS6",-1,0,500,240,COLOR "50|50|50",SAVEPOS,CLASS %%CLASS
DIALOG ADD,STYLE,STYLE1,Franklin Gothic Medium ,14,,"212|250|237",7|7|7
DIALOG ADD,STYLE,STYLE2,calibri,40,bc,,255|255|92
DIALOG ADD,TEXT,waiting,40,0,500,50,"Please WAIT",,STYLE2
DIALOG ADD,EDIT,result,130,20,460,30,,,Style1
####>
DIALOG SHOW
####>
WAIT 0.2
%%Identifier = @winactive(i)
WAIT 0.1
%%Identifier = @STRDEL(%%Identifier,1,1)
rem info %%Identifier
%%line1 = "$mainwin = Get-Process |where {$_.MainWindowHandle -like '"%%Identifier"'} | Format-List name"
LIST ADD,%%myLIST,%%line1
%%line2 = "$mainstring = $mainwin | Out-String"
LIST ADD,%%myLIST,%%line2
# below creates a blank line:
LIST ADD,%%myLIST,
%%line3 = "$mysplit = $mainstring.Split("@CHR(34)"{:}"@CHR(34)")"
LIST ADD,%%myLIST,%%line3
%%line4 = "$exename = $mysplit[1].Trim()"
LIST ADD,%%myLIST,%%line4
%%line5 = "Write-Host $exename"
LIST ADD,%%myLIST,%%line5
LIST savefile,%%myLIST,%%ROOT"\Pscript.ps1"
WAIT 0.2
DIRECTORY CHANGE,"C:\GET exe NAME from running program"
WAIT 0.1
LIST CLEAR,%%myLIST
%%line1 = "@echo off"
LIST ADD,%%myLIST,%%line1
# below creates a blank line:
LIST ADD,%%myLIST,
%%line2 = "powershell.exe -NoProfile -ExecutionPolicy RemoteSigned -File Pscript.ps1"
LIST ADD,%%myLIST,%%line2
# below creates a blank line:
LIST ADD,%%myLIST,
%%line3 = "EXIT"
LIST ADD,%%myLIST,%%line3
# below creates a blank line:
LIST ADD,%%myLIST,
LIST savefile,%%myLIST,%%ROOT"\RUN.bat"
WAIT 0.3
RUNH cmd.exe /c RUN.bat,PIPE,WAIT 10
%%pipe = @PIPE()"."exe
dialog hide,waiting
WAIT 0.1
dialog set,result,%%pipe
:Evloop
wait event
goto @event()
:close
LIST CLOSE,%%myLIST
EXIT |
|
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Mon Sep 21, 2020 6:49 pm Post subject: |
|
|
Excellent ! |
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Tue Sep 22, 2020 2:50 am Post subject: |
|
|
wasn't much, but thankyou very much anyhow
I enjoy mixing.. batch commands /PowerShell /AHK /Python
/HTML /VBS /etc. with VDS6, that's whats great about VDS
as you already know
cheers
I read somewhere here (and I can't find it now) that one
of the VDS developers is thinking of creating a VDS7.
I hope that wasn't just a dream I had |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Tue Sep 22, 2020 12:49 pm Post subject: |
|
|
For vds it is not a dream, but I have no idea when.
I have not heard from for several months despite the reminders ...
Can't wait to have a new version with new features! |
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Tue Sep 22, 2020 10:53 pm Post subject: |
|
|
From what I remember reading, it was supposed to just update some of the already existing features to work better with Windows 10.
Which would still be great to me.
Another example may be a new VDS installer for windows 10 and up.
Wish I could figure out where that POST ended up at
If I wanted to really dream big, I would like it to be upgraded
to include 64bit for things like better registry reading/writing.
Plus a lotta little things would be nice.
They may have just put it on the shelf for awhile.
What do I know anyways |
|
Back to top |
|
|
GregLand Valued Contributor
Joined: 15 Jun 2004 Posts: 212 Location: FRANCE
|
Posted: Wed Sep 23, 2020 9:47 am Post subject: |
|
|
Indeed it will only be a bug update and there will be no news for the moment.
For Dialog Designer.exe, all bugs have been fixed.
But I don't have any information for vds.exe.
I've launched the idea for an x64 version, which seems to me to be the best evolution for the moment, it will be done, but later.
I often relaunch, I'm waiting like you for fresh news. |
|
Back to top |
|
|
vtol Valued Contributor
Joined: 05 Feb 2004 Posts: 642 Location: Eastern Indiana
|
Posted: Wed Sep 23, 2020 11:59 pm Post subject: |
|
|
Thanks for all that..
I do remember (after you reminded me) about the designer fix.
*I haven't been to the VDS site since like 2006.
cheers |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|