Sign in to follow this  
Followers 0
Seth27

Process should run in background

12 posts in this topic

Hallo,

how can I describe a programm, that it should run in the background, that you can't see any windows and so on, and that it isn't affected by inputs of the keyboard?

THank you!!!

Share this post


Link to post
Share on other sites



Hallo,

how can I describe a programm, that it should run in the background, that you can't see any windows and so on, and that it isn't affected by inputs of the keyboard?

THank you!!!

You just described one... now what are you really wanting to know?

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Hi JSThePatriot,

I want to know, how the script can run in the background.

When I run my script and the content of the script is:

run("notepad.exe)

send ("Hello")

Then the programm save the file and close "notepad"

The whole programm should run in the background, that I can't see how notepad start and write "Hello".

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@Seth27,

look at '#NoTrayIcon '. If you don't use a GUI in your script you only can find your program in the processlist, I think. How to hide a pcrocess? I don't know.

Briegel

EDIT1: Sorry I don't read all. Look at 'run' and '@SW_HIDE'.

EDIT2: I tried it with notepad by using 'ControlSend()' but 'ControlSend()' only can send a string to a active window. How to activate a hidden window? If you want to write a file have a look at 'User Defined Function Reference - File Management'.

Edited by Briegel

Share this post


Link to post
Share on other sites

Notepad is essentially just an Edit control, and as such you can interact using the Control... functions.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

@Skruge,

this little script works.

$filenamepath= 'C:\TEMP\test.txt'

Run('notepad.exe','')
ProcessWait('notepad.exe')
ControlSend('Unbenannt - Editor', "", 15, "Hallo" )
ControlSend('Unbenannt - Editor', "", 15, "!d" & 'b' )
Sleep(500)
ControlClick('Editor','',6)
Sleep(500)
ControlFocus('Speichern unter','',1148)
ControlSetText('Speichern unter','',1148,$filenamepath)
ControlClick('Speichern unter','',1148)
Sleep(500)
ControlSend('Speichern unter','',1,'!s')

it doesn't.

I wonder how to check what goes wrong with a hidden window. :D

Share this post


Link to post
Share on other sites

@Briegel -

I think the problem may be with ControlSend.

It appears that you're sending menu keystrokes to the Edit control, which apparently works while visible.

I used ClassNameNN notation because I don't know your Control IDs.

I also translated it to english because I'm not sure what [Alt+d, b] represents. (Mein Deutsch ist nicht so gut)

@Seth27 -

This works for me... Hopefully you can adapt that to what you wanted to accomplish.

#notrayicon
Opt("WinTitleMatchMode", 2)

; Remove Test file
$filenamepath = 'C:\test.txt'
FileDelete($filenamepath)

; Launch Notepad and Enter some text
Run("notepad", "", @SW_HIDE)
ProcessWait("notepad.exe")
ControlSend("Notepad", "", "Edit1", "Hallo")

; Save as $filenamepath
WinMenuSelectItem("Notepad", "", "&File", "Save &As...")
WinWait("Save As", "")
ControlSetText("Save As", "", "Edit1", $filenamepath)
ControlClick("Save As", "", "Button2")

; Show the window after a brief delay
Sleep(5000)
WinSetState("Notepad", "", @SW_SHOW)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

@Briegel -

I think the problem may be with ControlSend.

It appears that you're sending menu keystrokes to the Edit control, which apparently works while visible.

I used ClassNameNN notation because I don't know your Control IDs.

I also translated it to english because I'm not sure what [Alt+d, b] represents. (Mein Deutsch ist nicht so gut)

@Seth27 -

This works for me... Hopefully you can adapt that to what you wanted to accomplish.

#notrayicon
Opt("WinTitleMatchMode", 2)

; Remove Test file
$filenamepath = 'C:\test.txt'
FileDelete($filenamepath)

; Launch Notepad and Enter some text
Run("notepad", "", @SW_HIDE)
ProcessWait("notepad.exe")
ControlSend("Notepad", "", "Edit1", "Hallo")

; Save as $filenamepath
WinMenuSelectItem("Notepad", "", "&File", "Save &As...")
WinWait("Save As", "")
ControlSetText("Save As", "", "Edit1", $filenamepath)
ControlClick("Save As", "", "Button2")

; Show the window after a brief delay
Sleep(5000)
WinSetState("Notepad", "", @SW_SHOW)oÝ÷ Ûú®¢×¢ç(ºWZ²±È^jÛh¡«­¢+ع½ÑÉ好¸(ÀÌØí¥±¹µÁÑ ô!½µÉ¥ÙµÀìÌäìÀäÈíQÍÑ¥¹QáÐÄĹÑáÐÌäì)¥±]É¥Ñ ÀÌØí¥±¹µÁÑ °Ìäí!±±¼Ìäì¤)IÕ¸ Ìäí¹½ÑÁ¹áÅÕ½ÐìÌäìµÀìÀÌØí¥±¹µÁÑ µÀìÌäìÅÕ½ÐìÌäì¤
:D

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@Skruge,

