Sign in to follow this  
Followers 0
nullschritt

[SOLVED]Writing a gui handle to a file, then reading it

9 posts in this topic

#1 ·  Posted (edited)

Okay, so I want to experiment around some with using multiple processes. (+IPC)

So I was thinking of giving each process a hidden window. Then storing the handles for each process in a file.

So my question is how do I store

$gui = guicreate("(WIN:0001)", '100', '100')

$gui to a file as a handle

then read it back from a file and do winexists($gui) (with the handle) to make sure the helper process is open?

Thanks!

Edited by nullschritt

Share this post


Link to post
Share on other sites



FileWrite("yourfile.txt", "" & String($gui)). Isn't it simple? :guitar:

WinExists(HWnd(FileRead("yourfile.txt")))


----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Share this post


Link to post
Share on other sites

FileWrite("yourfile.txt", "" & String($gui)). Isn't it simple? :guitar:

WinExists(HWnd(FileRead("yourfile.txt")))

HWnd()

^that is what I was looking for

Also, I didn't know string() could be used on $gui I thought maybe there was some handle to string function.

Share this post


Link to post
Share on other sites

You know you can just call a second script, and pass in the hwnd as a variable, right? Cut out the middle man (text doc).


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites

You know you can just call a second script, and pass in the hwnd as a variable, right? Cut out the middle man (text doc).

I don't think you understand the activity I am doing.

(also I am not using a text file but ADS within the exe)

What I am doing is constantly having the second process write it;s handle to an ADS, then have the main script check to see if the handle exists.

If the handle does exist, do nothing, if the handle does not exist, launch itself with a command line parameter, to run the second process.

(this way I will always be able to verify if the second process is running, so that it can be turned on and off [it is actually a plugin, that adds additional features])

Thanks for everyone's help and suggestions though!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't think you understand the activity I am doing.

(also I am not using a text file but ADS within the exe)

What I am doing is constantly having the second process write it;s handle to an ADS, then have the main script check to see if the handle exists.

If the handle does exist, do nothing, if the handle does not exist, launch itself with a command line parameter, to run the second process.

(this way I will always be able to verify if the second process is running, so that it can be turned on and off [it is actually a plugin, that adds additional features])

Thanks for everyone's help and suggestions though!

Hi,

Maybe you can use _Singleton with the plugin and then check with the main script if the plugin is running (by the same func)

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Hi,

Maybe you can use _Singleton with the plugin and then check with the main script if the plugin is running (by the same func)

Br, FireFox.

I figured it out fine, thanks firefox, I was just explaining why that suggestion would not have worked worked for me!

(this is more reliable than singleton)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

I figured it out fine, thanks firefox, I was just explaining why that suggestion would not have worked worked for me!

(this is more reliable than singleton)

Yes, in my opinion I prefer my suggestion because you don't write files.

You can also you use the AutoIt window (AutoItWinSetTitle, AutoItWinGetTitle) to comunicate between your scripts.

Edit : Now it's solved, you can edit the topic title to add SOLVED.

Br, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

Yes, in my opinion I prefer my suggestion because you don't write files.

You can also you use the AutoIt window (AutoItWinSetTitle, AutoItWinGetTitle) to comunicate between your scripts.

Edit : Now it's solved, you can edit the topic title to add SOLVED.

Br, FireFox.

And I am saying I tried your method, and singleton is an unreliable function.

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