Source language: Translate to:

standby mode

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

standby mode

Postby Alex » Tue Jan 25, 2011 2:50 am

Hi,

I am currently trying to make an application that can be able to put the system in standby mode when no activity. But the problem is, how will the program knows that there is no activity after 15min for example?

I tried this code with the mouse first, but I am not sure of the result because it wait 15min every 15min and not 15min every second.

Code: Select all
GetMousePos "[X1]" "[Y1]"
Delay "900000"
GetMousePos "[X2]" "[Y2]"
If "[X1]" "=" "[X2]"
If "[Y1]" "=" "[Y2]"
Run "!C:\Windows\system32\cmd.exe" "/c rundll32.exe powrprof.dll,SetSuspendState" "RunOnce+Hidden" "" ""
endif
endif


Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby smartmedia » Tue Jan 25, 2011 2:57 am

Hi..

In book properties there is a section called idle event. Above there is an execution time. You can put your code there. Im not sure if you enter variable instead of number of seconds in value if is going to work.

Code: Select all
Run "!C:\Windows\system32\cmd.exe" "/c rundll32.exe powrprof.dll,SetSuspendState" "RunOnce+Hidden" "" ""


Keep in mind that, this solution will work only when your PUB is running.

PS.
It could be usefull if Dave add a variable instead of actual seconds in order the user to change idle time in run time.
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Alex » Tue Jan 25, 2011 3:10 am

Hi Smartmedia,

Yes, I know, but if the pub is not using, I mean, if I minimized the application then the pub will idle and then it will execute the standby mode.

Or did I not understand?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Hi...

Postby virger » Tue Jan 25, 2011 7:40 am

1.Try a TIMER
2.Detect MouseMovemnt
3.I did

FROM COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Alex » Tue Jan 25, 2011 7:40 am

Hi virger,

Yes, but how do I do for the keyboard activity?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Oki.

Postby virger » Tue Jan 25, 2011 8:21 am

Try this, and remember
FROM COSTA RICA
HAPPY COUNTRY
PURA VIDA
-------------

1.Page1 Exit Action;
GetMousePos "[x]" "[y]"

2.Page2 Enter Action
:INI
GetMousePos "[xi]" "[yi]"
ifex "[x]<>[xi] OR [y]<>[yi]"
gotopage "Page1"
endif
gotoline "INI"

3.In Page2: TertEnter (all page, snap positopn center) with Action:
if "[ch]" "<>" ""
gotopage "Page1"
endif

Idid whit this trip.
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Alex » Tue Jan 25, 2011 12:10 pm

Hi,

Yes but this is for the mouse, but for the keyboard?

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Look....

Postby virger » Tue Jan 25, 2011 4:11 pm

In point #3 it's your answer.


3.In Page2: TertEnter (all page, snap positon center) with Action:
if "[ch]" "<>" ""
gotopage "Page1"
endif

DESDE COSTA RICA
PURA VIDA
User avatar
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Postby Alex » Tue Jan 25, 2011 11:37 pm

Hi,

No, I mean the keyboard status, and what does [ch] mean? and I don't ant to got to the next page, I want to go to standby as I put the code more on the top...

If I don't use my keyboard for 15min and the mouse for example, how will the program know that it is in idle mode? I know how to do for the mouse but not for the keyboard.

Thanks
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby smartmedia » Wed Jan 26, 2011 1:23 am

Hi..

Try that and tell me...

Code: Select all
NBW Publication Source File
(C)1993-2009 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,60
ScreenColors=16777216
ScreenWidth=320
ScreenHeight=200
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
AutoReturn=Yes
ReturnTime=60
ReturnAction=SetVar "[CountedTime]" "[CountedTime]+1"¶if "[CountedTime]" "=" "[TimeToSleep]"¶if "[Sleep]" "=" "Yes"¶AlertBox "Information" "Your PC will sleep now.."¶.Run "!C:\Windows\system32\cmd.exe" "/c rundll32.exe powrprof.dll,SetSuspendState" "RunOnce+Hidden" "" ""¶endif¶endif
ShapeTransColor=536870912
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=8
Name=Text1
X=7
Y=12
W=306
H=45
Anchor=0
Font=Arial
FontSize=10
FontStyle=1
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0\b In this demo you can enter the time in minutes \plain\f0\fs20\cf0\b before your PC sleeps.}}¶}
HMargin=4
VMargin=4
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=3
ObjectType=3
Name=PushButton1
X=44
Y=160
W=117
H=33
Anchor=0
Text=Start
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=SetVar "[Sleep]" "Yes"
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=3
Name=PushButton2
X=162
Y=160
W=117
H=33
Anchor=0
Text=Cancel
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=SetVar "[CountedTime]" ""¶SetVar "[Sleep]" "No"
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=9
Name=TextEntry1
X=252
Y=100
W=35
H=22
Anchor=0
VarName=[TimeToSleep]
EditNumber=Yes
EditLen=2
LineColor=12632256
LineWidth=1
LineStyle=0
FillColor=16777215
FillPattern=0
FillMode=Yes
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6
ObjectType=8
Name=Text2
X=8
Y=96
W=243
H=40
Anchor=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\ql\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs20\cf0 Enter the time in minutes before your PC go to sleep.}}}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=2
User avatar
smartmedia
 
Posts: 889
Joined: Fri Apr 01, 2005 6:50 am
Location: Hellas

Postby Alex » Wed Jan 26, 2011 6:54 am

Hi,

Thanks smartmedia, but it is only for the application. If I minimize the program and that I go to the Internet then the application will be in idle mode and will standby! I want that it knows my activity by mouse (solved) and keyboard.

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby Alex » Thu Jan 27, 2011 1:39 am

Hi Danito,

Excellent, it is exactly what I was searching for.

Thanks


Alex
Alex
 
Posts: 745
Joined: Sat Mar 04, 2006 4:53 am

Postby aguilar955 » Thu Jan 27, 2011 3:30 pm

Muy bueno el ejemplo.

Salu2
aguilar955
 
Posts: 85
Joined: Sat Jan 17, 2009 10:50 am


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 3 guests

cron