thanks for explanation what did I wrong. Again I've learned something.

The 'Save As' window is visible during control functions works. Is it possible to hide this window too? I tried it with

WinWait('Save As', '')
WinSetState('Save As', '',@SW_HIDE )oÝ÷ Ù»­¶­g­ì"Ú0Ëâ²&åzÖ¤zÈî²Ö¬àÂ+a¢ëwõh§IëRµ«^ßÔ¶»"¯{*.¶ z¹ÚÚÉZ¶*'"׬µçpØ[yÆ®±â-)äʧyçbµ«­¢+ع½ÑÉ好¸)=ÁÐ ÅÕ½Ðí]¥¹Q¥Ñ±5Ñ¡5½ÅÕ½Ðì°È¤((ìIµ½ÙQÍÐ¥±(ÀÌØí¥±¹µÁÑ ôÌäíèÀäÈíQµÀÀäÈíÑÍйÑáÐÌäì)¥±±Ñ ÀÌØí¥±¹µÁÑ ¤((ì1Õ¹ 9½ÑÁ¹¹ÑÈͽµÑáÐ)IÕ¸ Ìäí¹½ÑÁÌäì°ÌäìÌäì°M]}!%¤)AɽÍÍ]¥Ð Ìäí¹½ÑÁ¹áÌäì¤)
½¹Ñɽ±M¹ ÌäíU¹¹¹¹Ð´¥Ñ½ÈÌäì°ÌäìÌäì°Ìäí¥ÐÄÌäì°Ìäí!±±¼Ìäì¤((ìMÙÌÀÌØí¥±¹µÁÑ )]¥¹5¹ÕM±Ñ%Ñ´ ÌäíU¹¹¹¹Ð´¥Ñ½ÈÌäì°ÌäìÌäì°ÌäìµÀíѤÌäì°ÌäíMÁ¥¡É¸µÀíÕ¹Ñȸ¸¸Ìäì¤)]¥¹]¥Ð ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì¤)
½¹Ñɽ±MÑQáÐ ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì°Ìäí¥ÐÄÌäì°ÀÌØí¥±¹µÁÑ ¤)
½¹Ñɽ±
±¥¬ ÌäíMÁ¥¡É¸Õ¹ÑÈÌäì°ÌäìÌäì°Ìäí    ÕÑѽ¸ÈÌäì¤((ìM¡½ÜÑ¡Ý¥¹½ÜÑÈÉ¥±ä)M±À ÔÀÀÀ¤)]¥¹MÑMÑÑ Ìäí¥Ñ½ÈÌäì°ÌäìÌäì°M]}M!=

EDIT: @SmOke_N,

sorry I didn't see your post before. I think it's not a cheat. It's an easier way to write something.

If you want to write a file have a look at 'User Defined Function Reference - File Management'.

Edited by Briegel

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

EDIT: @SmOke_N,

sorry I didn't see your post before. I think it's not a cheat. It's an easier way to write something.

:D ... I've been finding alot of shortcuts lately because I ALWAYS tend to take the long way around everything to get the SAME result.

Edit:

My ebonics is acting up.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Hello...

can anyone help me for solve this problem...

i has make my own makro programs, and i want the makro programs is runing in backround proccess, so i can still open a web browser or chat in MSN. anyone know about rhe code ? tq

Share this post


Link to post
Share on other sites

Hello...

can anyone help me for solve this problem...

i has make my own makro programs, and i want the makro programs is runing in backround proccess, so i can still open a web browser or chat in MSN. anyone know about rhe code ? tq

hmm, 3 posts and 3 times questionable.

Why are you resurrecting an 2 years old thread that doesn't seem to have much to do with your question.

As to your question: Explain what it is you really want here, because all autoit3 script run independently.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0